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