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