xref: /freebsd/sys/contrib/device-tree/src/arm64/qcom/msm8916-wingtech-wt88047.dts (revision 67be1e195acfaec99ce4fffeb17111ce085755f7)
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};
173
174&mpss_mem {
175	reg = <0x0 0x86800000 0x0 0x5100000>;
176};
177
178&pm8916_codec {
179	qcom,micbias1-ext-cap;
180	qcom,micbias-lvl = <2800>;
181	qcom,mbhc-vthreshold-low = <75 100 120 180 500>;
182	qcom,mbhc-vthreshold-high = <75 100 120 180 500>;
183	qcom,hphl-jack-type-normally-open;
184};
185
186&pm8916_resin {
187	status = "okay";
188	linux,code = <KEY_VOLUMEDOWN>;
189};
190
191&pm8916_rpm_regulators {
192	pm8916_l16: l16 {
193		/*
194		 * L16 is only used for AW2013 which is fine with 2.5-3.3V.
195		 * Use the recommended typical voltage of 2.8V as minimum.
196		 */
197		regulator-min-microvolt = <2800000>;
198		regulator-max-microvolt = <3300000>;
199	};
200
201	pm8916_l17: l17 {
202		regulator-min-microvolt = <2850000>;
203		regulator-max-microvolt = <2850000>;
204	};
205};
206
207&pm8916_vib {
208	status = "okay";
209};
210
211&sdhc_1 {
212	status = "okay";
213};
214
215&sdhc_2 {
216	status = "okay";
217	non-removable;
218};
219
220&sound {
221	/*
222	 * Provide widgets/pin-switches to allow enabling speaker and headphones
223	 * separately. Both are routed via the HPH_L/HPH_R pins of the codec.
224	 */
225	model = "wt88047";
226	widgets =
227		"Speaker", "Speaker",
228		"Headphone", "Headphones";
229	pin-switches = "Speaker", "Headphones";
230	audio-routing =
231		"Speaker", "Speaker Amp OUTL",
232		"Speaker", "Speaker Amp OUTR",
233		"Speaker Amp INL", "HPH_R",
234		"Speaker Amp INR", "HPH_R",
235		"Headphones", "Headphones Switch OUTL",
236		"Headphones", "Headphones Switch OUTR",
237		"Headphones Switch INL", "HPH_L",
238		"Headphones Switch INR", "HPH_R",
239		"AMIC1", "MIC BIAS External1",
240		"AMIC2", "MIC BIAS Internal2";
241	aux-devs = <&speaker_amp>, <&headphones_switch>;
242};
243
244&usb {
245	status = "okay";
246	extcon = <&usb_id>, <&usb_id>;
247};
248
249&usb_hs_phy {
250	extcon = <&usb_id>;
251};
252
253&venus {
254	status = "okay";
255};
256
257&venus_mem {
258	status = "okay";
259};
260
261&wcnss {
262	status = "okay";
263};
264
265&wcnss_iris {
266	compatible = "qcom,wcn3620";
267};
268
269&wcnss_mem {
270	status = "okay";
271};
272
273&tlmm {
274	camera_flash_default: camera-flash-default-state {
275		pins = "gpio31", "gpio32";
276		function = "gpio";
277
278		drive-strength = <2>;
279		bias-disable;
280	};
281
282	gpio_keys_default: gpio-keys-default-state {
283		pins = "gpio107";
284		function = "gpio";
285
286		drive-strength = <2>;
287		bias-pull-up;
288	};
289
290	headphones_switch_default: headphones-switch-default-state {
291		pins = "gpio8";
292		function = "gpio";
293		drive-strength = <2>;
294		bias-disable;
295	};
296
297	imu_default: imu-default-state {
298		pins = "gpio115";
299		function = "gpio";
300
301		drive-strength = <2>;
302		bias-disable;
303	};
304
305	speaker_amp_default: speaker-amp-default-state {
306		pins = "gpio117";
307		function = "gpio";
308		drive-strength = <2>;
309		bias-disable;
310	};
311
312	touchscreen_default: touchscreen-default-state {
313		touchscreen-pins {
314			pins = "gpio13";
315			function = "gpio";
316
317			drive-strength = <2>;
318			bias-pull-up;
319		};
320		reset-pins {
321			pins = "gpio12";
322			function = "gpio";
323
324			drive-strength = <2>;
325			bias-disable;
326		};
327	};
328
329	usb_id_default: usb-id-default-state {
330		pins = "gpio110";
331		function = "gpio";
332
333		drive-strength = <8>;
334		bias-pull-up;
335	};
336};
337