1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2022, Eugene Lepshy <fekz115@gmail.com>
4 * Copyright (c) 2022, Gianluca Boiano <morf3089@gmail.com>
5 */
6/dts-v1/;
7
8#include "msm8953.dtsi"
9#include "pm8953.dtsi"
10#include "pmi8950.dtsi"
11#include <dt-bindings/leds/common.h>
12
13/delete-node/ &adsp_fw_mem;
14/delete-node/ &cont_splash_mem;
15/delete-node/ &qseecom_mem;
16/delete-node/ &wcnss_fw_mem;
17
18/ {
19	model = "Xiaomi Redmi 5 Plus";
20	compatible = "xiaomi,vince", "qcom,msm8953";
21	chassis-type = "handset";
22	qcom,msm-id = <293 0>;
23	qcom,board-id= <0x1000b 0x08>;
24
25	gpio-keys {
26		compatible = "gpio-keys";
27
28		pinctrl-names = "default";
29		pinctrl-0 = <&gpio_key_default>;
30
31		key-volume-up {
32			label = "volume_up";
33			linux,code = <KEY_VOLUMEUP>;
34			gpios = <&tlmm 85 GPIO_ACTIVE_LOW>;
35		};
36	};
37
38	reserved-memory {
39		qseecom_mem: qseecom@84a00000 {
40			reg = <0x0 0x84a00000 0x0 0x1900000>;
41			no-map;
42		};
43
44		cont_splash_mem: cont-splash@90001000 {
45			reg = <0x0 0x90001000 0x0 (1080 * 2160 * 3)>;
46			no-map;
47		};
48
49		adsp_fw_mem: adsp@8d600000 {
50			reg = <0x0 0x8d600000 0x0 0x1200000>;
51			no-map;
52		};
53
54		wcnss_fw_mem: wcnss@8e800000 {
55			reg = <0x0 0x8e800000 0x0 0x700000>;
56			no-map;
57		};
58
59		ramoops@9ff00000 {
60			compatible = "ramoops";
61			reg = <0x0 0x9ff00000 0x0 0x100000>;
62			record-size = <0x1000>;
63			console-size = <0x80000>;
64			ftrace-size = <0x1000>;
65			pmsg-size = <0x8000>;
66		};
67	};
68
69	/*
70	 * We bitbang on &i2c_4 because BLSP is protected by TZ as sensors are
71	 * normally proxied via ADSP firmware. GPIOs aren't protected.
72	 */
73	i2c-sensors {
74		compatible = "i2c-gpio";
75		sda-gpios = <&tlmm 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
76		scl-gpios = <&tlmm 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
77		i2c-gpio,delay-us = <2>; /* ~100 kHz */
78		#address-cells = <1>;
79		#size-cells = <0>;
80
81		imu@6a {
82			compatible = "st,lsm6dsl";
83			reg = <0x6a>;
84			vdd-supply = <&pm8953_l10>;
85			vddio-supply = <&pm8953_l6>;
86			mount-matrix = "1", "0", "0",
87					"0", "-1", "0",
88					"0", "0", "1";
89		};
90	};
91
92	vph_pwr: vph-pwr-regulator {
93		compatible = "regulator-fixed";
94		regulator-name = "vph_pwr";
95		regulator-always-on;
96		regulator-boot-on;
97	};
98};
99
100&hsusb_phy {
101	vdd-supply = <&pm8953_l3>;
102	vdda-pll-supply = <&pm8953_l7>;
103	vdda-phy-dpdm-supply = <&pm8953_l13>;
104
105	status = "okay";
106};
107
108&i2c_2 {
109	status = "okay";
110
111	led-controller@45 {
112		compatible = "awinic,aw2013";
113		reg = <0x45>;
114
115		vcc-supply = <&pm8953_l10>;
116
117		#address-cells = <1>;
118		#size-cells = <0>;
119
120		led@0 {
121			reg = <0>;
122			led-max-microamp = <5000>;
123			function = LED_FUNCTION_INDICATOR;
124			color = <LED_COLOR_ID_WHITE>;
125		};
126	};
127};
128
129&i2c_3 {
130	status = "okay";
131
132	touchscreen@20 {
133		reg = <0x20>;
134		compatible = "syna,rmi4-i2c";
135		interrupts-parent = <&tlmm>;
136		interrupts-extended = <&tlmm 65 IRQ_TYPE_EDGE_FALLING>;
137
138		#address-cells = <1>;
139		#size-cells = <0>;
140
141		vdd-supply = <&pm8953_l10>;
142		vio-supply = <&pm8953_l6>;
143
144		pinctrl-names = "init", "suspend";
145		pinctrl-0 = <&ts_reset_active &ts_int_active>;
146		pinctrl-1 = <&ts_reset_suspend &ts_int_suspend>;
147		syna,reset-delay-ms = <200>;
148		syna,startup-delay-ms = <500>;
149
150		rmi4-f01@1 {
151			reg = <0x01>;
152			syna,nosleep-mode = <1>;
153		};
154
155		rmi4-f12@12 {
156			reg = <0x12>;
157			syna,rezero-wait-ms = <20>;
158			syna,sensor-type = <1>;
159			touchscreen-x-mm = <68>;
160			touchscreen-y-mm = <122>;
161		};
162	};
163};
164
165&pm8953_resin {
166	linux,code = <KEY_VOLUMEDOWN>;
167	status = "okay";
168};
169
170&pmi8950_wled {
171	qcom,current-limit-microamp = <20000>;
172	qcom,ovp-millivolt = <29600>;
173	qcom,num-strings = <2>;
174	qcom,external-pfet;
175	qcom,cabc;
176
177	status = "okay";
178};
179
180&rpm_requests {
181	regulators {
182		compatible = "qcom,rpm-pm8953-regulators";
183		vdd_s1-supply = <&vph_pwr>;
184		vdd_s2-supply = <&vph_pwr>;
185		vdd_s3-supply = <&vph_pwr>;
186		vdd_s4-supply = <&vph_pwr>;
187		vdd_s5-supply = <&vph_pwr>;
188		vdd_s6-supply = <&vph_pwr>;
189		vdd_s7-supply = <&vph_pwr>;
190		vdd_l1-supply = <&pm8953_s3>;
191		vdd_l2_l3-supply = <&pm8953_s3>;
192		vdd_l4_l5_l6_l7_l16_l19-supply = <&pm8953_s4>;
193		vdd_l8_l11_l12_l13_l14_l15-supply = <&vph_pwr>;
194		vdd_l9_l10_l17_l18_l22-supply = <&vph_pwr>;
195
196		pm8953_s1: s1 {
197			regulator-min-microvolt = <870000>;
198			regulator-max-microvolt = <1156000>;
199		};
200
201		pm8953_s3: s3 {
202			regulator-min-microvolt = <984000>;
203			regulator-max-microvolt = <1224000>;
204		};
205
206		pm8953_s4: s4 {
207			regulator-min-microvolt = <1900000>;
208			regulator-max-microvolt = <2050000>;
209		};
210
211		pm8953_l1: l1 {
212			regulator-min-microvolt = <1000000>;
213			regulator-max-microvolt = <1100000>;
214		};
215
216		pm8953_l2: l2 {
217			regulator-min-microvolt = <1200000>;
218			regulator-max-microvolt = <1225000>;
219		};
220
221		pm8953_l3: l3 {
222			regulator-min-microvolt = <925000>;
223			regulator-max-microvolt = <925000>;
224		};
225
226		pm8953_l5: l5 {
227			regulator-min-microvolt = <1800000>;
228			regulator-max-microvolt = <1800000>;
229		};
230
231		pm8953_l6: l6 {
232			regulator-min-microvolt = <1800000>;
233			regulator-max-microvolt = <1800000>;
234		};
235
236		pm8953_l7: l7 {
237			regulator-min-microvolt = <1800000>;
238			regulator-max-microvolt = <1900000>;
239		};
240
241		pm8953_l8: l8 {
242			regulator-min-microvolt = <2900000>;
243			regulator-max-microvolt = <2900000>;
244		};
245
246		pm8953_l9: l9 {
247			regulator-min-microvolt = <3000000>;
248			regulator-max-microvolt = <3300000>;
249		};
250
251		pm8953_l10: l10 {
252			regulator-min-microvolt = <2850000>;
253			regulator-max-microvolt = <2850000>;
254		};
255
256		pm8953_l11: l11 {
257			regulator-min-microvolt = <2950000>;
258			regulator-max-microvolt = <2950000>;
259		};
260
261		pm8953_l12: l12 {
262			regulator-min-microvolt = <1800000>;
263			regulator-max-microvolt = <2950000>;
264		};
265
266		pm8953_l13: l13 {
267			regulator-min-microvolt = <3125000>;
268			regulator-max-microvolt = <3125000>;
269		};
270
271		pm8953_l16: l16 {
272			regulator-min-microvolt = <1800000>;
273			regulator-max-microvolt = <1800000>;
274		};
275
276		pm8953_l17: l17 {
277			regulator-min-microvolt = <2750000>;
278			regulator-max-microvolt = <2850000>;
279		};
280
281		pm8953_l19: l19 {
282			regulator-min-microvolt = <1200000>;
283			regulator-max-microvolt = <1380000>;
284		};
285
286		pm8953_l22: l22 {
287			regulator-min-microvolt = <2800000>;
288			regulator-max-microvolt = <2800000>;
289		};
290
291		pm8953_l23: l23 {
292			regulator-min-microvolt = <1200000>;
293			regulator-max-microvolt = <1225000>;
294		};
295	};
296};
297
298&sdhc_1 {
299	vmmc-supply = <&pm8953_l8>;
300	vqmmc-supply = <&pm8953_l5>;
301
302	status = "okay";
303};
304
305&sdhc_2 {
306	vmmc-supply = <&pm8953_l11>;
307	vqmmc-supply = <&pm8953_l12>;
308
309	pinctrl-names = "default", "sleep";
310	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
311	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
312
313	status = "okay";
314};
315
316&tlmm {
317	gpio-reserved-ranges = <0 4>, <16 4>, <135 4>;
318
319	ts_reset_active: ts-reset-active-state {
320		pins = "gpio64";
321		function = "gpio";
322		drive-strength = <8>;
323		bias-pull-up;
324	};
325
326	ts_reset_suspend: ts-reset-suspend-state {
327		pins = "gpio64";
328		function = "gpio";
329		drive-strength = <2>;
330		bias-pull-up;
331	};
332
333	ts_int_active: ts-int-active-state {
334		pins = "gpio65";
335		function = "gpio";
336		drive-strength = <8>;
337		bias-pull-up;
338	};
339
340	ts_int_suspend: ts-int-suspend-state {
341		pins = "gpio65";
342		function = "gpio";
343		drive-strength = <2>;
344		bias-pull-down;
345	};
346};
347
348&uart_0 {
349	pinctrl-names = "default";
350	pinctrl-0 = <&uart_console_active>;
351
352	status = "okay";
353};
354
355&usb3 {
356	status = "okay";
357};
358
359&usb3_dwc3 {
360	dr_mode = "peripheral";
361};
362