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			msg-size = <0x20000 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-gpio = <&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			polling-delay-passive = <0>;
88			polling-delay = <0>;
89			thermal-sensors = <&pm6125_adc_tm 0>;
90
91			trips {
92				active-config0 {
93					temperature = <125000>;
94					hysteresis = <1000>;
95					type = "critical";
96				};
97			};
98		};
99
100		quiet-thermal {
101			polling-delay-passive = <0>;
102			polling-delay = <5000>;
103			thermal-sensors = <&pm6125_adc_tm 1>;
104
105			trips {
106				active-config0 {
107					temperature = <125000>;
108					hysteresis = <1000>;
109					type = "critical";
110				};
111			};
112		};
113
114		xo-thermal {
115			polling-delay-passive = <0>;
116			polling-delay = <0>;
117			thermal-sensors = <&pm6125_adc_tm 2>;
118
119			trips {
120				active-config0 {
121					temperature = <125000>;
122					hysteresis = <1000>;
123					type = "critical";
124				};
125			};
126		};
127	};
128};
129
130&hsusb_phy1 {
131	vdd-supply = <&vreg_l7a>;
132	vdda-pll-supply = <&vreg_l10a>;
133	vdda-phy-dpdm-supply = <&vreg_l15a>;
134	status = "okay";
135};
136
137&pm6125_adc {
138	pinctrl-names = "default";
139	pinctrl-0 = <&camera_flash_therm &emmc_ufs_therm>;
140
141	channel@4d {
142		reg = <ADC5_AMUX_THM1_100K_PU>;
143		qcom,ratiometric;
144		qcom,hw-settle-time = <200>;
145		qcom,pre-scaling = <1 1>;
146		label = "rf_pa0_therm";
147	};
148
149	channel@4e {
150		reg = <ADC5_AMUX_THM2_100K_PU>;
151		qcom,ratiometric;
152		qcom,hw-settle-time = <200>;
153		qcom,pre-scaling = <1 1>;
154		label = "quiet_therm";
155	};
156
157	channel@52 {
158		reg = <ADC5_GPIO1_100K_PU>;
159		qcom,ratiometric;
160		qcom,hw-settle-time = <200>;
161		qcom,pre-scaling = <1 1>;
162		label = "camera_flash_therm";
163	};
164
165	channel@54 {
166		reg = <ADC5_GPIO3_100K_PU>;
167		qcom,ratiometric;
168		qcom,hw-settle-time = <200>;
169		qcom,pre-scaling = <1 1>;
170		label = "emmc_ufs_therm";
171	};
172};
173
174&pm6125_adc_tm {
175	status = "okay";
176
177	rf-pa0-therm@0 {
178		reg = <0>;
179		io-channels = <&pm6125_adc ADC5_AMUX_THM1_100K_PU>;
180		qcom,ratiometric;
181		qcom,hw-settle-time-us = <200>;
182	};
183
184	quiet-therm@1 {
185		reg = <1>;
186		io-channels = <&pm6125_adc ADC5_AMUX_THM2_100K_PU>;
187		qcom,ratiometric;
188		qcom,hw-settle-time-us = <200>;
189	};
190
191	xo-therm@2 {
192		reg = <2>;
193		io-channels = <&pm6125_adc ADC5_XO_THERM_100K_PU>;
194		qcom,ratiometric;
195		qcom,hw-settle-time-us = <200>;
196	};
197};
198
199&pm6125_gpios {
200	camera_flash_therm: camera-flash-therm-state {
201		pins = "gpio3";
202		function = PMIC_GPIO_FUNC_NORMAL;
203		bias-high-impedance;
204	};
205
206	emmc_ufs_therm: emmc-ufs-therm-state {
207		pins = "gpio6";
208		function = PMIC_GPIO_FUNC_NORMAL;
209		bias-high-impedance;
210	};
211
212	vol_up_n: vol-up-n-state {
213		pins = "gpio5";
214		function = PMIC_GPIO_FUNC_NORMAL;
215		input-enable;
216		bias-pull-up;
217	};
218};
219
220&pon_pwrkey {
221	status = "okay";
222};
223
224&pon_resin {
225	linux,code = <KEY_VOLUMEDOWN>;
226	status = "okay";
227};
228
229&rpm_requests {
230	regulators-0 {
231		compatible = "qcom,rpm-pm6125-regulators";
232
233		vreg_s6a: s6 {
234			regulator-min-microvolt = <936000>;
235			regulator-max-microvolt = <1422000>;
236		};
237
238		vreg_l1a: l1 {
239			regulator-min-microvolt = <1200000>;
240			regulator-max-microvolt = <1256000>;
241		};
242
243		vreg_l2a: l2 {
244			regulator-min-microvolt = <1000000>;
245			regulator-max-microvolt = <1056000>;
246		};
247
248		vreg_l3a: l3 {
249			regulator-min-microvolt = <1000000>;
250			regulator-max-microvolt = <1064000>;
251		};
252
253		vreg_l4a: l4 {
254			regulator-min-microvolt = <872000>;
255			regulator-max-microvolt = <976000>;
256			regulator-allow-set-load;
257		};
258
259		vreg_l5a: l5 {
260			regulator-min-microvolt = <1648000>;
261			regulator-max-microvolt = <2950000>;
262			regulator-allow-set-load;
263		};
264
265		vreg_l6a: l6 {
266			regulator-min-microvolt = <576000>;
267			regulator-max-microvolt = <656000>;
268		};
269
270		vreg_l7a: l7 {
271			regulator-min-microvolt = <872000>;
272			regulator-max-microvolt = <976000>;
273		};
274
275		vreg_l8a: l8 {
276			regulator-min-microvolt = <400000>;
277			regulator-max-microvolt = <728000>;
278		};
279
280		vreg_l9a: l9 {
281			regulator-min-microvolt = <1800000>;
282			regulator-max-microvolt = <1896000>;
283		};
284
285		vreg_l10a: l10 {
286			regulator-min-microvolt = <1800000>;
287			regulator-max-microvolt = <1896000>;
288			regulator-allow-set-load;
289		};
290
291		vreg_l11a: l11 {
292			regulator-min-microvolt = <1800000>;
293			regulator-max-microvolt = <1952000>;
294			regulator-allow-set-load;
295		};
296
297		vreg_l12a: l12 {
298			regulator-min-microvolt = <1800000>;
299			regulator-max-microvolt = <1996000>;
300		};
301
302		vreg_l13a: l13 {
303			regulator-min-microvolt = <1800000>;
304			regulator-max-microvolt = <1832000>;
305		};
306
307		vreg_l14a: l14 {
308			regulator-min-microvolt = <1800000>;
309			regulator-max-microvolt = <1904000>;
310		};
311
312		vreg_l15a: l15 {
313			regulator-min-microvolt = <3104000>;
314			regulator-max-microvolt = <3232000>;
315		};
316
317		vreg_l16a: l16 {
318			regulator-min-microvolt = <1800000>;
319			regulator-max-microvolt = <1904000>;
320		};
321
322		vreg_l17a: l17 {
323			regulator-min-microvolt = <1248000>;
324			regulator-max-microvolt = <1304000>;
325		};
326
327		vreg_l18a: l18 {
328			regulator-min-microvolt = <1200000>;
329			regulator-max-microvolt = <1264000>;
330			regulator-allow-set-load;
331		};
332
333		vreg_l19a: l19 {
334			regulator-min-microvolt = <1648000>;
335			regulator-max-microvolt = <2952000>;
336		};
337
338		vreg_l20a: l20 {
339			regulator-min-microvolt = <1648000>;
340			regulator-max-microvolt = <2952000>;
341		};
342
343		vreg_l21a: l21 {
344			regulator-min-microvolt = <2600000>;
345			regulator-max-microvolt = <2856000>;
346		};
347
348		vreg_l22a: l22 {
349			regulator-min-microvolt = <2944000>;
350			regulator-max-microvolt = <2950000>;
351			regulator-allow-set-load;
352		};
353
354		vreg_l23a: l23 {
355			regulator-min-microvolt = <3000000>;
356			regulator-max-microvolt = <3400000>;
357		};
358
359		vreg_l24a: l24 {
360			regulator-min-microvolt = <2944000>;
361			regulator-max-microvolt = <2950000>;
362			regulator-allow-set-load;
363		};
364	};
365};
366
367&sdc2_off_state {
368	sd-cd-pins {
369		pins = "gpio98";
370		function = "gpio";
371		drive-strength = <2>;
372		bias-disable;
373	};
374};
375
376&sdc2_on_state {
377	sd-cd-pins {
378		pins = "gpio98";
379		function = "gpio";
380		drive-strength = <2>;
381		bias-pull-up;
382	};
383};
384
385&sdhc_2 {
386	cd-gpios = <&tlmm 98 GPIO_ACTIVE_HIGH>;
387	vmmc-supply = <&vreg_l22a>;
388	vqmmc-supply = <&vreg_l5a>;
389	no-sdio;
390	no-mmc;
391	status = "okay";
392};
393
394&tlmm {
395	gpio-reserved-ranges = <22 2>, <28 6>;
396};
397
398&ufs_mem_hc {
399	vcc-supply = <&vreg_l24a>;
400	vccq2-supply = <&vreg_l11a>;
401	vcc-max-microamp = <600000>;
402	vccq2-max-microamp = <600000>;
403	status = "okay";
404};
405
406&ufs_mem_phy {
407	vdda-phy-supply = <&vreg_l4a>;
408	vdda-pll-supply = <&vreg_l10a>;
409	vdda-phy-max-microamp = <51400>;
410	vdda-pll-max-microamp = <14200>;
411	vddp-ref-clk-supply = <&vreg_l18a>;
412	status = "okay";
413};
414
415&usb3 {
416	status = "okay";
417};
418
419&usb3_dwc3 {
420	extcon = <&extcon_usb>;
421};
422