1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2022, Lux Aliaga <they@mint.lgbt>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/input/gpio-keys.h>
11#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
12#include "sm6125.dtsi"
13#include "pm6125.dtsi"
14
15/ {
16	model = "Xiaomi Mi A3";
17	compatible = "xiaomi,laurel-sprout", "qcom,sm6125";
18	chassis-type = "handset";
19
20	/* required for bootloader to select correct board */
21	qcom,msm-id = <394 0>; /* sm6125 v1 */
22	qcom,board-id = <11 0>;
23
24	chosen {
25		#address-cells = <2>;
26		#size-cells = <2>;
27		ranges;
28
29		framebuffer0: framebuffer@5c000000 {
30			compatible = "simple-framebuffer";
31			reg = <0 0x5c000000 0 (1560 * 720 * 4)>;
32			width = <720>;
33			height = <1560>;
34			stride = <(720 * 4)>;
35			format = "a8r8g8b8";
36		};
37	};
38
39	reserved-memory {
40		debug_mem: debug@ffb00000 {
41			reg = <0x0 0xffb00000 0x0 0xc0000>;
42			no-map;
43		};
44
45		last_log_mem: lastlog@ffbc0000 {
46			reg = <0x0 0xffbc0000 0x0 0x80000>;
47			no-map;
48		};
49
50		pstore_mem: ramoops@ffc00000 {
51			compatible = "ramoops";
52			reg = <0x0 0xffc40000 0x0 0xc0000>;
53			record-size = <0x1000>;
54			console-size = <0x40000>;
55			pmsg-size = <0x20000>;
56		};
57
58		cmdline_mem: memory@ffd00000 {
59			reg = <0x0 0xffd40000 0x0 0x1000>;
60			no-map;
61		};
62	};
63
64	extcon_usb: usb-id {
65		compatible = "linux,extcon-usb-gpio";
66		id-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>;
67	};
68
69	gpio-keys {
70		compatible = "gpio-keys";
71
72		pinctrl-0 = <&vol_up_n>;
73		pinctrl-names = "default";
74
75		key-volume-up {
76			label = "Volume Up";
77			gpios = <&pm6125_gpios 5 GPIO_ACTIVE_LOW>;
78			linux,code = <KEY_VOLUMEUP>;
79			debounce-interval = <15>;
80			linux,can-disable;
81			wakeup-source;
82		};
83	};
84
85	thermal-zones {
86		rf-pa0-thermal {
87			thermal-sensors = <&pm6125_adc_tm 0>;
88
89			trips {
90				active-config0 {
91					temperature = <125000>;
92					hysteresis = <1000>;
93					type = "critical";
94				};
95			};
96		};
97
98		quiet-thermal {
99			thermal-sensors = <&pm6125_adc_tm 1>;
100
101			trips {
102				active-config0 {
103					temperature = <125000>;
104					hysteresis = <1000>;
105					type = "critical";
106				};
107			};
108		};
109
110		xo-thermal {
111			thermal-sensors = <&pm6125_adc_tm 2>;
112
113			trips {
114				active-config0 {
115					temperature = <125000>;
116					hysteresis = <1000>;
117					type = "critical";
118				};
119			};
120		};
121	};
122};
123
124&hsusb_phy1 {
125	vdd-supply = <&vreg_l7a>;
126	vdda-pll-supply = <&vreg_l10a>;
127	vdda-phy-dpdm-supply = <&vreg_l15a>;
128	status = "okay";
129};
130
131&pm6125_adc {
132	pinctrl-names = "default";
133	pinctrl-0 = <&camera_flash_therm &emmc_ufs_therm>;
134
135	channel@4d {
136		reg = <ADC5_AMUX_THM1_100K_PU>;
137		qcom,ratiometric;
138		qcom,hw-settle-time = <200>;
139		qcom,pre-scaling = <1 1>;
140		label = "rf_pa0_therm";
141	};
142
143	channel@4e {
144		reg = <ADC5_AMUX_THM2_100K_PU>;
145		qcom,ratiometric;
146		qcom,hw-settle-time = <200>;
147		qcom,pre-scaling = <1 1>;
148		label = "quiet_therm";
149	};
150
151	channel@52 {
152		reg = <ADC5_GPIO1_100K_PU>;
153		qcom,ratiometric;
154		qcom,hw-settle-time = <200>;
155		qcom,pre-scaling = <1 1>;
156		label = "camera_flash_therm";
157	};
158
159	channel@54 {
160		reg = <ADC5_GPIO3_100K_PU>;
161		qcom,ratiometric;
162		qcom,hw-settle-time = <200>;
163		qcom,pre-scaling = <1 1>;
164		label = "emmc_ufs_therm";
165	};
166};
167
168&pm6125_adc_tm {
169	status = "okay";
170
171	rf-pa0-therm@0 {
172		reg = <0>;
173		io-channels = <&pm6125_adc ADC5_AMUX_THM1_100K_PU>;
174		qcom,ratiometric;
175		qcom,hw-settle-time-us = <200>;
176	};
177
178	quiet-therm@1 {
179		reg = <1>;
180		io-channels = <&pm6125_adc ADC5_AMUX_THM2_100K_PU>;
181		qcom,ratiometric;
182		qcom,hw-settle-time-us = <200>;
183	};
184
185	xo-therm@2 {
186		reg = <2>;
187		io-channels = <&pm6125_adc ADC5_XO_THERM_100K_PU>;
188		qcom,ratiometric;
189		qcom,hw-settle-time-us = <200>;
190	};
191};
192
193&pm6125_gpios {
194	camera_flash_therm: camera-flash-therm-state {
195		pins = "gpio3";
196		function = PMIC_GPIO_FUNC_NORMAL;
197		bias-high-impedance;
198	};
199
200	emmc_ufs_therm: emmc-ufs-therm-state {
201		pins = "gpio6";
202		function = PMIC_GPIO_FUNC_NORMAL;
203		bias-high-impedance;
204	};
205
206	vol_up_n: vol-up-n-state {
207		pins = "gpio5";
208		function = PMIC_GPIO_FUNC_NORMAL;
209		input-enable;
210		bias-pull-up;
211	};
212};
213
214&pon_pwrkey {
215	status = "okay";
216};
217
218&pon_resin {
219	linux,code = <KEY_VOLUMEDOWN>;
220	status = "okay";
221};
222
223&rpm_requests {
224	regulators-0 {
225		compatible = "qcom,rpm-pm6125-regulators";
226
227		vreg_s6a: s6 {
228			regulator-min-microvolt = <936000>;
229			regulator-max-microvolt = <1422000>;
230		};
231
232		vreg_l1a: l1 {
233			regulator-min-microvolt = <1200000>;
234			regulator-max-microvolt = <1256000>;
235		};
236
237		vreg_l2a: l2 {
238			regulator-min-microvolt = <1000000>;
239			regulator-max-microvolt = <1056000>;
240		};
241
242		vreg_l3a: l3 {
243			regulator-min-microvolt = <1000000>;
244			regulator-max-microvolt = <1064000>;
245		};
246
247		vreg_l4a: l4 {
248			regulator-min-microvolt = <872000>;
249			regulator-max-microvolt = <976000>;
250			regulator-allow-set-load;
251		};
252
253		vreg_l5a: l5 {
254			regulator-min-microvolt = <1648000>;
255			regulator-max-microvolt = <2950000>;
256			regulator-allow-set-load;
257		};
258
259		vreg_l6a: l6 {
260			regulator-min-microvolt = <576000>;
261			regulator-max-microvolt = <656000>;
262		};
263
264		vreg_l7a: l7 {
265			regulator-min-microvolt = <872000>;
266			regulator-max-microvolt = <976000>;
267		};
268
269		vreg_l8a: l8 {
270			regulator-min-microvolt = <400000>;
271			regulator-max-microvolt = <728000>;
272		};
273
274		vreg_l9a: l9 {
275			regulator-min-microvolt = <1800000>;
276			regulator-max-microvolt = <1896000>;
277		};
278
279		vreg_l10a: l10 {
280			regulator-min-microvolt = <1800000>;
281			regulator-max-microvolt = <1896000>;
282			regulator-allow-set-load;
283		};
284
285		vreg_l11a: l11 {
286			regulator-min-microvolt = <1800000>;
287			regulator-max-microvolt = <1952000>;
288			regulator-allow-set-load;
289		};
290
291		vreg_l12a: l12 {
292			regulator-min-microvolt = <1800000>;
293			regulator-max-microvolt = <1996000>;
294		};
295
296		vreg_l13a: l13 {
297			regulator-min-microvolt = <1800000>;
298			regulator-max-microvolt = <1832000>;
299		};
300
301		vreg_l14a: l14 {
302			regulator-min-microvolt = <1800000>;
303			regulator-max-microvolt = <1904000>;
304		};
305
306		vreg_l15a: l15 {
307			regulator-min-microvolt = <3104000>;
308			regulator-max-microvolt = <3232000>;
309		};
310
311		vreg_l16a: l16 {
312			regulator-min-microvolt = <1800000>;
313			regulator-max-microvolt = <1904000>;
314		};
315
316		vreg_l17a: l17 {
317			regulator-min-microvolt = <1248000>;
318			regulator-max-microvolt = <1304000>;
319		};
320
321		vreg_l18a: l18 {
322			regulator-min-microvolt = <1200000>;
323			regulator-max-microvolt = <1264000>;
324			regulator-allow-set-load;
325		};
326
327		vreg_l19a: l19 {
328			regulator-min-microvolt = <1648000>;
329			regulator-max-microvolt = <2952000>;
330		};
331
332		vreg_l20a: l20 {
333			regulator-min-microvolt = <1648000>;
334			regulator-max-microvolt = <2952000>;
335		};
336
337		vreg_l21a: l21 {
338			regulator-min-microvolt = <2600000>;
339			regulator-max-microvolt = <2856000>;
340		};
341
342		vreg_l22a: l22 {
343			regulator-min-microvolt = <2944000>;
344			regulator-max-microvolt = <2950000>;
345			regulator-allow-set-load;
346		};
347
348		vreg_l23a: l23 {
349			regulator-min-microvolt = <3000000>;
350			regulator-max-microvolt = <3400000>;
351		};
352
353		vreg_l24a: l24 {
354			regulator-min-microvolt = <2944000>;
355			regulator-max-microvolt = <2950000>;
356			regulator-allow-set-load;
357		};
358	};
359};
360
361&sdc2_off_state {
362	sd-cd-pins {
363		pins = "gpio98";
364		function = "gpio";
365		drive-strength = <2>;
366		bias-disable;
367	};
368};
369
370&sdc2_on_state {
371	sd-cd-pins {
372		pins = "gpio98";
373		function = "gpio";
374		drive-strength = <2>;
375		bias-pull-up;
376	};
377};
378
379&sdhc_2 {
380	cd-gpios = <&tlmm 98 GPIO_ACTIVE_HIGH>;
381	vmmc-supply = <&vreg_l22a>;
382	vqmmc-supply = <&vreg_l5a>;
383	no-sdio;
384	no-mmc;
385	status = "okay";
386};
387
388&tlmm {
389	gpio-reserved-ranges = <22 2>, <28 6>;
390};
391
392&ufs_mem_hc {
393	vcc-supply = <&vreg_l24a>;
394	vccq2-supply = <&vreg_l11a>;
395	vcc-max-microamp = <600000>;
396	vccq2-max-microamp = <600000>;
397	vdd-hba-supply = <&vreg_l18a>;
398	status = "okay";
399};
400
401&ufs_mem_phy {
402	vdda-phy-supply = <&vreg_l4a>;
403	vdda-pll-supply = <&vreg_l10a>;
404	status = "okay";
405};
406
407&usb3 {
408	status = "okay";
409};
410
411&usb3_dwc3 {
412	extcon = <&extcon_usb>;
413};
414