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