xref: /linux/scripts/dtc/include-prefixes/arm64/qcom/msm8916-wingtech-wt88047.dts (revision ec71f661a572a770d7c861cd52a50cbbb0e1a8d1)
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 "msm8916-modem-qdsp6.dtsi"
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/input.h>
13#include <dt-bindings/leds/common.h>
14
15/ {
16	model = "Xiaomi Redmi 2 (Wingtech WT88047)";
17	compatible = "wingtech,wt88047", "qcom,msm8916";
18	chassis-type = "handset";
19
20	aliases {
21		mmc0 = &sdhc_1; /* eMMC */
22		mmc1 = &sdhc_2; /* SD card */
23		serial0 = &blsp_uart2;
24	};
25
26	chosen {
27		stdout-path = "serial0";
28	};
29
30	speaker_amp: audio-amplifier {
31		compatible = "simple-audio-amplifier";
32		enable-gpios = <&tlmm 117 GPIO_ACTIVE_HIGH>;
33		sound-name-prefix = "Speaker Amp";
34		pinctrl-0 = <&speaker_amp_default>;
35		pinctrl-names = "default";
36	};
37
38	/*
39	 * This seems to be actually an analog switch that either routes audio
40	 * to the headphone jack or nowhere. Given that we need to enable a GPIO
41	 * to get sound on headphones, modelling it as simple-audio-amplifier
42	 * works just fine.
43	 */
44	headphones_switch: audio-switch {
45		compatible = "simple-audio-amplifier";
46		enable-gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>;
47		sound-name-prefix = "Headphones Switch";
48		pinctrl-0 = <&headphones_switch_default>;
49		pinctrl-names = "default";
50	};
51
52	flash-led-controller {
53		compatible = "ocs,ocp8110";
54		enable-gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>;
55		flash-gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>;
56
57		pinctrl-names = "default";
58		pinctrl-0 = <&camera_flash_default>;
59
60		flash_led: led {
61			function = LED_FUNCTION_FLASH;
62			color = <LED_COLOR_ID_WHITE>;
63		};
64	};
65
66	gpio-keys {
67		compatible = "gpio-keys";
68
69		pinctrl-names = "default";
70		pinctrl-0 = <&gpio_keys_default>;
71
72		label = "GPIO Buttons";
73
74		button-volume-up {
75			label = "Volume Up";
76			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
77			linux,code = <KEY_VOLUMEUP>;
78		};
79	};
80
81	usb_id: usb-id {
82		compatible = "linux,extcon-usb-gpio";
83		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
84		pinctrl-names = "default";
85		pinctrl-0 = <&usb_id_default>;
86	};
87};
88
89&blsp_i2c2 {
90	status = "okay";
91
92	imu@68 {
93		compatible = "invensense,mpu6880";
94		reg = <0x68>;
95
96		interrupt-parent = <&tlmm>;
97		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
98
99		vdd-supply = <&pm8916_l17>;
100		vddio-supply = <&pm8916_l6>;
101
102		pinctrl-names = "default";
103		pinctrl-0 = <&imu_default>;
104
105		mount-matrix = "1",  "0", "0",
106			       "0", "-1", "0",
107			       "0",  "0", "1";
108	};
109};
110
111&blsp_i2c5 {
112	status = "okay";
113
114	touchscreen@38 {
115		/* Likely some other model but works just fine with this one */
116		compatible = "edt,edt-ft5506";
117		reg = <0x38>;
118
119		interrupt-parent = <&tlmm>;
120		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
121
122		reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>;
123
124		vcc-supply = <&pm8916_l17>;
125		iovcc-supply = <&pm8916_l6>;
126
127		touchscreen-size-x = <720>;
128		touchscreen-size-y = <1280>;
129
130		pinctrl-names = "default";
131		pinctrl-0 = <&touchscreen_default>;
132	};
133};
134
135&blsp_i2c6 {
136	status = "okay";
137
138	led-controller@45 {
139		compatible = "awinic,aw2013";
140		reg = <0x45>;
141		#address-cells = <1>;
142		#size-cells = <0>;
143
144		vcc-supply = <&pm8916_l16>;
145		vio-supply = <&pm8916_l5>;
146
147		led@0 {
148			reg = <0>;
149			led-max-microamp = <15000>;
150			function = LED_FUNCTION_INDICATOR;
151			color = <LED_COLOR_ID_RED>;
152		};
153
154		led@1 {
155			reg = <1>;
156			led-max-microamp = <15000>;
157			function = LED_FUNCTION_INDICATOR;
158			color = <LED_COLOR_ID_GREEN>;
159		};
160
161		led@2 {
162			reg = <2>;
163			led-max-microamp = <15000>;
164			function = LED_FUNCTION_INDICATOR;
165			color = <LED_COLOR_ID_BLUE>;
166		};
167	};
168};
169
170&blsp_uart2 {
171	status = "okay";
172	pinctrl-0 = <&blsp_uart2_console_default>;
173	pinctrl-1 = <&blsp_uart2_console_sleep>;
174	pinctrl-names = "default", "sleep";
175};
176
177&mpss_mem {
178	reg = <0x0 0x86800000 0x0 0x5100000>;
179};
180
181&pm8916_codec {
182	qcom,micbias1-ext-cap;
183	qcom,micbias-lvl = <2800>;
184	qcom,mbhc-vthreshold-low = <75 100 120 180 500>;
185	qcom,mbhc-vthreshold-high = <75 100 120 180 500>;
186	qcom,hphl-jack-type-normally-open;
187};
188
189&pm8916_resin {
190	status = "okay";
191	linux,code = <KEY_VOLUMEDOWN>;
192};
193
194&pm8916_rpm_regulators {
195	pm8916_l16: l16 {
196		/*
197		 * L16 is only used for AW2013 which is fine with 2.5-3.3V.
198		 * Use the recommended typical voltage of 2.8V as minimum.
199		 */
200		regulator-min-microvolt = <2800000>;
201		regulator-max-microvolt = <3300000>;
202	};
203
204	pm8916_l17: l17 {
205		regulator-min-microvolt = <2850000>;
206		regulator-max-microvolt = <2850000>;
207	};
208};
209
210&pm8916_vib {
211	status = "okay";
212};
213
214&sdhc_1 {
215	status = "okay";
216};
217
218&sdhc_2 {
219	status = "okay";
220	non-removable;
221};
222
223&sound {
224	/*
225	 * Provide widgets/pin-switches to allow enabling speaker and headphones
226	 * separately. Both are routed via the HPH_L/HPH_R pins of the codec.
227	 */
228	model = "wt88047";
229	widgets =
230		"Speaker", "Speaker",
231		"Headphone", "Headphones";
232	pin-switches = "Speaker", "Headphones";
233	audio-routing =
234		"Speaker", "Speaker Amp OUTL",
235		"Speaker", "Speaker Amp OUTR",
236		"Speaker Amp INL", "HPH_R",
237		"Speaker Amp INR", "HPH_R",
238		"Headphones", "Headphones Switch OUTL",
239		"Headphones", "Headphones Switch OUTR",
240		"Headphones Switch INL", "HPH_L",
241		"Headphones Switch INR", "HPH_R",
242		"AMIC1", "MIC BIAS External1",
243		"AMIC2", "MIC BIAS Internal2";
244	aux-devs = <&speaker_amp>, <&headphones_switch>;
245};
246
247&usb {
248	status = "okay";
249	extcon = <&usb_id>, <&usb_id>;
250};
251
252&usb_hs_phy {
253	extcon = <&usb_id>;
254};
255
256&venus {
257	status = "okay";
258};
259
260&venus_mem {
261	status = "okay";
262};
263
264&wcnss {
265	status = "okay";
266};
267
268&wcnss_iris {
269	compatible = "qcom,wcn3620";
270};
271
272&wcnss_mem {
273	status = "okay";
274};
275
276&tlmm {
277	camera_flash_default: camera-flash-default-state {
278		pins = "gpio31", "gpio32";
279		function = "gpio";
280
281		drive-strength = <2>;
282		bias-disable;
283	};
284
285	gpio_keys_default: gpio-keys-default-state {
286		pins = "gpio107";
287		function = "gpio";
288
289		drive-strength = <2>;
290		bias-pull-up;
291	};
292
293	headphones_switch_default: headphones-switch-default-state {
294		pins = "gpio8";
295		function = "gpio";
296		drive-strength = <2>;
297		bias-disable;
298	};
299
300	imu_default: imu-default-state {
301		pins = "gpio115";
302		function = "gpio";
303
304		drive-strength = <2>;
305		bias-disable;
306	};
307
308	speaker_amp_default: speaker-amp-default-state {
309		pins = "gpio117";
310		function = "gpio";
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