1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Common Board Device Tree for Microsoft MSM8x26-based Lumias
4 *
5 * Copyright (c) 2023, Jack Matthews <jm5112356@gmail.com>
6 * Copyright (c) 2023, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
7 * Copyright (c) 2023, Dominik Kobinski <dominikkobinski314@gmail.com>
8 * Copyright (c) 2023, Rayyan Ansari <rayyan@ansari.sh>
9 */
10
11#include "qcom-msm8226.dtsi"
12#include "pm8226.dtsi"
13#include <dt-bindings/input/input.h>
14
15/*
16 * Delete all generic (msm8226.dtsi) reserved
17 * memory mappings which are different on these devices.
18 */
19/delete-node/ &smem_region;
20
21/ {
22	aliases {
23		mmc0 = &sdhc_1; /* eMMC */
24		mmc1 = &sdhc_2; /* microSD */
25		display0 = &framebuffer;
26	};
27
28	chosen {
29		#address-cells = <1>;
30		#size-cells = <1>;
31		ranges;
32
33		stdout-path = "display0";
34
35		framebuffer: framebuffer@3200000 {
36			compatible = "simple-framebuffer";
37			reg = <0x3200000 0x800000>;
38			format = "a8r8g8b8";
39			width = <720>;
40			height = <1280>;
41			stride = <(720 * 4)>;
42
43			clocks = <&mmcc MDSS_AHB_CLK>,
44				 <&mmcc MDSS_AXI_CLK>,
45				 <&mmcc MDSS_BYTE0_CLK>,
46				 <&mmcc MDSS_MDP_CLK>,
47				 <&mmcc MDSS_PCLK0_CLK>,
48				 <&mmcc MDSS_VSYNC_CLK>;
49			power-domains = <&mmcc MDSS_GDSC>;
50		};
51	};
52
53	gpio_keys: gpio-keys {
54		compatible = "gpio-keys";
55
56		pinctrl-0 = <&gpio_keys_default>;
57		pinctrl-names = "default";
58
59		label = "GPIO Buttons";
60
61		key-volume-up {
62			label = "Volume Up";
63			gpios = <&tlmm 106 GPIO_ACTIVE_LOW>;
64			linux,code = <KEY_VOLUMEUP>;
65		};
66	};
67
68	/*
69	 * This device being a WP platform has a different
70	 * memory layout than other Android based devices.
71	 * This smem memory region is directly copied from
72	 * the original UEFI firmware.
73	 */
74	reserved-memory {
75		display_reserved: framebuffer@3200000 {
76			reg = <0x03200000 0x800000>;
77			no-map;
78		};
79
80		smem_region: smem@fa00000 {
81			reg = <0x0fa00000 0x100000>;
82			no-map;
83		};
84	};
85};
86
87&blsp1_i2c5 {
88	status = "okay";
89
90	touchscreen: touchscreen@4b {
91		compatible = "syna,rmi4-i2c";
92		reg = <0x4b>;
93
94		interrupts-extended = <&tlmm 17 IRQ_TYPE_EDGE_FALLING>;
95		vdd-supply = <&pm8226_l15>;
96		vio-supply = <&pm8226_l6>;
97
98		pinctrl-0 = <&touchscreen_default>;
99		pinctrl-names = "default";
100
101		#address-cells = <1>;
102		#size-cells = <0>;
103
104		rmi4-f01@1 {
105			reg = <0x01>;
106			syna,nosleep-mode = <1>;
107		};
108
109		rmi4-f11@11 {
110			reg = <0x11>;
111			syna,sensor-type = <1>;
112		};
113	};
114};
115
116&blsp1_uart3 {
117	status = "okay";
118};
119
120&pm8226_resin {
121	linux,code = <KEY_VOLUMEDOWN>;
122	status = "okay";
123};
124
125&pm8226_vib {
126	status = "okay";
127};
128
129&rpm_requests {
130	regulators {
131		compatible = "qcom,rpm-pm8226-regulators";
132
133		/* These values were taken from the original firmware DSDT */
134		pm8226_s1: s1 {
135			regulator-min-microvolt = <1050000>;
136			regulator-max-microvolt = <1050000>;
137		};
138
139		pm8226_s3: s3 {
140			regulator-min-microvolt = <1300000>;
141			regulator-max-microvolt = <1300000>;
142		};
143
144		pm8226_s4: s4 {
145			regulator-min-microvolt = <1800000>;
146			regulator-max-microvolt = <2100000>;
147		};
148
149		pm8226_s5: s5 {
150			regulator-min-microvolt = <1150000>;
151			regulator-max-microvolt = <1150000>;
152		};
153
154		pm8226_l3: l3 {
155			regulator-min-microvolt = <750000>;
156			regulator-max-microvolt = <1150000>;
157		};
158
159		pm8226_l4: l4 {
160			regulator-min-microvolt = <1200000>;
161			regulator-max-microvolt = <1200000>;
162		};
163
164		pm8226_l5: l5 {
165			regulator-min-microvolt = <1200000>;
166			regulator-max-microvolt = <1200000>;
167		};
168
169		pm8226_l6: l6 {
170			regulator-min-microvolt = <1800000>;
171			regulator-max-microvolt = <1800000>;
172		};
173
174		pm8226_l7: l7 {
175			regulator-min-microvolt = <1850000>;
176			regulator-max-microvolt = <1850000>;
177		};
178
179		pm8226_l8: l8 {
180			regulator-min-microvolt = <1800000>;
181			regulator-max-microvolt = <1800000>;
182			regulator-always-on;
183		};
184
185		pm8226_l9: l9 {
186			regulator-min-microvolt = <2050000>;
187			regulator-max-microvolt = <2050000>;
188		};
189
190		pm8226_l10: l10 {
191			regulator-min-microvolt = <1800000>;
192			regulator-max-microvolt = <1800000>;
193		};
194
195		pm8226_l12: l12 {
196			regulator-min-microvolt = <1800000>;
197			regulator-max-microvolt = <1800000>;
198		};
199
200		pm8226_l14: l14 {
201			regulator-min-microvolt = <2750000>;
202			regulator-max-microvolt = <2750000>;
203		};
204
205		pm8226_l15: l15 {
206			regulator-min-microvolt = <2850000>;
207			regulator-max-microvolt = <2850000>;
208		};
209
210		pm8226_l16: l16 {
211			regulator-min-microvolt = <3000000>;
212			regulator-max-microvolt = <3000000>;
213		};
214
215		pm8226_l17: l17 {
216			regulator-min-microvolt = <2950000>;
217			regulator-max-microvolt = <2950000>;
218			regulator-system-load = <200000>;
219			regulator-allow-set-load;
220		};
221
222		pm8226_l18: l18 {
223			regulator-min-microvolt = <2950000>;
224			regulator-max-microvolt = <2950000>;
225			regulator-system-load = <200000>;
226			regulator-allow-set-load;
227		};
228
229		pm8226_l19: l19 {
230			regulator-min-microvolt = <2850000>;
231			regulator-max-microvolt = <2850000>;
232		};
233
234		pm8226_l20: l20 {
235			regulator-min-microvolt = <3075000>;
236			regulator-max-microvolt = <3075000>;
237		};
238
239		pm8226_l21: l21 {
240			regulator-min-microvolt = <1850000>;
241			regulator-max-microvolt = <2950000>;
242		};
243
244		pm8226_l22: l22 {
245			regulator-min-microvolt = <1800000>;
246			regulator-max-microvolt = <1800000>;
247		};
248
249		pm8226_l23: l23 {
250			regulator-min-microvolt = <1800000>;
251			regulator-max-microvolt = <1800000>;
252		};
253
254		pm8226_l24: l24 {
255			regulator-min-microvolt = <1300000>;
256			regulator-max-microvolt = <1300000>;
257		};
258
259		pm8226_l25: l25 {
260			regulator-min-microvolt = <1775000>;
261			regulator-max-microvolt = <2075000>;
262		};
263
264		pm8226_l27: l27 {
265			regulator-min-microvolt = <2050000>;
266			regulator-max-microvolt = <2050000>;
267		};
268
269		pm8226_l28: l28 {
270			regulator-min-microvolt = <2000000>;
271			regulator-max-microvolt = <3000000>;
272		};
273	};
274};
275
276&sdhc_1 {
277	vmmc-supply = <&pm8226_l17>;
278	vqmmc-supply = <&pm8226_l6>;
279
280	status = "okay";
281};
282
283&sdhc_2 {
284	vmmc-supply = <&pm8226_l18>;
285	vqmmc-supply = <&pm8226_l21>;
286
287	status = "okay";
288};
289
290&usb {
291	extcon = <&smbb>;
292	dr_mode = "peripheral";
293
294	status = "okay";
295};
296
297&usb_hs_phy {
298	extcon = <&smbb>;
299	v1p8-supply = <&pm8226_l10>;
300	v3p3-supply = <&pm8226_l20>;
301};
302
303&tlmm {
304	gpio_keys_default: gpio-keys-default-state {
305		pins = "gpio106", "gpio107", "gpio108";
306		function = "gpio";
307		drive-strength = <2>;
308		bias-pull-up;
309	};
310
311	touchscreen_default: touchscreen-default-state {
312		irq-pins {
313			pins = "gpio17";
314			function = "gpio";
315			drive-strength = <8>;
316			bias-pull-up;
317		};
318
319		reset-pins {
320			pins = "gpio16";
321			function = "gpio";
322			drive-strength = <8>;
323			bias-disable;
324			output-high;
325		};
326	};
327};
328