xref: /freebsd-src/sys/contrib/device-tree/src/arm64/qcom/msm8916-wingtech-wt88047.dts (revision 8d13bc63c0e1d50bc9e47ac1f26329c999bfecf0)
1354d7675SEmmanuel Vadot// SPDX-License-Identifier: GPL-2.0-only
28bab661aSEmmanuel Vadot/*
38bab661aSEmmanuel Vadot * Copyright (C) 2020 Stephan Gerhold
48bab661aSEmmanuel Vadot */
5354d7675SEmmanuel Vadot
6354d7675SEmmanuel Vadot/dts-v1/;
7354d7675SEmmanuel Vadot
8354d7675SEmmanuel Vadot#include "msm8916-pm8916.dtsi"
9*8d13bc63SEmmanuel Vadot#include "msm8916-modem-qdsp6.dtsi"
10*8d13bc63SEmmanuel Vadot
11354d7675SEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
12354d7675SEmmanuel Vadot#include <dt-bindings/input/input.h>
13354d7675SEmmanuel Vadot#include <dt-bindings/leds/common.h>
14354d7675SEmmanuel Vadot
15354d7675SEmmanuel Vadot/ {
16354d7675SEmmanuel Vadot	model = "Xiaomi Redmi 2 (Wingtech WT88047)";
17354d7675SEmmanuel Vadot	compatible = "wingtech,wt88047", "qcom,msm8916";
188cc087a1SEmmanuel Vadot	chassis-type = "handset";
19354d7675SEmmanuel Vadot
20354d7675SEmmanuel Vadot	aliases {
21f126890aSEmmanuel Vadot		mmc0 = &sdhc_1; /* eMMC */
22f126890aSEmmanuel Vadot		mmc1 = &sdhc_2; /* SD card */
23f126890aSEmmanuel Vadot		serial0 = &blsp_uart2;
24354d7675SEmmanuel Vadot	};
25354d7675SEmmanuel Vadot
26354d7675SEmmanuel Vadot	chosen {
27354d7675SEmmanuel Vadot		stdout-path = "serial0";
28354d7675SEmmanuel Vadot	};
29354d7675SEmmanuel Vadot
30*8d13bc63SEmmanuel Vadot	speaker_amp: audio-amplifier {
31*8d13bc63SEmmanuel Vadot		compatible = "simple-audio-amplifier";
32*8d13bc63SEmmanuel Vadot		enable-gpios = <&tlmm 117 GPIO_ACTIVE_HIGH>;
33*8d13bc63SEmmanuel Vadot		sound-name-prefix = "Speaker Amp";
34*8d13bc63SEmmanuel Vadot		pinctrl-0 = <&speaker_amp_default>;
35*8d13bc63SEmmanuel Vadot		pinctrl-names = "default";
36*8d13bc63SEmmanuel Vadot	};
37*8d13bc63SEmmanuel Vadot
38*8d13bc63SEmmanuel Vadot	/*
39*8d13bc63SEmmanuel Vadot	 * This seems to be actually an analog switch that either routes audio
40*8d13bc63SEmmanuel Vadot	 * to the headphone jack or nowhere. Given that we need to enable a GPIO
41*8d13bc63SEmmanuel Vadot	 * to get sound on headphones, modelling it as simple-audio-amplifier
42*8d13bc63SEmmanuel Vadot	 * works just fine.
43*8d13bc63SEmmanuel Vadot	 */
44*8d13bc63SEmmanuel Vadot	headphones_switch: audio-switch {
45*8d13bc63SEmmanuel Vadot		compatible = "simple-audio-amplifier";
46*8d13bc63SEmmanuel Vadot		enable-gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>;
47*8d13bc63SEmmanuel Vadot		sound-name-prefix = "Headphones Switch";
48*8d13bc63SEmmanuel Vadot		pinctrl-0 = <&headphones_switch_default>;
49*8d13bc63SEmmanuel Vadot		pinctrl-names = "default";
50*8d13bc63SEmmanuel Vadot	};
51*8d13bc63SEmmanuel Vadot
528bab661aSEmmanuel Vadot	flash-led-controller {
538bab661aSEmmanuel Vadot		compatible = "ocs,ocp8110";
54f126890aSEmmanuel Vadot		enable-gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>;
55f126890aSEmmanuel Vadot		flash-gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>;
568bab661aSEmmanuel Vadot
578bab661aSEmmanuel Vadot		pinctrl-names = "default";
588bab661aSEmmanuel Vadot		pinctrl-0 = <&camera_flash_default>;
598bab661aSEmmanuel Vadot
608bab661aSEmmanuel Vadot		flash_led: led {
618bab661aSEmmanuel Vadot			function = LED_FUNCTION_FLASH;
628bab661aSEmmanuel Vadot			color = <LED_COLOR_ID_WHITE>;
638bab661aSEmmanuel Vadot		};
648bab661aSEmmanuel Vadot	};
658bab661aSEmmanuel Vadot
66354d7675SEmmanuel Vadot	gpio-keys {
67354d7675SEmmanuel Vadot		compatible = "gpio-keys";
68354d7675SEmmanuel Vadot
69354d7675SEmmanuel Vadot		pinctrl-names = "default";
70354d7675SEmmanuel Vadot		pinctrl-0 = <&gpio_keys_default>;
71354d7675SEmmanuel Vadot
72354d7675SEmmanuel Vadot		label = "GPIO Buttons";
73354d7675SEmmanuel Vadot
74b97ee269SEmmanuel Vadot		button-volume-up {
75354d7675SEmmanuel Vadot			label = "Volume Up";
76f126890aSEmmanuel Vadot			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
77354d7675SEmmanuel Vadot			linux,code = <KEY_VOLUMEUP>;
78354d7675SEmmanuel Vadot		};
79354d7675SEmmanuel Vadot	};
80354d7675SEmmanuel Vadot
81354d7675SEmmanuel Vadot	usb_id: usb-id {
82354d7675SEmmanuel Vadot		compatible = "linux,extcon-usb-gpio";
83aa1a8ff2SEmmanuel Vadot		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
84354d7675SEmmanuel Vadot		pinctrl-names = "default";
85354d7675SEmmanuel Vadot		pinctrl-0 = <&usb_id_default>;
86354d7675SEmmanuel Vadot	};
87354d7675SEmmanuel Vadot};
88354d7675SEmmanuel Vadot
89354d7675SEmmanuel Vadot&blsp_i2c2 {
90354d7675SEmmanuel Vadot	status = "okay";
91354d7675SEmmanuel Vadot
92354d7675SEmmanuel Vadot	imu@68 {
93354d7675SEmmanuel Vadot		compatible = "invensense,mpu6880";
94354d7675SEmmanuel Vadot		reg = <0x68>;
95354d7675SEmmanuel Vadot
96f126890aSEmmanuel Vadot		interrupt-parent = <&tlmm>;
97354d7675SEmmanuel Vadot		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
98354d7675SEmmanuel Vadot
99354d7675SEmmanuel Vadot		vdd-supply = <&pm8916_l17>;
100354d7675SEmmanuel Vadot		vddio-supply = <&pm8916_l6>;
101354d7675SEmmanuel Vadot
102354d7675SEmmanuel Vadot		pinctrl-names = "default";
103354d7675SEmmanuel Vadot		pinctrl-0 = <&imu_default>;
104354d7675SEmmanuel Vadot
105354d7675SEmmanuel Vadot		mount-matrix = "1",  "0", "0",
106354d7675SEmmanuel Vadot			       "0", "-1", "0",
107354d7675SEmmanuel Vadot			       "0",  "0", "1";
108354d7675SEmmanuel Vadot	};
109354d7675SEmmanuel Vadot};
110354d7675SEmmanuel Vadot
111354d7675SEmmanuel Vadot&blsp_i2c5 {
112354d7675SEmmanuel Vadot	status = "okay";
113354d7675SEmmanuel Vadot
114354d7675SEmmanuel Vadot	touchscreen@38 {
115354d7675SEmmanuel Vadot		/* Likely some other model but works just fine with this one */
116354d7675SEmmanuel Vadot		compatible = "edt,edt-ft5506";
117354d7675SEmmanuel Vadot		reg = <0x38>;
118354d7675SEmmanuel Vadot
119f126890aSEmmanuel Vadot		interrupt-parent = <&tlmm>;
120354d7675SEmmanuel Vadot		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
121354d7675SEmmanuel Vadot
122f126890aSEmmanuel Vadot		reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>;
123354d7675SEmmanuel Vadot
124354d7675SEmmanuel Vadot		vcc-supply = <&pm8916_l17>;
125354d7675SEmmanuel Vadot		iovcc-supply = <&pm8916_l6>;
126354d7675SEmmanuel Vadot
127354d7675SEmmanuel Vadot		touchscreen-size-x = <720>;
128354d7675SEmmanuel Vadot		touchscreen-size-y = <1280>;
129354d7675SEmmanuel Vadot
130354d7675SEmmanuel Vadot		pinctrl-names = "default";
131354d7675SEmmanuel Vadot		pinctrl-0 = <&touchscreen_default>;
132354d7675SEmmanuel Vadot	};
133354d7675SEmmanuel Vadot};
134354d7675SEmmanuel Vadot
135354d7675SEmmanuel Vadot&blsp_i2c6 {
136354d7675SEmmanuel Vadot	status = "okay";
137354d7675SEmmanuel Vadot
138354d7675SEmmanuel Vadot	led-controller@45 {
139354d7675SEmmanuel Vadot		compatible = "awinic,aw2013";
140354d7675SEmmanuel Vadot		reg = <0x45>;
141354d7675SEmmanuel Vadot		#address-cells = <1>;
142354d7675SEmmanuel Vadot		#size-cells = <0>;
143354d7675SEmmanuel Vadot
144354d7675SEmmanuel Vadot		vcc-supply = <&pm8916_l16>;
145*8d13bc63SEmmanuel Vadot		vio-supply = <&pm8916_l5>;
146354d7675SEmmanuel Vadot
147354d7675SEmmanuel Vadot		led@0 {
148354d7675SEmmanuel Vadot			reg = <0>;
149354d7675SEmmanuel Vadot			led-max-microamp = <15000>;
150354d7675SEmmanuel Vadot			function = LED_FUNCTION_INDICATOR;
151354d7675SEmmanuel Vadot			color = <LED_COLOR_ID_RED>;
152354d7675SEmmanuel Vadot		};
153354d7675SEmmanuel Vadot
154354d7675SEmmanuel Vadot		led@1 {
155354d7675SEmmanuel Vadot			reg = <1>;
156354d7675SEmmanuel Vadot			led-max-microamp = <15000>;
157354d7675SEmmanuel Vadot			function = LED_FUNCTION_INDICATOR;
158354d7675SEmmanuel Vadot			color = <LED_COLOR_ID_GREEN>;
159354d7675SEmmanuel Vadot		};
160354d7675SEmmanuel Vadot
161354d7675SEmmanuel Vadot		led@2 {
162354d7675SEmmanuel Vadot			reg = <2>;
163354d7675SEmmanuel Vadot			led-max-microamp = <15000>;
164354d7675SEmmanuel Vadot			function = LED_FUNCTION_INDICATOR;
165354d7675SEmmanuel Vadot			color = <LED_COLOR_ID_BLUE>;
166354d7675SEmmanuel Vadot		};
167354d7675SEmmanuel Vadot	};
168354d7675SEmmanuel Vadot};
169354d7675SEmmanuel Vadot
170f126890aSEmmanuel Vadot&blsp_uart2 {
171354d7675SEmmanuel Vadot	status = "okay";
172354d7675SEmmanuel Vadot};
173354d7675SEmmanuel Vadot
174*8d13bc63SEmmanuel Vadot&mpss_mem {
175*8d13bc63SEmmanuel Vadot	reg = <0x0 0x86800000 0x0 0x5100000>;
176*8d13bc63SEmmanuel Vadot};
177*8d13bc63SEmmanuel Vadot
178*8d13bc63SEmmanuel Vadot&pm8916_codec {
179*8d13bc63SEmmanuel Vadot	qcom,micbias1-ext-cap;
180*8d13bc63SEmmanuel Vadot	qcom,micbias-lvl = <2800>;
181*8d13bc63SEmmanuel Vadot	qcom,mbhc-vthreshold-low = <75 100 120 180 500>;
182*8d13bc63SEmmanuel Vadot	qcom,mbhc-vthreshold-high = <75 100 120 180 500>;
183*8d13bc63SEmmanuel Vadot	qcom,hphl-jack-type-normally-open;
184*8d13bc63SEmmanuel Vadot};
185*8d13bc63SEmmanuel Vadot
186354d7675SEmmanuel Vadot&pm8916_resin {
187354d7675SEmmanuel Vadot	status = "okay";
188354d7675SEmmanuel Vadot	linux,code = <KEY_VOLUMEDOWN>;
189354d7675SEmmanuel Vadot};
190354d7675SEmmanuel Vadot
191f126890aSEmmanuel Vadot&pm8916_rpm_regulators {
192f126890aSEmmanuel Vadot	pm8916_l16: l16 {
193f126890aSEmmanuel Vadot		/*
194f126890aSEmmanuel Vadot		 * L16 is only used for AW2013 which is fine with 2.5-3.3V.
195f126890aSEmmanuel Vadot		 * Use the recommended typical voltage of 2.8V as minimum.
196f126890aSEmmanuel Vadot		 */
197f126890aSEmmanuel Vadot		regulator-min-microvolt = <2800000>;
198f126890aSEmmanuel Vadot		regulator-max-microvolt = <3300000>;
199f126890aSEmmanuel Vadot	};
200f126890aSEmmanuel Vadot
201f126890aSEmmanuel Vadot	pm8916_l17: l17 {
202f126890aSEmmanuel Vadot		regulator-min-microvolt = <2850000>;
203f126890aSEmmanuel Vadot		regulator-max-microvolt = <2850000>;
204f126890aSEmmanuel Vadot	};
205f126890aSEmmanuel Vadot};
206f126890aSEmmanuel Vadot
207354d7675SEmmanuel Vadot&pm8916_vib {
208354d7675SEmmanuel Vadot	status = "okay";
209354d7675SEmmanuel Vadot};
210354d7675SEmmanuel Vadot
211354d7675SEmmanuel Vadot&sdhc_1 {
212354d7675SEmmanuel Vadot	status = "okay";
213354d7675SEmmanuel Vadot};
214354d7675SEmmanuel Vadot
215354d7675SEmmanuel Vadot&sdhc_2 {
216354d7675SEmmanuel Vadot	status = "okay";
217354d7675SEmmanuel Vadot	non-removable;
218354d7675SEmmanuel Vadot};
219354d7675SEmmanuel Vadot
220*8d13bc63SEmmanuel Vadot&sound {
221*8d13bc63SEmmanuel Vadot	/*
222*8d13bc63SEmmanuel Vadot	 * Provide widgets/pin-switches to allow enabling speaker and headphones
223*8d13bc63SEmmanuel Vadot	 * separately. Both are routed via the HPH_L/HPH_R pins of the codec.
224*8d13bc63SEmmanuel Vadot	 */
225*8d13bc63SEmmanuel Vadot	model = "wt88047";
226*8d13bc63SEmmanuel Vadot	widgets =
227*8d13bc63SEmmanuel Vadot		"Speaker", "Speaker",
228*8d13bc63SEmmanuel Vadot		"Headphone", "Headphones";
229*8d13bc63SEmmanuel Vadot	pin-switches = "Speaker", "Headphones";
230*8d13bc63SEmmanuel Vadot	audio-routing =
231*8d13bc63SEmmanuel Vadot		"Speaker", "Speaker Amp OUTL",
232*8d13bc63SEmmanuel Vadot		"Speaker", "Speaker Amp OUTR",
233*8d13bc63SEmmanuel Vadot		"Speaker Amp INL", "HPH_R",
234*8d13bc63SEmmanuel Vadot		"Speaker Amp INR", "HPH_R",
235*8d13bc63SEmmanuel Vadot		"Headphones", "Headphones Switch OUTL",
236*8d13bc63SEmmanuel Vadot		"Headphones", "Headphones Switch OUTR",
237*8d13bc63SEmmanuel Vadot		"Headphones Switch INL", "HPH_L",
238*8d13bc63SEmmanuel Vadot		"Headphones Switch INR", "HPH_R",
239*8d13bc63SEmmanuel Vadot		"AMIC1", "MIC BIAS External1",
240*8d13bc63SEmmanuel Vadot		"AMIC2", "MIC BIAS Internal2";
241*8d13bc63SEmmanuel Vadot	aux-devs = <&speaker_amp>, <&headphones_switch>;
242*8d13bc63SEmmanuel Vadot};
243*8d13bc63SEmmanuel Vadot
244354d7675SEmmanuel Vadot&usb {
245354d7675SEmmanuel Vadot	status = "okay";
246354d7675SEmmanuel Vadot	extcon = <&usb_id>, <&usb_id>;
247354d7675SEmmanuel Vadot};
248354d7675SEmmanuel Vadot
249354d7675SEmmanuel Vadot&usb_hs_phy {
250354d7675SEmmanuel Vadot	extcon = <&usb_id>;
251354d7675SEmmanuel Vadot};
252354d7675SEmmanuel Vadot
25384943d6fSEmmanuel Vadot&venus {
25484943d6fSEmmanuel Vadot	status = "okay";
25584943d6fSEmmanuel Vadot};
25684943d6fSEmmanuel Vadot
25784943d6fSEmmanuel Vadot&venus_mem {
25884943d6fSEmmanuel Vadot	status = "okay";
25984943d6fSEmmanuel Vadot};
26084943d6fSEmmanuel Vadot
261fac71e4eSEmmanuel Vadot&wcnss {
262fac71e4eSEmmanuel Vadot	status = "okay";
263fac71e4eSEmmanuel Vadot};
264fac71e4eSEmmanuel Vadot
265fac71e4eSEmmanuel Vadot&wcnss_iris {
266fac71e4eSEmmanuel Vadot	compatible = "qcom,wcn3620";
267fac71e4eSEmmanuel Vadot};
268fac71e4eSEmmanuel Vadot
26984943d6fSEmmanuel Vadot&wcnss_mem {
27084943d6fSEmmanuel Vadot	status = "okay";
27184943d6fSEmmanuel Vadot};
27284943d6fSEmmanuel Vadot
273f126890aSEmmanuel Vadot&tlmm {
2748bab661aSEmmanuel Vadot	camera_flash_default: camera-flash-default-state {
2758bab661aSEmmanuel Vadot		pins = "gpio31", "gpio32";
2768bab661aSEmmanuel Vadot		function = "gpio";
2778bab661aSEmmanuel Vadot
2788bab661aSEmmanuel Vadot		drive-strength = <2>;
2798bab661aSEmmanuel Vadot		bias-disable;
2808bab661aSEmmanuel Vadot	};
2818bab661aSEmmanuel Vadot
2828bab661aSEmmanuel Vadot	gpio_keys_default: gpio-keys-default-state {
283354d7675SEmmanuel Vadot		pins = "gpio107";
284354d7675SEmmanuel Vadot		function = "gpio";
285354d7675SEmmanuel Vadot
286354d7675SEmmanuel Vadot		drive-strength = <2>;
287354d7675SEmmanuel Vadot		bias-pull-up;
288354d7675SEmmanuel Vadot	};
289354d7675SEmmanuel Vadot
290*8d13bc63SEmmanuel Vadot	headphones_switch_default: headphones-switch-default-state {
291*8d13bc63SEmmanuel Vadot		pins = "gpio8";
292*8d13bc63SEmmanuel Vadot		function = "gpio";
293*8d13bc63SEmmanuel Vadot		drive-strength = <2>;
294*8d13bc63SEmmanuel Vadot		bias-disable;
295*8d13bc63SEmmanuel Vadot	};
296*8d13bc63SEmmanuel Vadot
2978bab661aSEmmanuel Vadot	imu_default: imu-default-state {
298354d7675SEmmanuel Vadot		pins = "gpio115";
299354d7675SEmmanuel Vadot		function = "gpio";
300354d7675SEmmanuel Vadot
301354d7675SEmmanuel Vadot		drive-strength = <2>;
302354d7675SEmmanuel Vadot		bias-disable;
303354d7675SEmmanuel Vadot	};
304354d7675SEmmanuel Vadot
305*8d13bc63SEmmanuel Vadot	speaker_amp_default: speaker-amp-default-state {
306*8d13bc63SEmmanuel Vadot		pins = "gpio117";
307*8d13bc63SEmmanuel Vadot		function = "gpio";
308*8d13bc63SEmmanuel Vadot		drive-strength = <2>;
309*8d13bc63SEmmanuel Vadot		bias-disable;
310*8d13bc63SEmmanuel Vadot	};
311*8d13bc63SEmmanuel Vadot
3128bab661aSEmmanuel Vadot	touchscreen_default: touchscreen-default-state {
3138bab661aSEmmanuel Vadot		touchscreen-pins {
314354d7675SEmmanuel Vadot			pins = "gpio13";
315354d7675SEmmanuel Vadot			function = "gpio";
316354d7675SEmmanuel Vadot
317354d7675SEmmanuel Vadot			drive-strength = <2>;
318354d7675SEmmanuel Vadot			bias-pull-up;
3198bab661aSEmmanuel Vadot		};
3208bab661aSEmmanuel Vadot		reset-pins {
321354d7675SEmmanuel Vadot			pins = "gpio12";
322354d7675SEmmanuel Vadot			function = "gpio";
323354d7675SEmmanuel Vadot
324354d7675SEmmanuel Vadot			drive-strength = <2>;
325354d7675SEmmanuel Vadot			bias-disable;
326354d7675SEmmanuel Vadot		};
327354d7675SEmmanuel Vadot	};
328354d7675SEmmanuel Vadot
3298bab661aSEmmanuel Vadot	usb_id_default: usb-id-default-state {
330354d7675SEmmanuel Vadot		pins = "gpio110";
331354d7675SEmmanuel Vadot		function = "gpio";
332354d7675SEmmanuel Vadot
333354d7675SEmmanuel Vadot		drive-strength = <8>;
334354d7675SEmmanuel Vadot		bias-pull-up;
335354d7675SEmmanuel Vadot	};
336354d7675SEmmanuel Vadot};
337