1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Raffaele Tranquillini <raffaele.tranquillini@gmail.com>
4 */
5
6/dts-v1/;
7
8#include "msm8996.dtsi"
9#include "msm8996-xiaomi-common.dtsi"
10#include <dt-bindings/sound/qcom,q6afe.h>
11#include <dt-bindings/sound/qcom,q6asm.h>
12#include <dt-bindings/sound/qcom,wcd9335.h>
13#include <dt-bindings/input/ti-drv260x.h>
14
15/ {
16	model = "Xiaomi Mi 5";
17	compatible = "xiaomi,gemini", "qcom,msm8996";
18	chassis-type = "handset";
19	qcom,msm-id = <246 0x30001>;
20	qcom,pmic-id = <0x20009 0x2000a 0x00 0x00>;
21	qcom,board-id = <31 0>;
22
23	clocks {
24		divclk2_haptics: divclk2 {
25			compatible = "fixed-clock";
26			#clock-cells = <0>;
27			clock-frequency = <32768>;
28			clock-output-names = "divclk2";
29
30			pinctrl-names = "default";
31			pinctrl-0 = <&divclk2_pin_a>;
32		};
33	};
34};
35
36&adsp_pil {
37	firmware-name = "qcom/msm8996/gemini/adsp.mbn";
38};
39
40&blsp2_i2c3 {
41	haptics: drv2604@5a {
42		compatible = "ti,drv2604";
43		reg = <0x5a>;
44		enable-gpio = <&tlmm 93 0x00>;
45		mode = <DRV260X_LRA_MODE>;
46		library-sel = <DRV260X_LIB_LRA>;
47		pinctrl-names = "default","sleep";
48		pinctrl-0 = <&vibrator_default>;
49		pinctrl-1 = <&vibrator_sleep>;
50	};
51
52	lp5562@30 {
53		compatible = "ti,lp5562";
54		reg = <0x30>;
55		#address-cells = <1>;
56		#size-cells = <0>;
57		enable-gpios = <&pm8994_gpios 7 1>;
58		clock-mode = /bits/8 <2>;
59		label = "button-backlight";
60
61		led@0 {
62			reg = <0>;
63			chan-name = "button-backlight";
64			led-cur = /bits/ 8 <0x32>;
65			max-cur = /bits/ 8 <0xc8>;
66		};
67
68		led@1 {
69			reg = <0>;
70			chan-name = "button-backlight1";
71			led-cur = /bits/ 8 <0x32>;
72			max-cur = /bits/ 8 <0xc8>;
73		};
74	};
75};
76
77&blsp2_i2c6 {
78	synaptics@20 {
79		compatible = "syna,rmi4-i2c";
80		reg = <0x20>;
81		#address-cells = <1>;
82		#size-cells = <0>;
83		interrupt-parent = <&tlmm>;
84		interrupts = <125 IRQ_TYPE_LEVEL_LOW>;
85		vdda-supply = <&vreg_l6a_1p8>;
86		vdd-supply = <&vdd_3v2_tp>;
87		reset-gpios = <&tlmm 89 GPIO_ACTIVE_LOW>;
88
89		pinctrl-names = "default", "sleep";
90		pinctrl-0 = <&touchscreen_default>;
91		pinctrl-1 = <&touchscreen_sleep>;
92	};
93
94};
95
96&dsi0 {
97	status = "okay";
98
99	vdd-supply = <&vreg_l2a_1p25>;
100	vdda-supply = <&vreg_l19a_3p3>;
101	vddio-supply = <&vreg_l14a_1p8>;
102
103	pinctrl-names = "default", "sleep";
104	pinctrl-0 = <&mdss_dsi_default &mdss_te_default>;
105	pinctrl-1 = <&mdss_dsi_sleep &mdss_te_sleep>;
106
107	panel: panel@0 {
108		compatible = "jdi,fhd-r63452";
109		reg = <0>;
110		reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>;
111		backlight = <&pmi8994_wled>;
112
113		port {
114			panel_in: endpoint {
115				remote-endpoint = <&dsi0_out>;
116			};
117		};
118	};
119};
120
121&dsi0_out {
122	remote-endpoint = <&panel_in>;
123};
124
125&gpu {
126	zap-shader {
127		firmware-name = "qcom/msm8996/gemini/a530_zap.mbn";
128	};
129};
130
131&pmi8994_wled {
132	status = "okay";
133};
134
135&mss_pil {
136	firmware-name = "qcom/msm8996/gemini/mba.mbn",
137			"qcom/msm8996/gemini/modem.mbn";
138};
139
140&q6asmdai {
141	dai@0 {
142		reg = <0>;
143	};
144
145	dai@1 {
146		reg = <1>;
147	};
148
149	dai@2 {
150		reg = <2>;
151	};
152};
153
154&slpi_pil {
155	firmware-name = "qcom/msm8996/gemini/slpi.mbn";
156};
157
158&sound {
159	compatible = "qcom,apq8096-sndcard";
160	model = "gemini";
161	audio-routing = "RX_BIAS", "MCLK",
162		"MM_DL1",  "MultiMedia1 Playback",
163		"MM_DL2",  "MultiMedia2 Playback",
164		"MultiMedia3 Capture", "MM_UL3";
165
166	mm1-dai-link {
167		link-name = "MultiMedia1";
168		cpu {
169			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
170		};
171	};
172
173	mm2-dai-link {
174		link-name = "MultiMedia2";
175		cpu {
176			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
177		};
178	};
179
180	mm3-dai-link {
181		link-name = "MultiMedia3";
182		cpu {
183			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>;
184		};
185	};
186
187	slim-dai-link {
188		link-name = "SLIM Playback";
189		cpu {
190			sound-dai = <&q6afedai SLIMBUS_6_RX>;
191		};
192
193		platform {
194			sound-dai = <&q6routing>;
195		};
196
197		codec {
198			sound-dai = <&wcd9335 AIF4_PB>;
199		};
200	};
201
202	slimcap-dai-link {
203		link-name = "SLIM Capture";
204		cpu {
205			sound-dai = <&q6afedai SLIMBUS_0_TX>;
206		};
207
208		platform {
209			sound-dai = <&q6routing>;
210		};
211
212		codec {
213			sound-dai = <&wcd9335 AIF1_CAP>;
214		};
215	};
216};
217
218&venus {
219	firmware-name = "qcom/msm8996/gemini/venus.mbn";
220};
221
222&rpm_requests {
223	regulators-0 {
224		vreg_l17a_2p8: l17 {
225			regulator-name = "vreg_l17a_2p8";
226			regulator-min-microvolt = <2500000>;
227			regulator-max-microvolt = <2500000>;
228		};
229		vreg_l29a_2p7: l29 {
230			regulator-name = "vreg_l29a_2p7";
231			regulator-min-microvolt = <2800000>;
232			regulator-max-microvolt = <2800000>;
233		};
234	};
235};
236
237&pm8994_gpios {
238	gpio-line-names =
239		"NC",			/* GPIO_1  */
240		"VOL_UP_N",		/* GPIO_2  */
241		"SPKR_ID",		/* GPIO_3  */
242		"PWM_HAPTICS",		/* GPIO_4  */
243		"INFARED_DRV",		/* GPIO_5  */
244		"NC",			/* GPIO_6  */
245		"KEYPAD_LED_EN",	/* GPIO_7  */
246		"WL_EN",		/* GPIO_8  */
247		"3P3_ENABLE",		/* GPIO_9  */
248		"FP_ID",		/* GPIO_10 */
249		"NC",			/* GPIO_11 */
250		"NC",			/* GPIO_12 */
251		"NC",			/* GPIO_13 */
252		"NC",			/* GPIO_14 */
253		"DIVCLK1_CDC",		/* GPIO_15 */
254		"DIVCLK2_HAPTICS",	/* GPIO_16 */
255		"NC",			/* GPIO_17 */
256		"32KHz_CLK_IN",		/* GPIO_18 */
257		"BT_EN",		/* GPIO_19 */
258		"PMIC_SLB",		/* GPIO_20 */
259		"UIM_BATT_ALARM",	/* GPIO_21 */
260		"NC";			/* GPIO_22 */
261
262	divclk2_pin_a: divclk2-state {
263		pins = "gpio16";
264		function = PMIC_GPIO_FUNC_FUNC2;
265		bias-disable;
266		power-source = <PM8994_GPIO_S4>;
267	};
268};
269
270&pm8994_mpps {
271	gpio-line-names =
272		"NC",			/* MPP_1 */
273		"CCI_TIMER1",		/* MPP_2 */
274		"PMIC_SLB",		/* MPP_3 */
275		"EXT_FET_WLED_PWR_EN_N",/* MPP_4 */
276		"NC",			/* MPP_5 */
277		"NC",			/* MPP_6 */
278		"NC",			/* MPP_7 */
279		"NC";			/* MPP_8 */
280};
281
282&pmi8994_gpios {
283	gpio-line-names =
284		"NC",			/* GPIO_1  */
285		"SPKR_PA_RST",		/* GPIO_2  */
286		"NC",			/* GPIO_3  */
287		"NC",			/* GPIO_4  */
288		"NC",			/* GPIO_5  */
289		"NC",			/* GPIO_6  */
290		"NC",			/* GPIO_7  */
291		"NC",			/* GPIO_8  */
292		"NC",			/* GPIO_9  */
293		"NC";			/* GPIO_10 */
294};
295
296&tlmm {
297	gpio-line-names =
298		"ESE_SPI_MOSI",		/* GPIO_0   */
299		"ESE_SPI_MISO",		/* GPIO_1   */
300		"ERR_INT_N",		/* GPIO_2   */
301		"ESE_SPI_CLK",		/* GPIO_3   */
302		"MSM_UART_TX",		/* GPIO_4   */
303		"MSM_UART_RX",		/* GPIO_5   */
304		"NFC_I2C_SDA",		/* GPIO_6   */
305		"NFC_I2C_SCL",		/* GPIO_7   */
306		"LCD0_RESET_N",		/* GPIO_8   */
307		"NFC_IRQ",		/* GPIO_9   */
308		"LCD_TE",		/* GPIO_10  */
309		"LCD_ID_DET1",		/* GPIO_11  */
310		"NFC_DISABLE",		/* GPIO_12  */
311		"CAM_MCLK0",		/* GPIO_13  */
312		"NC",			/* GPIO_14  */
313		"CAM_MCLK2",		/* GPIO_15  */
314		"ESE_PWR_REQ",		/* GPIO_16  */
315		"CCI_I2C_SDA0",		/* GPIO_17  */
316		"CCI_I2C_SCL0",		/* GPIO_18  */
317		"CCI_I2C_SDA1",		/* GPIO_19  */
318		"CCI_I2C_SCL1",		/* GPIO_20  */
319		"NFC_DWL_REQ",		/* GPIO_21  */
320		"CCI_TIMER1",		/* GPIO_22  */
321		"WEBCAM1_RESET_N",	/* GPIO_23  */
322		"ESE_IRQ",		/* GPIO_24  */
323		"NC",			/* GPIO_25  */
324		"WEBCAM1_STANDBY",	/* GPIO_26  */
325		"NC",			/* GPIO_27  */
326		"NC",			/* GPIO_28  */
327		"NC",			/* GPIO_29  */
328		"CAM1_RST_N",		/* GPIO_30  */
329		"NC",			/* GPIO_31  */
330		"NC",			/* GPIO_32  */
331		"NC",			/* GPIO_33  */
332		"FP_DOME_SW",		/* GPIO_34  */
333		"PCI_E0_RST_N",		/* GPIO_35  */
334		"PCI_E0_CLKREQ_N",	/* GPIO_36  */
335		"PCI_E0_WAKE",		/* GPIO_37  */
336		"FM_INT_N",		/* GPIO_38  */
337		"FM_RESET_N",		/* GPIO_39  */
338		"NC",			/* GPIO_40  */
339		"QCA_UART_TXD",		/* GPIO_41  */
340		"QCA_UART_RXD",		/* GPIO_42  */
341		"QCA_UART_CTS",		/* GPIO_43  */
342		"QCA_UART_RTS",		/* GPIO_44  */
343		"MAWC_UART_TX",		/* GPIO_45  */
344		"MAWC_UART_RX",		/* GPIO_46  */
345		"NC",			/* GPIO_47  */
346		"NC",			/* GPIO_48  */
347		"AUDIO_SWITCH_EN",	/* GPIO_49  */
348		"FP_SPI_RST",		/* GPIO_50  */
349		"TYPEC_I2C_SDA",	/* GPIO_51  */
350		"TYPEC_I2C_SCL",	/* GPIO_52  */
351		"CODEC_INT2_N",		/* GPIO_53  */
352		"CODEC_INT1_N",		/* GPIO_54  */
353		"APPS_I2C7_SDA",	/* GPIO_55  */
354		"APPS_I2C7_SCL",	/* GPIO_56  */
355		"FORCE_USB_BOOT",	/* GPIO_57  */
356		"SPKR_I2S_BCK",		/* GPIO_58  */
357		"SPKR_I2S_WS",		/* GPIO_59  */
358		"SPKR_I2S_DOUT",	/* GPIO_60  */
359		"SPKR_I2S_DIN",		/* GPIO_61  */
360		"ESE_RSTN",		/* GPIO_62  */
361		"TYPEC_INT",		/* GPIO_63  */
362		"CODEC_RESET_N",	/* GPIO_64  */
363		"PCM_CLK",		/* GPIO_65  */
364		"PCM_SYNC",		/* GPIO_66  */
365		"PCM_DIN",		/* GPIO_67  */
366		"PCM_DOUT",		/* GPIO_68  */
367		"HIFI_CLK",		/* GPIO_69  */
368		"SLIMBUS_CLK",		/* GPIO_70  */
369		"SLIMBUS_DATA0",	/* GPIO_71  */
370		"SLIMBUS_DATA1",	/* GPIO_72  */
371		"LDO_5V_IN_EN",		/* GPIO_73  */
372		"NC",			/* GPIO_74  */
373		"FM_I2S_CLK",		/* GPIO_75  */
374		"FM_I2S_SYNC",		/* GPIO_76  */
375		"FM_I2S_DATA",		/* GPIO_77  */
376		"FM_STATUS",		/* GPIO_78  */
377		"NC",			/* GPIO_79  */
378		"SENSOR_RESET_N",	/* GPIO_80  */
379		"FP_SPI_MOSI",		/* GPIO_81  */
380		"FP_SPI_MISO",		/* GPIO_82  */
381		"FP_SPI_CS_N",		/* GPIO_83  */
382		"FP_SPI_CLK",		/* GPIO_84  */
383		"NC",			/* GPIO_85  */
384		"CAM_VDD_1P05_EN",	/* GPIO_86  */
385		"MSM_TS_I2C_SDA",	/* GPIO_87  */
386		"MSM_TS_I2C_SCL",	/* GPIO_88  */
387		"TS_RESOUT_N",		/* GPIO_89  */
388		"ESE_SPI_CS_N",		/* GPIO_90  */
389		"NC",			/* GPIO_91  */
390		"NC",			/* GPIO_92  */
391		"HAPTICS_EN",		/* GPIO_93  */
392		"NC",			/* GPIO_94  */
393		"NC",			/* GPIO_95  */
394		"NC",			/* GPIO_96  */
395		"NC",			/* GPIO_97  */
396		"GRFC_1",		/* GPIO_98  */
397		"NC",			/* GPIO_99  */
398		"GRFC_3",		/* GPIO_100 */
399		"GRFC_4",		/* GPIO_101 */
400		"NC",			/* GPIO_102 */
401		"NC",			/* GPIO_103 */
402		"GRFC_7",		/* GPIO_104 */
403		"UIM2_DATA",		/* GPIO_105 */
404		"UIM2_CLK",		/* GPIO_106 */
405		"UIM2_RESET",		/* GPIO_107 */
406		"UIM2_PRESENT",		/* GPIO_108 */
407		"UIM1_DATA",		/* GPIO_109 */
408		"UIM1_CLK",		/* GPIO_110 */
409		"UIM1_RESET",		/* GPIO_111 */
410		"UIM1_PRESENT",		/* GPIO_112 */
411		"UIM_BATT_ALARM",	/* GPIO_113 */
412		"GRFC_8",		/* GPIO_114 */
413		"GRFC_9",		/* GPIO_115 */
414		"TX_GTR_THRES",		/* GPIO_116 */
415		"ACCEL_INT",		/* GPIO_117 */
416		"GYRO_INT",		/* GPIO_118 */
417		"COMPASS_INT",		/* GPIO_119 */
418		"PROXIMITY_INT_N",	/* GPIO_120 */
419		"FP_IRQ",		/* GPIO_121 */
420		"NC",			/* GPIO_122 */
421		"HALL_INTR2",		/* GPIO_123 */
422		"HALL_INTR1",		/* GPIO_124 */
423		"TS_INT_N",		/* GPIO_125 */
424		"NC",			/* GPIO_126 */
425		"GRFC_11",		/* GPIO_127 */
426		"NC",			/* GPIO_128 */
427		"EXT_GPS_LNA_EN",	/* GPIO_129 */
428		"NC",			/* GPIO_130 */
429		"NC",			/* GPIO_131 */
430		"NC",			/* GPIO_132 */
431		"GRFC_14",		/* GPIO_133 */
432		"GSM_TX2_PHASE_D",	/* GPIO_134 */
433		"NC",			/* GPIO_135 */
434		"NC",			/* GPIO_136 */
435		"RFFE3_DATA",		/* GPIO_137 */
436		"RFFE3_CLK",		/* GPIO_138 */
437		"NC",			/* GPIO_139 */
438		"NC",			/* GPIO_140 */
439		"RFFE5_DATA",		/* GPIO_141 */
440		"RFFE5_CLK",		/* GPIO_142 */
441		"NC",			/* GPIO_143 */
442		"COEX_UART_TX",		/* GPIO_144 */
443		"COEX_UART_RX",		/* GPIO_145 */
444		"RFFE2_DATA",		/* GPIO_146 */
445		"RFFE2_CLK",		/* GPIO_147 */
446		"RFFE1_DATA",		/* GPIO_148 */
447		"RFFE1_CLK";		/* GPIO_149 */
448
449	touchscreen_default: touchscreen-default-state {
450		pins = "gpio89", "gpio125";
451		function = "gpio";
452		drive-strength = <10>;
453		bias-pull-up;
454	};
455
456	touchscreen_sleep: touchscreen-sleep-state {
457		pins = "gpio89", "gpio125";
458		function = "gpio";
459		drive-strength = <2>;
460		bias-disable;
461	};
462
463	vibrator_default: vibrator-default-state {
464		pins = "gpio93";
465		function = "gpio";
466		drive-strength = <8>;
467		bias-pull-up;
468	};
469
470	vibrator_sleep: vibrator-sleep-state {
471		pins = "gpio93";
472		function = "gpio";
473		drive-strength = <2>;
474		bias-disable;
475	};
476};
477