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		mmc0 = &sdhc_1; /* eMMC */
20		mmc1 = &sdhc_2; /* SD card */
21		serial0 = &blsp_uart2;
22	};
23
24	chosen {
25		stdout-path = "serial0";
26	};
27
28	flash-led-controller {
29		compatible = "ocs,ocp8110";
30		enable-gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>;
31		flash-gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>;
32
33		pinctrl-names = "default";
34		pinctrl-0 = <&camera_flash_default>;
35
36		flash_led: led {
37			function = LED_FUNCTION_FLASH;
38			color = <LED_COLOR_ID_WHITE>;
39		};
40	};
41
42	gpio-keys {
43		compatible = "gpio-keys";
44
45		pinctrl-names = "default";
46		pinctrl-0 = <&gpio_keys_default>;
47
48		label = "GPIO Buttons";
49
50		button-volume-up {
51			label = "Volume Up";
52			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
53			linux,code = <KEY_VOLUMEUP>;
54		};
55	};
56
57	usb_id: usb-id {
58		compatible = "linux,extcon-usb-gpio";
59		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
60		pinctrl-names = "default";
61		pinctrl-0 = <&usb_id_default>;
62	};
63};
64
65&blsp_i2c2 {
66	status = "okay";
67
68	imu@68 {
69		compatible = "invensense,mpu6880";
70		reg = <0x68>;
71
72		interrupt-parent = <&tlmm>;
73		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
74
75		vdd-supply = <&pm8916_l17>;
76		vddio-supply = <&pm8916_l6>;
77
78		pinctrl-names = "default";
79		pinctrl-0 = <&imu_default>;
80
81		mount-matrix = "1",  "0", "0",
82			       "0", "-1", "0",
83			       "0",  "0", "1";
84	};
85};
86
87&blsp_i2c5 {
88	status = "okay";
89
90	touchscreen@38 {
91		/* Likely some other model but works just fine with this one */
92		compatible = "edt,edt-ft5506";
93		reg = <0x38>;
94
95		interrupt-parent = <&tlmm>;
96		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
97
98		reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>;
99
100		vcc-supply = <&pm8916_l17>;
101		iovcc-supply = <&pm8916_l6>;
102
103		touchscreen-size-x = <720>;
104		touchscreen-size-y = <1280>;
105
106		pinctrl-names = "default";
107		pinctrl-0 = <&touchscreen_default>;
108	};
109};
110
111&blsp_i2c6 {
112	status = "okay";
113
114	led-controller@45 {
115		compatible = "awinic,aw2013";
116		reg = <0x45>;
117		#address-cells = <1>;
118		#size-cells = <0>;
119
120		vcc-supply = <&pm8916_l16>;
121
122		led@0 {
123			reg = <0>;
124			led-max-microamp = <15000>;
125			function = LED_FUNCTION_INDICATOR;
126			color = <LED_COLOR_ID_RED>;
127		};
128
129		led@1 {
130			reg = <1>;
131			led-max-microamp = <15000>;
132			function = LED_FUNCTION_INDICATOR;
133			color = <LED_COLOR_ID_GREEN>;
134		};
135
136		led@2 {
137			reg = <2>;
138			led-max-microamp = <15000>;
139			function = LED_FUNCTION_INDICATOR;
140			color = <LED_COLOR_ID_BLUE>;
141		};
142	};
143};
144
145&blsp_uart2 {
146	status = "okay";
147};
148
149&pm8916_resin {
150	status = "okay";
151	linux,code = <KEY_VOLUMEDOWN>;
152};
153
154&pm8916_rpm_regulators {
155	pm8916_l16: l16 {
156		/*
157		 * L16 is only used for AW2013 which is fine with 2.5-3.3V.
158		 * Use the recommended typical voltage of 2.8V as minimum.
159		 */
160		regulator-min-microvolt = <2800000>;
161		regulator-max-microvolt = <3300000>;
162	};
163
164	pm8916_l17: l17 {
165		regulator-min-microvolt = <2850000>;
166		regulator-max-microvolt = <2850000>;
167	};
168};
169
170&pm8916_vib {
171	status = "okay";
172};
173
174&sdhc_1 {
175	status = "okay";
176};
177
178&sdhc_2 {
179	status = "okay";
180	non-removable;
181};
182
183&usb {
184	status = "okay";
185	extcon = <&usb_id>, <&usb_id>;
186};
187
188&usb_hs_phy {
189	extcon = <&usb_id>;
190};
191
192&venus {
193	status = "okay";
194};
195
196&venus_mem {
197	status = "okay";
198};
199
200&wcnss {
201	status = "okay";
202};
203
204&wcnss_iris {
205	compatible = "qcom,wcn3620";
206};
207
208&wcnss_mem {
209	status = "okay";
210};
211
212&tlmm {
213	camera_flash_default: camera-flash-default-state {
214		pins = "gpio31", "gpio32";
215		function = "gpio";
216
217		drive-strength = <2>;
218		bias-disable;
219	};
220
221	gpio_keys_default: gpio-keys-default-state {
222		pins = "gpio107";
223		function = "gpio";
224
225		drive-strength = <2>;
226		bias-pull-up;
227	};
228
229	imu_default: imu-default-state {
230		pins = "gpio115";
231		function = "gpio";
232
233		drive-strength = <2>;
234		bias-disable;
235	};
236
237	touchscreen_default: touchscreen-default-state {
238		touchscreen-pins {
239			pins = "gpio13";
240			function = "gpio";
241
242			drive-strength = <2>;
243			bias-pull-up;
244		};
245		reset-pins {
246			pins = "gpio12";
247			function = "gpio";
248
249			drive-strength = <2>;
250			bias-disable;
251		};
252	};
253
254	usb_id_default: usb-id-default-state {
255		pins = "gpio110";
256		function = "gpio";
257
258		drive-strength = <8>;
259		bias-pull-up;
260	};
261};
262