1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (C) 2020 Stephan Gerhold
3
4/dts-v1/;
5
6#include "msm8916-pm8916.dtsi"
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/leds/common.h>
10
11/ {
12	model = "Xiaomi Redmi 2 (Wingtech WT88047)";
13	compatible = "wingtech,wt88047", "qcom,msm8916";
14
15	aliases {
16		serial0 = &blsp1_uart2;
17	};
18
19	chosen {
20		stdout-path = "serial0";
21	};
22
23	gpio-keys {
24		compatible = "gpio-keys";
25
26		pinctrl-names = "default";
27		pinctrl-0 = <&gpio_keys_default>;
28
29		label = "GPIO Buttons";
30
31		volume-up {
32			label = "Volume Up";
33			gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
34			linux,code = <KEY_VOLUMEUP>;
35		};
36	};
37
38	usb_id: usb-id {
39		compatible = "linux,extcon-usb-gpio";
40		id-gpio = <&msmgpio 110 GPIO_ACTIVE_HIGH>;
41		pinctrl-names = "default";
42		pinctrl-0 = <&usb_id_default>;
43	};
44};
45
46&blsp_i2c2 {
47	status = "okay";
48
49	imu@68 {
50		compatible = "invensense,mpu6880";
51		reg = <0x68>;
52
53		interrupt-parent = <&msmgpio>;
54		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
55
56		vdd-supply = <&pm8916_l17>;
57		vddio-supply = <&pm8916_l6>;
58
59		pinctrl-names = "default";
60		pinctrl-0 = <&imu_default>;
61
62		mount-matrix = "1",  "0", "0",
63			       "0", "-1", "0",
64			       "0",  "0", "1";
65	};
66};
67
68&blsp_i2c5 {
69	status = "okay";
70
71	touchscreen@38 {
72		/* Likely some other model but works just fine with this one */
73		compatible = "edt,edt-ft5506";
74		reg = <0x38>;
75
76		interrupt-parent = <&msmgpio>;
77		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
78
79		reset-gpios = <&msmgpio 12 GPIO_ACTIVE_LOW>;
80
81		vcc-supply = <&pm8916_l17>;
82		iovcc-supply = <&pm8916_l6>;
83
84		touchscreen-size-x = <720>;
85		touchscreen-size-y = <1280>;
86
87		pinctrl-names = "default";
88		pinctrl-0 = <&touchscreen_default>;
89	};
90};
91
92&blsp_i2c6 {
93	status = "okay";
94
95	led-controller@45 {
96		compatible = "awinic,aw2013";
97		reg = <0x45>;
98		#address-cells = <1>;
99		#size-cells = <0>;
100
101		vcc-supply = <&pm8916_l16>;
102
103		led@0 {
104			reg = <0>;
105			led-max-microamp = <15000>;
106			function = LED_FUNCTION_INDICATOR;
107			color = <LED_COLOR_ID_RED>;
108		};
109
110		led@1 {
111			reg = <1>;
112			led-max-microamp = <15000>;
113			function = LED_FUNCTION_INDICATOR;
114			color = <LED_COLOR_ID_GREEN>;
115		};
116
117		led@2 {
118			reg = <2>;
119			led-max-microamp = <15000>;
120			function = LED_FUNCTION_INDICATOR;
121			color = <LED_COLOR_ID_BLUE>;
122		};
123	};
124};
125
126&blsp1_uart2 {
127	status = "okay";
128};
129
130&pm8916_resin {
131	status = "okay";
132	linux,code = <KEY_VOLUMEDOWN>;
133};
134
135&pm8916_vib {
136	status = "okay";
137};
138
139&pronto {
140	status = "okay";
141};
142
143&sdhc_1 {
144	status = "okay";
145
146	pinctrl-names = "default", "sleep";
147	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
148	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
149};
150
151&sdhc_2 {
152	status = "okay";
153
154	pinctrl-names = "default", "sleep";
155	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
156	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
157
158	non-removable;
159};
160
161&usb {
162	status = "okay";
163	extcon = <&usb_id>, <&usb_id>;
164};
165
166&usb_hs_phy {
167	extcon = <&usb_id>;
168};
169
170&smd_rpm_regulators {
171	vdd_l1_l2_l3-supply = <&pm8916_s3>;
172	vdd_l4_l5_l6-supply = <&pm8916_s4>;
173	vdd_l7-supply = <&pm8916_s4>;
174
175	s3 {
176		regulator-min-microvolt = <1200000>;
177		regulator-max-microvolt = <1300000>;
178	};
179
180	s4 {
181		regulator-min-microvolt = <1800000>;
182		regulator-max-microvolt = <2100000>;
183	};
184
185	l1 {
186		regulator-min-microvolt = <1225000>;
187		regulator-max-microvolt = <1225000>;
188	};
189
190	l2 {
191		regulator-min-microvolt = <1200000>;
192		regulator-max-microvolt = <1200000>;
193	};
194
195	l4 {
196		regulator-min-microvolt = <2050000>;
197		regulator-max-microvolt = <2050000>;
198	};
199
200	l5 {
201		regulator-min-microvolt = <1800000>;
202		regulator-max-microvolt = <1800000>;
203	};
204
205	l6 {
206		regulator-min-microvolt = <1800000>;
207		regulator-max-microvolt = <1800000>;
208	};
209
210	l7 {
211		regulator-min-microvolt = <1800000>;
212		regulator-max-microvolt = <1800000>;
213	};
214
215	l8 {
216		regulator-min-microvolt = <2850000>;
217		regulator-max-microvolt = <2900000>;
218	};
219
220	l9 {
221		regulator-min-microvolt = <3300000>;
222		regulator-max-microvolt = <3300000>;
223	};
224
225	l10 {
226		regulator-min-microvolt = <2700000>;
227		regulator-max-microvolt = <2800000>;
228	};
229
230	l11 {
231		regulator-min-microvolt = <2950000>;
232		regulator-max-microvolt = <2950000>;
233		regulator-allow-set-load;
234		regulator-system-load = <200000>;
235	};
236
237	l12 {
238		regulator-min-microvolt = <1800000>;
239		regulator-max-microvolt = <2950000>;
240	};
241
242	l13 {
243		regulator-min-microvolt = <3075000>;
244		regulator-max-microvolt = <3075000>;
245	};
246
247	l14 {
248		regulator-min-microvolt = <1800000>;
249		regulator-max-microvolt = <3300000>;
250	};
251
252	l15 {
253		regulator-min-microvolt = <1800000>;
254		regulator-max-microvolt = <3300000>;
255	};
256
257	l16 {
258		regulator-min-microvolt = <2800000>;
259		regulator-max-microvolt = <3300000>;
260	};
261
262	l17 {
263		regulator-min-microvolt = <2850000>;
264		regulator-max-microvolt = <2850000>;
265	};
266
267	l18 {
268		regulator-min-microvolt = <2700000>;
269		regulator-max-microvolt = <2700000>;
270	};
271};
272
273&msmgpio {
274	gpio_keys_default: gpio-keys-default {
275		pins = "gpio107";
276		function = "gpio";
277
278		drive-strength = <2>;
279		bias-pull-up;
280	};
281
282	imu_default: imu-default {
283		pins = "gpio115";
284		function = "gpio";
285
286		drive-strength = <2>;
287		bias-disable;
288	};
289
290	touchscreen_default: touchscreen-default {
291		pins = "gpio13";
292		function = "gpio";
293
294		drive-strength = <2>;
295		bias-pull-up;
296
297		reset {
298			pins = "gpio12";
299			function = "gpio";
300
301			drive-strength = <2>;
302			bias-disable;
303		};
304	};
305
306	usb_id_default: usb-id-default {
307		pins = "gpio110";
308		function = "gpio";
309
310		drive-strength = <8>;
311		bias-pull-up;
312	};
313};
314