1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Yassine Oudjana <y.oudjana@protonmail.com>
4 */
5
6/dts-v1/;
7
8#include "msm8996pro.dtsi"
9#include "msm8996-xiaomi-common.dtsi"
10#include "pmi8996.dtsi"
11#include <dt-bindings/sound/qcom,q6afe.h>
12#include <dt-bindings/sound/qcom,q6asm.h>
13#include <dt-bindings/sound/qcom,wcd9335.h>
14
15/ {
16	model = "Xiaomi Mi Note 2";
17	compatible = "xiaomi,scorpio", "qcom,msm8996pro", "qcom,msm8996";
18	chassis-type = "handset";
19	qcom,msm-id = <305 0x10000>;
20	qcom,board-id = <34 0>;
21
22	chosen {
23		#address-cells = <2>;
24		#size-cells = <2>;
25		ranges;
26
27		framebuffer0: framebuffer@83401000 {
28			compatible = "simple-framebuffer";
29			reg = <0x00 0x83401000 0x00 (1080 * 1920 * 3)>;
30			width = <1080>;
31			height = <1920>;
32			stride = <(1080 * 3)>;
33			format = "r8g8b8";
34
35			/* DSI0 and MDP SMMU clocks */
36			clocks = <&mmcc MDSS_MDP_CLK>,
37				 <&mmcc MMSS_MMAGIC_AHB_CLK>,
38				 <&mmcc MDSS_AHB_CLK>,
39				 <&mmcc MDSS_AXI_CLK>,
40				 <&mmcc MMSS_MISC_AHB_CLK>,
41				 <&mmcc MDSS_BYTE0_CLK>,
42				 <&mmcc MDSS_PCLK0_CLK>,
43				 <&mmcc MDSS_ESC0_CLK>,
44				 <&mmcc SMMU_MDP_AHB_CLK>,
45				 <&mmcc SMMU_MDP_AXI_CLK>;
46
47			/* MDSS power domain */
48			power-domains = <&mmcc MDSS_GDSC>;
49		};
50	};
51
52	reserved-memory {
53		cont_splash_mem: memory@83401000 {
54			reg = <0x0 0x83401000 0x0 (1080 * 1920 * 3)>;
55			no-map;
56		};
57	};
58};
59
60&adsp_pil {
61	firmware-name = "qcom/msm8996/scorpio/adsp.mbn";
62};
63
64&blsp2_i2c6 {
65	touchkey: touchkey@28 {
66		compatible = "cypress,sf3155";
67		reg = <0x28>;
68		interrupt-parent = <&tlmm>;
69		interrupts = <77 IRQ_TYPE_EDGE_FALLING>;
70		avdd-supply = <&vreg_l6a_1p8>;
71		vdd-supply = <&vdd_3v2_tp>;
72		linux,keycodes = <KEY_BACK KEY_MENU>;
73
74		pinctrl-names = "default", "sleep";
75		pinctrl-0 = <&touchkey_default>;
76		pinctrl-1 = <&touchkey_sleep>;
77	};
78
79	touchscreen: atmel-mxt-ts@4a {
80		compatible = "atmel,maxtouch";
81		reg = <0x4a>;
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 75 GPIO_ACTIVE_LOW>;
87
88		pinctrl-names = "default", "sleep";
89		pinctrl-0 = <&touchscreen_default>;
90		pinctrl-1 = <&touchscreen_sleep>;
91	};
92};
93
94&gpu {
95	zap-shader {
96		firmware-name = "qcom/msm8996/scorpio/a530_zap.mbn";
97	};
98};
99
100&mdp_smmu {
101	/*
102	 * Probing this SMMU causes a crash due to writing to some secure
103	 * registers. Disable it for now.
104	 */
105	status = "disabled";
106};
107
108&mdss {
109	/*
110	 * MDSS depends on the MDP SMMU, and probing it alters the bootloader
111	 * configured framebuffer used by simplefb. Disable it for now.
112	 */
113	status = "disabled";
114};
115
116&mss_pil {
117	firmware-name = "qcom/msm8996/scorpio/mba.mbn",
118			"qcom/msm8996/scorpio/modem.mbn";
119};
120
121&pm8994_lpg {
122	pinctrl-names = "default";
123	pinctrl-0 = <&keypad_default>;
124
125	led@3 {
126		reg = <3>;
127		color = <LED_COLOR_ID_WHITE>;
128		function = LED_FUNCTION_KBD_BACKLIGHT;
129		function-enumerator = <1>;
130	};
131
132	led@6 {
133		reg = <6>;
134		color = <LED_COLOR_ID_WHITE>;
135		function = LED_FUNCTION_KBD_BACKLIGHT;
136		function-enumerator = <0>;
137	};
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/scorpio/slpi.mbn";
156};
157
158&sound {
159	compatible = "qcom,apq8096-sndcard";
160	model = "scorpio";
161	audio-routing = "RX_BIAS", "MCLK";
162
163	mm1-dai-link {
164		link-name = "MultiMedia1";
165		cpu {
166			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
167		};
168	};
169
170	mm2-dai-link {
171		link-name = "MultiMedia2";
172		cpu {
173			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
174		};
175	};
176
177	mm3-dai-link {
178		link-name = "MultiMedia3";
179		cpu {
180			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>;
181		};
182	};
183
184	slim-dai-link {
185		link-name = "SLIM Playback";
186		cpu {
187			sound-dai = <&q6afedai SLIMBUS_6_RX>;
188		};
189
190		platform {
191			sound-dai = <&q6routing>;
192		};
193
194		codec {
195			sound-dai = <&wcd9335 AIF4_PB>;
196		};
197	};
198
199	slimcap-dai-link {
200		link-name = "SLIM Capture";
201		cpu {
202			sound-dai = <&q6afedai SLIMBUS_0_TX>;
203		};
204
205		platform {
206			sound-dai = <&q6routing>;
207		};
208
209		codec {
210			sound-dai = <&wcd9335 AIF1_CAP>;
211		};
212	};
213};
214
215&venus {
216	firmware-name = "qcom/msm8996/scorpio/venus.mbn";
217};
218
219&rpm_requests {
220	regulators-0 {
221		vreg_l3a_0p875: l3 {
222			regulator-name = "vreg_l3a_0p875";
223			regulator-min-microvolt = <850000>;
224			regulator-max-microvolt = <1300000>;
225		};
226		vreg_l11a_1p1: l11 {
227			regulator-name = "vreg_l11a_1p1";
228			regulator-min-microvolt = <1100000>;
229			regulator-max-microvolt = <1100000>;
230		};
231		vreg_l17a_2p8: l17 {
232			regulator-name = "vreg_l17a_2p8";
233			regulator-min-microvolt = <2800000>;
234			regulator-max-microvolt = <2800000>;
235		};
236		vreg_l18a_2p8: l18 {
237			regulator-name = "vreg_l18a_2p8";
238			regulator-min-microvolt = <2800000>;
239			regulator-max-microvolt = <2800000>;
240		};
241		vreg_l22a_3p0: l22 {
242			regulator-name = "vreg_l22a_3p0";
243			regulator-min-microvolt = <2950000>;
244			regulator-max-microvolt = <3500000>;
245		};
246		vreg_l29a_2p7: l29 {
247			regulator-name = "vreg_l29a_2p7";
248			regulator-min-microvolt = <2700000>;
249			regulator-max-microvolt = <2700000>;
250		};
251	};
252};
253
254&vdd_gfx {
255	regulator-max-microvolt = <1065000>;
256};
257
258&pm8994_gpios {
259	gpio-line-names =
260		"NC",			/* GPIO_1  */
261		"VOL_UP_N",		/* GPIO_2  */
262		"SPKR_ID",		/* GPIO_3  */
263		"PWM_HAPTICS",		/* GPIO_4  */
264		"INFARED_DRV",		/* GPIO_5  */
265		"NC",			/* GPIO_6  */
266		"KEYPAD_LED_EN_A",	/* GPIO_7  */
267		"WL_EN",		/* GPIO_8  */
268		"3P3_ENABLE",		/* GPIO_9  */
269		"KEYPAD_LED_EN_B",	/* GPIO_10 */
270		"FP_ID",		/* GPIO_11 */
271		"NC",			/* GPIO_12 */
272		"NC",			/* GPIO_13 */
273		"NC",			/* GPIO_14 */
274		"DIVCLK1_CDC",		/* GPIO_15 */
275		"DIVCLK2_HAPTICS",	/* GPIO_16 */
276		"NC",			/* GPIO_17 */
277		"32KHz_CLK_IN",		/* GPIO_18 */
278		"BT_EN",		/* GPIO_19 */
279		"PMIC_SLB",		/* GPIO_20 */
280		"UIM_BATT_ALARM",	/* GPIO_21 */
281		"NC";			/* GPIO_22 */
282
283	keypad_default: keypad-default-state {
284		pins = "gpio7", "gpio10";
285		function = PMIC_GPIO_FUNC_FUNC1;
286		output-low;
287		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
288		power-source = <PM8994_GPIO_S4>;
289		bias-disable;
290	};
291};
292
293&pm8994_mpps {
294	gpio-line-names =
295		"VREF_SDC_UIM_APC",	/* MPP_1 */
296		"NC",			/* MPP_2 */
297		"VREF_DACX",		/* MPP_3 */
298		"NC",			/* MPP_4 */
299		"NC",			/* MPP_5 */
300		"STAT_SMB1351",		/* MPP_6 */
301		"NC",			/* MPP_7 */
302		"NC";			/* MPP_8 */
303};
304
305&pmi8994_gpios {
306	gpio-line-names =
307		"NC",			/* GPIO_1  */
308		"SPKR_PA_RST",		/* GPIO_2  */
309		"NC",			/* GPIO_3  */
310		"NC",			/* GPIO_4  */
311		"NC",			/* GPIO_5  */
312		"NC",			/* GPIO_6  */
313		"NC",			/* GPIO_7  */
314		"NC",			/* GPIO_8  */
315		"NC",			/* GPIO_9  */
316		"NC";			/* GPIO_10 */
317};
318
319&tlmm {
320	gpio-line-names =
321		"ESE_SPI_MOSI",		/* GPIO_0   */
322		"ESE_SPI_MISO",		/* GPIO_1   */
323		"NC",			/* GPIO_2   */
324		"ESE_SPI_CLK",		/* GPIO_3   */
325		"MSM_UART_TX",		/* GPIO_4   */
326		"MSM_UART_RX",		/* GPIO_5   */
327		"NFC_I2C_SDA",		/* GPIO_6   */
328		"NFC_I2C_SCL",		/* GPIO_7   */
329		"OLED_RESET_N",		/* GPIO_8   */
330		"NFC_IRQ",		/* GPIO_9   */
331		"OLED_TE",		/* GPIO_10  */
332		"OLED_ID_DET1",		/* GPIO_11  */
333		"NFC_DISABLE",		/* GPIO_12  */
334		"CAM_MCLK0",		/* GPIO_13  */
335		"OLED_ID_DET2",		/* GPIO_14  */
336		"CAM_MCLK2",		/* GPIO_15  */
337		"ESE_PWR_REQ",		/* GPIO_16  */
338		"CCI_I2C_SDA0",		/* GPIO_17  */
339		"CCI_I2C_SCL0",		/* GPIO_18  */
340		"CCI_I2C_SDA1",		/* GPIO_19  */
341		"CCI_I2C_SCL1",		/* GPIO_20  */
342		"NFC_DWL_REQ",		/* GPIO_21  */
343		"CCI_TIMER1",		/* GPIO_22  */
344		"WEBCAM1_RESET_N",	/* GPIO_23  */
345		"ESE_IRQ",		/* GPIO_24  */
346		"NC",			/* GPIO_25  */
347		"WEBCAM1_STANDBY",	/* GPIO_26  */
348		"NC",			/* GPIO_27  */
349		"NC",			/* GPIO_28  */
350		"OLED_ERR_FG",		/* GPIO_29  */
351		"CAM1_RST_N",		/* GPIO_30  */
352		"HIFI_SW_MUTE",		/* GPIO_31  */
353		"NC",			/* GPIO_32  */
354		"NC",			/* GPIO_33  */
355		"FP_DOME_SW",		/* GPIO_34  */
356		"PCI_E0_RST_N",		/* GPIO_35  */
357		"PCI_E0_CLKREQ_N",	/* GPIO_36  */
358		"PCI_E0_WAKE",		/* GPIO_37  */
359		"OV_PWDN",		/* GPIO_38  */
360		"NC",			/* GPIO_39  */
361		"VDDR_1P6_EN",		/* GPIO_40  */
362		"QCA_UART_TXD",		/* GPIO_41  */
363		"QCA_UART_RXD",		/* GPIO_42  */
364		"QCA_UART_CTS",		/* GPIO_43  */
365		"QCA_UART_RTS",		/* GPIO_44  */
366		"MAWC_UART_TX",		/* GPIO_45  */
367		"MAWC_UART_RX",		/* GPIO_46  */
368		"NC",			/* GPIO_47  */
369		"NC",			/* GPIO_48  */
370		"AUDIO_SWITCH_EN",	/* GPIO_49  */
371		"FP_SPI_RST",		/* GPIO_50  */
372		"TYPEC_I2C_SDA",	/* GPIO_51  */
373		"TYPEC_I2C_SCL",	/* GPIO_52  */
374		"CODEC_INT2_N",		/* GPIO_53  */
375		"CODEC_INT1_N",		/* GPIO_54  */
376		"APPS_I2C7_SDA",	/* GPIO_55  */
377		"APPS_I2C7_SCL",	/* GPIO_56  */
378		"FORCE_USB_BOOT",	/* GPIO_57  */
379		"SPKR_I2S_BCK",		/* GPIO_58  */
380		"SPKR_I2S_WS",		/* GPIO_59  */
381		"SPKR_I2S_DOUT",	/* GPIO_60  */
382		"SPKR_I2S_DIN",		/* GPIO_61  */
383		"ESE_RSTN",		/* GPIO_62  */
384		"TYPEC_INT",		/* GPIO_63  */
385		"CODEC_RESET_N",	/* GPIO_64  */
386		"PCM_CLK",		/* GPIO_65  */
387		"PCM_SYNC",		/* GPIO_66  */
388		"PCM_DIN",		/* GPIO_67  */
389		"PCM_DOUT",		/* GPIO_68  */
390		"CDC_44K1_CLK",		/* GPIO_69  */
391		"SLIMBUS_CLK",		/* GPIO_70  */
392		"SLIMBUS_DATA0",	/* GPIO_71  */
393		"SLIMBUS_DATA1",	/* GPIO_72  */
394		"LDO_5V_IN_EN",		/* GPIO_73  */
395		"NC",			/* GPIO_74  */
396		"TSP_RST_N",		/* GPIO_75  */
397		"NC",			/* GPIO_76  */
398		"TOUCHKEY_INT",		/* GPIO_77  */
399		"SPKR_I2S_MCLK",	/* GPIO_78  */
400		"SPKR_PA_INT",		/* GPIO_79  */
401		"SENSOR_RESET_N",	/* GPIO_80  */
402		"FP_SPI_MOSI",		/* GPIO_81  */
403		"FP_SPI_MISO",		/* GPIO_82  */
404		"FP_SPI_CS_N",		/* GPIO_83  */
405		"FP_SPI_CLK",		/* GPIO_84  */
406		"HIFI_SD",		/* GPIO_85  */
407		"CAM_VDD_1P05_EN",	/* GPIO_86  */
408		"MSM_TS_I2C_SDA",	/* GPIO_87  */
409		"MSM_TS_I2C_SCL",	/* GPIO_88  */
410		"NC",			/* GPIO_89  */
411		"ESE_SPI_CS_N",		/* GPIO_90  */
412		"NC",			/* GPIO_91  */
413		"NC",			/* GPIO_92  */
414		"NC",			/* GPIO_93  */
415		"NC",			/* GPIO_94  */
416		"NC",			/* GPIO_95  */
417		"NC",			/* GPIO_96  */
418		"GRFC_0",		/* GPIO_97  */
419		"GRFC_1",		/* GPIO_98  */
420		"NC",			/* GPIO_99  */
421		"GRFC_3",		/* GPIO_100 */
422		"GRFC_4",		/* GPIO_101 */
423		"NC",			/* GPIO_102 */
424		"NC",			/* GPIO_103 */
425		"GRFC_7",		/* GPIO_104 */
426		"UIM2_DATA",		/* GPIO_105 */
427		"UIM2_CLK",		/* GPIO_106 */
428		"UIM2_RESET",		/* GPIO_107 */
429		"UIM2_PRESENT",		/* GPIO_108 */
430		"UIM1_DATA",		/* GPIO_109 */
431		"UIM1_CLK",		/* GPIO_110 */
432		"UIM1_RESET",		/* GPIO_111 */
433		"UIM1_PRESENT",		/* GPIO_112 */
434		"UIM_BATT_ALARM",	/* GPIO_113 */
435		"GRFC_8",		/* GPIO_114 */
436		"GRFC_9",		/* GPIO_115 */
437		"TX_GTR_THRES",		/* GPIO_116 */
438		"ACC_INT",		/* GPIO_117 */
439		"GYRO_INT",		/* GPIO_118 */
440		"COMPASS_INT",		/* GPIO_119 */
441		"PROXIMITY_INT_N",	/* GPIO_120 */
442		"FP_IRQ",		/* GPIO_121 */
443		"TSP_TA",		/* GPIO_122 */
444		"HALL_INTR2",		/* GPIO_123 */
445		"HALL_INTR1",		/* GPIO_124 */
446		"TS_INT_N",		/* GPIO_125 */
447		"NC",			/* GPIO_126 */
448		"GRFC_11",		/* GPIO_127 */
449		"HIFI_PWR_EN",		/* GPIO_128 */
450		"EXT_GPS_LNA_EN",	/* GPIO_129 */
451		"NC",			/* GPIO_130 */
452		"NC",			/* GPIO_131 */
453		"NC",			/* GPIO_132 */
454		"GRFC_14",		/* GPIO_133 */
455		"GSM_TX2_PHASE_D",	/* GPIO_134 */
456		"HIFI_SW_SEL",		/* GPIO_135 */
457		"GRFC_15",		/* GPIO_136 */
458		"RFFE3_DATA",		/* GPIO_137 */
459		"RFFE3_CLK",		/* GPIO_138 */
460		"NC",			/* GPIO_139 */
461		"NC",			/* GPIO_140 */
462		"RFFE5_DATA",		/* GPIO_141 */
463		"RFFE5_CLK",		/* GPIO_142 */
464		"NC",			/* GPIO_143 */
465		"COEX_UART_TX",		/* GPIO_144 */
466		"COEX_UART_RX",		/* GPIO_145 */
467		"RFFE2_DATA",		/* GPIO_146 */
468		"RFFE2_CLK",		/* GPIO_147 */
469		"RFFE1_DATA",		/* GPIO_148 */
470		"RFFE1_CLK";		/* GPIO_149 */
471
472	touchkey_default: touchkey-default-state {
473		pins = "gpio77";
474		function = "gpio";
475		drive-strength = <16>;
476		bias-pull-up;
477	};
478
479	touchkey_sleep: touchkey-sleep-state {
480		pins = "gpio77";
481		function = "gpio";
482		drive-strength = <2>;
483		bias-disable;
484	};
485
486	touchscreen_default: touchscreen-default-state {
487		pins = "gpio75", "gpio125";
488		function = "gpio";
489		drive-strength = <10>;
490		bias-pull-up;
491	};
492
493	touchscreen_sleep: touchscreen-sleep-state {
494		pins = "gpio75", "gpio125";
495		function = "gpio";
496		drive-strength = <2>;
497		bias-disable;
498	};
499};
500