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