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&sdhc_1 {
157	status = "okay";
158
159	pinctrl-names = "default", "sleep";
160	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
161	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
162};
163
164&sdhc_2 {
165	status = "okay";
166
167	pinctrl-names = "default", "sleep";
168	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
169	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
170
171	non-removable;
172};
173
174&usb {
175	status = "okay";
176	extcon = <&usb_id>, <&usb_id>;
177};
178
179&usb_hs_phy {
180	extcon = <&usb_id>;
181};
182
183&wcnss {
184	status = "okay";
185};
186
187&wcnss_iris {
188	compatible = "qcom,wcn3620";
189};
190
191&smd_rpm_regulators {
192	vdd_l1_l2_l3-supply = <&pm8916_s3>;
193	vdd_l4_l5_l6-supply = <&pm8916_s4>;
194	vdd_l7-supply = <&pm8916_s4>;
195
196	s3 {
197		regulator-min-microvolt = <1200000>;
198		regulator-max-microvolt = <1300000>;
199	};
200
201	s4 {
202		regulator-min-microvolt = <1800000>;
203		regulator-max-microvolt = <2100000>;
204	};
205
206	l1 {
207		regulator-min-microvolt = <1225000>;
208		regulator-max-microvolt = <1225000>;
209	};
210
211	l2 {
212		regulator-min-microvolt = <1200000>;
213		regulator-max-microvolt = <1200000>;
214	};
215
216	l4 {
217		regulator-min-microvolt = <2050000>;
218		regulator-max-microvolt = <2050000>;
219	};
220
221	l5 {
222		regulator-min-microvolt = <1800000>;
223		regulator-max-microvolt = <1800000>;
224	};
225
226	l6 {
227		regulator-min-microvolt = <1800000>;
228		regulator-max-microvolt = <1800000>;
229	};
230
231	l7 {
232		regulator-min-microvolt = <1800000>;
233		regulator-max-microvolt = <1800000>;
234	};
235
236	l8 {
237		regulator-min-microvolt = <2850000>;
238		regulator-max-microvolt = <2900000>;
239	};
240
241	l9 {
242		regulator-min-microvolt = <3300000>;
243		regulator-max-microvolt = <3300000>;
244	};
245
246	l10 {
247		regulator-min-microvolt = <2700000>;
248		regulator-max-microvolt = <2800000>;
249	};
250
251	l11 {
252		regulator-min-microvolt = <2950000>;
253		regulator-max-microvolt = <2950000>;
254		regulator-allow-set-load;
255		regulator-system-load = <200000>;
256	};
257
258	l12 {
259		regulator-min-microvolt = <1800000>;
260		regulator-max-microvolt = <2950000>;
261	};
262
263	l13 {
264		regulator-min-microvolt = <3075000>;
265		regulator-max-microvolt = <3075000>;
266	};
267
268	l14 {
269		regulator-min-microvolt = <1800000>;
270		regulator-max-microvolt = <3300000>;
271	};
272
273	l15 {
274		regulator-min-microvolt = <1800000>;
275		regulator-max-microvolt = <3300000>;
276	};
277
278	l16 {
279		regulator-min-microvolt = <2800000>;
280		regulator-max-microvolt = <3300000>;
281	};
282
283	l17 {
284		regulator-min-microvolt = <2850000>;
285		regulator-max-microvolt = <2850000>;
286	};
287
288	l18 {
289		regulator-min-microvolt = <2700000>;
290		regulator-max-microvolt = <2700000>;
291	};
292};
293
294&msmgpio {
295	camera_flash_default: camera-flash-default-state {
296		pins = "gpio31", "gpio32";
297		function = "gpio";
298
299		drive-strength = <2>;
300		bias-disable;
301	};
302
303	gpio_keys_default: gpio-keys-default-state {
304		pins = "gpio107";
305		function = "gpio";
306
307		drive-strength = <2>;
308		bias-pull-up;
309	};
310
311	imu_default: imu-default-state {
312		pins = "gpio115";
313		function = "gpio";
314
315		drive-strength = <2>;
316		bias-disable;
317	};
318
319	touchscreen_default: touchscreen-default-state {
320		touchscreen-pins {
321			pins = "gpio13";
322			function = "gpio";
323
324			drive-strength = <2>;
325			bias-pull-up;
326		};
327		reset-pins {
328			pins = "gpio12";
329			function = "gpio";
330
331			drive-strength = <2>;
332			bias-disable;
333		};
334	};
335
336	usb_id_default: usb-id-default-state {
337		pins = "gpio110";
338		function = "gpio";
339
340		drive-strength = <8>;
341		bias-pull-up;
342	};
343};
344