1// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2/*
3 * Copyright (c) 2023 Luka Panio <lukapanio@gmail.com>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/arm/qcom,ids.h>
9#include <dt-bindings/phy/phy.h>
10#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
11#include "sm8250.dtsi"
12#include "pm8150.dtsi"
13#include "pm8150b.dtsi"
14#include "pm8150l.dtsi"
15#include "pm8009.dtsi"
16
17/*
18 * Delete following upstream (sm8250.dtsi) reserved
19 * memory mappings which are different on this device.
20 */
21/delete-node/ &adsp_mem;
22/delete-node/ &cdsp_secure_heap;
23/delete-node/ &slpi_mem;
24/delete-node/ &spss_mem;
25/delete-node/ &xbl_aop_mem;
26
27/ {
28
29	model = "Xiaomi Pad 6";
30	compatible = "xiaomi,pipa", "qcom,sm8250";
31
32	chassis-type = "tablet";
33
34	/* required for bootloader to select correct board */
35	qcom,msm-id = <QCOM_ID_SM8250 0x20001>; /* SM8250 v2.1 */
36	qcom,board-id = <0x34 0>;
37
38	chosen {
39		#address-cells = <2>;
40		#size-cells = <2>;
41		ranges;
42
43		framebuffer: framebuffer@9c000000 {
44			compatible = "simple-framebuffer";
45			reg = <0x0 0x9c000000 0x0 0x2300000>;
46			width = <1800>;
47			height = <2880>;
48			stride = <(1800 * 4)>;
49			format = "a8r8g8b8";
50		};
51	};
52
53	battery_l: battery-l {
54		compatible = "simple-battery";
55		voltage-min-design-microvolt = <3870000>;
56		energy-full-design-microwatt-hours = <16700000>;
57		charge-full-design-microamp-hours = <4420000>;
58	};
59
60	battery_r: battery-r {
61		compatible = "simple-battery";
62		voltage-min-design-microvolt = <3870000>;
63		energy-full-design-microwatt-hours = <16700000>;
64		charge-full-design-microamp-hours = <4420000>;
65	};
66
67	bl_vddpos_5p5: bl-vddpos-regulator {
68		compatible = "regulator-fixed";
69		regulator-name = "bl_vddpos_5p5";
70		regulator-min-microvolt = <5500000>;
71		regulator-max-microvolt = <5500000>;
72		regulator-enable-ramp-delay = <233>;
73		gpio = <&tlmm 130 GPIO_ACTIVE_HIGH>;
74		enable-active-high;
75		regulator-boot-on;
76	};
77
78	bl_vddneg_5p5: bl-vddneg-regulator {
79		compatible = "regulator-fixed";
80		regulator-name = "bl_vddneg_5p5";
81		regulator-min-microvolt = <5500000>;
82		regulator-max-microvolt = <5500000>;
83		regulator-enable-ramp-delay = <233>;
84		gpio = <&tlmm 131 GPIO_ACTIVE_HIGH>;
85		enable-active-high;
86		regulator-boot-on;
87	};
88
89	gpio_keys: gpio-keys {
90		compatible = "gpio-keys";
91
92		pinctrl-0 = <&vol_up_n>;
93		pinctrl-names = "default";
94
95		key-vol-up {
96			label = "Volume Up";
97			gpios = <&pm8150_gpios 6 GPIO_ACTIVE_LOW>;
98			linux,code = <KEY_VOLUMEUP>;
99			debounce-interval = <15>;
100			linux,can-disable;
101			wakeup-source;
102		};
103	};
104
105	vph_pwr: vph-pwr-regulator {
106		compatible = "regulator-fixed";
107		regulator-name = "vph_pwr";
108		regulator-min-microvolt = <3700000>;
109		regulator-max-microvolt = <3700000>;
110	};
111
112	/* S6c is really ebi.lvl but it's there for supply map completeness sake. */
113	vreg_s6c_0p88: smpc6-regulator {
114		compatible = "regulator-fixed";
115		regulator-name = "vreg_s6c_0p88";
116		regulator-min-microvolt = <880000>;
117		regulator-max-microvolt = <880000>;
118		regulator-always-on;
119		vin-supply = <&vph_pwr>;
120	};
121
122	reserved-memory {
123		xbl_aop_mem: xbl-aop@80700000 {
124			reg = <0x0 0x80600000 0x0 0x260000>;
125			no-map;
126		};
127
128		slpi_mem: slpi@88c00000 {
129			reg = <0x0 0x88c00000 0x0 0x2f00000>;
130			no-map;
131		};
132
133		adsp_mem: adsp@8bb00000 {
134			reg = <0x0 0x8bb00000 0x0 0x2500000>;
135			no-map;
136		};
137
138		spss_mem: spss@8e000000 {
139			reg = <0x0 0x8e000000 0x0 0x100000>;
140			no-map;
141		};
142
143		cdsp_secure_heap: cdsp-secure-heap@8e100000 {
144			reg = <0x0 0x8e100000 0x0 0x4600000>;
145			no-map;
146		};
147
148		cont_splash_mem: cont-splash@9c000000 {
149			reg = <0x0 0x9c000000 0x0 0x2300000>;
150			no-map;
151		};
152
153		ramoops@b0000000 {
154			compatible = "ramoops";
155			reg = <0x0 0xb0000000 0x0 0x400000>;
156			record-size = <0x1000>;
157			console-size = <0x200000>;
158			ecc-size = <16>;
159			no-map;
160		};
161	};
162};
163
164&adsp {
165	firmware-name = "qcom/sm8250/xiaomi/pipa/adsp.mbn";
166	status = "okay";
167};
168
169&apps_rsc {
170	regulators-0 {
171		compatible = "qcom,pm8150-rpmh-regulators";
172		qcom,pmic-id = "a";
173
174		vdd-s1-supply = <&vph_pwr>;
175		vdd-s2-supply = <&vph_pwr>;
176		vdd-s3-supply = <&vph_pwr>;
177		vdd-s4-supply = <&vph_pwr>;
178		vdd-s5-supply = <&vph_pwr>;
179		vdd-s6-supply = <&vph_pwr>;
180		vdd-s7-supply = <&vph_pwr>;
181		vdd-s8-supply = <&vph_pwr>;
182		vdd-s9-supply = <&vph_pwr>;
183		vdd-s10-supply = <&vph_pwr>;
184		vdd-l1-l8-l11-supply = <&vreg_s6c_0p88>;
185		vdd-l2-l10-supply = <&vreg_bob>;
186		vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p95>;
187		vdd-l6-l9-supply = <&vreg_s8c_1p35>;
188		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
189		vdd-l13-l16-l17-supply = <&vreg_bob>;
190
191		/* (S1+S2+S3) - cx.lvl (ARC) */
192
193		vreg_s4a_1p8: smps4 {
194			regulator-name = "vreg_s4a_1p8";
195			regulator-min-microvolt = <1800000>;
196			regulator-max-microvolt = <1920000>;
197			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
198			regulator-allow-set-load;
199			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
200						   RPMH_REGULATOR_MODE_HPM>;
201		};
202
203		vreg_s5a_1p9: smps5 {
204			regulator-name = "vreg_s5a_1p9";
205			regulator-min-microvolt = <1900000>;
206			regulator-max-microvolt = <2040000>;
207			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
208		};
209
210		vreg_s6a_0p95: smps6 {
211			regulator-name = "vreg_s6a_0p95";
212			regulator-min-microvolt = <600000>;
213			regulator-max-microvolt = <1128000>;
214			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
215		};
216
217		vreg_l2a_3p1: ldo2 {
218			regulator-name = "vreg_l2a_3p1";
219			regulator-min-microvolt = <3072000>;
220			regulator-max-microvolt = <3072000>;
221			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
222		};
223
224		vreg_l3a_0p9: ldo3 {
225			regulator-name = "vreg_l3a_0p9";
226			regulator-min-microvolt = <928000>;
227			regulator-max-microvolt = <932000>;
228			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
229		};
230
231		/* L4 - lmx.lvl (ARC) */
232
233		vreg_l5a_0p88: ldo5 {
234			regulator-name = "vreg_l5a_0p88";
235			regulator-min-microvolt = <880000>;
236			regulator-max-microvolt = <880000>;
237			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
238		};
239
240		vreg_l6a_1p2: ldo6 {
241			regulator-name = "vreg_l6a_1p2";
242			regulator-min-microvolt = <1200000>;
243			regulator-max-microvolt = <1200000>;
244			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245			regulator-allow-set-load;
246			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
247						   RPMH_REGULATOR_MODE_HPM>;
248		};
249
250		/* L7 is unused. */
251
252		vreg_l9a_1p2: ldo9 {
253			regulator-name = "vreg_l9a_1p2";
254			regulator-min-microvolt = <1200000>;
255			regulator-max-microvolt = <1200000>;
256			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
257		};
258
259		/* L10 is unused, L11 - lcx.lvl (ARC) */
260
261		vreg_l12a_1p8: ldo12 {
262			regulator-name = "vreg_l12a_1p8";
263			regulator-min-microvolt = <1800000>;
264			regulator-max-microvolt = <1800000>;
265			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
266		};
267
268		/* L13 is unused. */
269
270		vreg_l14a_1p88: ldo14 {
271			regulator-name = "vreg_l14a_1p88";
272			regulator-min-microvolt = <1880000>;
273			regulator-max-microvolt = <1880000>;
274			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
275		};
276
277		/* L15 & L16 are unused. */
278
279		vreg_l17a_3p0: ldo17 {
280			regulator-name = "vreg_l17a_3p0";
281			regulator-min-microvolt = <2496000>;
282			regulator-max-microvolt = <3008000>;
283			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
284			regulator-allow-set-load;
285			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
286						   RPMH_REGULATOR_MODE_HPM>;
287		};
288
289		vreg_l18a_0p9: ldo18 {
290			regulator-name = "vreg_l18a_0p9";
291			regulator-min-microvolt = <800000>;
292			regulator-max-microvolt = <920000>;
293			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
294		};
295	};
296
297	regulators-1 {
298		compatible = "qcom,pm8150l-rpmh-regulators";
299		qcom,pmic-id = "c";
300
301		vdd-s1-supply = <&vph_pwr>;
302		vdd-s2-supply = <&vph_pwr>;
303		vdd-s3-supply = <&vph_pwr>;
304		vdd-s4-supply = <&vph_pwr>;
305		vdd-s5-supply = <&vph_pwr>;
306		vdd-s6-supply = <&vph_pwr>;
307		vdd-s7-supply = <&vph_pwr>;
308		vdd-s8-supply = <&vph_pwr>;
309		vdd-l1-l8-supply = <&vreg_s4a_1p8>;
310		vdd-l2-l3-supply = <&vreg_s8c_1p35>;
311		vdd-l4-l5-l6-supply = <&vreg_bob>;
312		vdd-l7-l11-supply = <&vreg_bob>;
313		vdd-l9-l10-supply = <&vreg_bob>;
314		vdd-bob-supply = <&vph_pwr>;
315
316		vreg_bob: bob {
317			regulator-name = "vreg_bob";
318			regulator-min-microvolt = <3350000>;
319			regulator-max-microvolt = <3960000>;
320			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
321		};
322
323		/*
324		 * S1-S6 are ARCs:
325		 * (S1+S2) - gfx.lvl,
326		 * S3 - mx.lvl,
327		 * (S4+S5) - mmcx.lvl,
328		 * S6 - ebi.lvl
329		 */
330
331		vreg_s7c_0p35: smps7 {
332			regulator-name = "vreg_s7c_0p35";
333			regulator-min-microvolt = <348000>;
334			regulator-max-microvolt = <1000000>;
335			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
336		};
337
338		vreg_s8c_1p35: smps8 {
339			regulator-name = "vreg_s8c_1p35";
340			regulator-min-microvolt = <1200000>;
341			regulator-max-microvolt = <1400000>;
342			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
343		};
344
345		vreg_l1c_1p8: ldo1 {
346			regulator-name = "vreg_l1c_1p8";
347			regulator-min-microvolt = <1800000>;
348			regulator-max-microvolt = <1800000>;
349			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
350		};
351
352		/* L2-4 are unused. */
353
354		vreg_l5c_1p8: ldo5 {
355			regulator-name = "vreg_l5c_1p8";
356			regulator-min-microvolt = <1800000>;
357			regulator-max-microvolt = <2800000>;
358			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
359		};
360
361		vreg_l6c_2p9: ldo6 {
362			regulator-name = "vreg_l6c_2p9";
363			regulator-min-microvolt = <1800000>;
364			regulator-max-microvolt = <2960000>;
365			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
366			regulator-allow-set-load;
367			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
368						   RPMH_REGULATOR_MODE_HPM>;
369		};
370
371		vreg_l7c_2p85: ldo7 {
372			regulator-name = "vreg_l7c_2p85";
373			regulator-min-microvolt = <2856000>;
374			regulator-max-microvolt = <3104000>;
375			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
376		};
377
378		vreg_l8c_1p8: ldo8 {
379			regulator-name = "vreg_l8c_1p8";
380			regulator-min-microvolt = <1800000>;
381			regulator-max-microvolt = <1800000>;
382			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
383		};
384
385		vreg_l9c_2p9: ldo9 {
386			regulator-name = "vreg_l9c_2p9";
387			regulator-min-microvolt = <2704000>;
388			regulator-max-microvolt = <2960000>;
389			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
390			regulator-allow-set-load;
391			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
392						   RPMH_REGULATOR_MODE_HPM>;
393		};
394
395		vreg_l10c_3p3: ldo10 {
396			regulator-name = "vreg_l10c_3p3";
397			regulator-min-microvolt = <3000000>;
398			regulator-max-microvolt = <3312000>;
399			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
400		};
401
402		vreg_l11c_3p0: ldo11 {
403			regulator-name = "vreg_l11c_3p0";
404			regulator-min-microvolt = <3104000>;
405			regulator-max-microvolt = <3304000>;
406			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
407		};
408	};
409
410	regulators-2 {
411		compatible = "qcom,pm8009-rpmh-regulators";
412		qcom,pmic-id = "f";
413
414		vdd-s1-supply = <&vph_pwr>;
415		vdd-s2-supply = <&vreg_bob>;
416		vdd-l2-supply = <&vreg_s8c_1p35>;
417		vdd-l5-l6-supply = <&vreg_bob>;
418		vdd-l7-supply = <&vreg_s4a_1p8>;
419
420		vreg_s1f_1p2: smps1 {
421			regulator-name = "vreg_s1f_1p2";
422			regulator-min-microvolt = <1200000>;
423			regulator-max-microvolt = <1300000>;
424			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
425		};
426
427		vreg_s2f_0p5: smps2 {
428			regulator-name = "vreg_s2f_0p5";
429			regulator-min-microvolt = <512000>;
430			regulator-max-microvolt = <1100000>;
431			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
432		};
433
434		/* L1 is unused. */
435
436		vreg_l2f_1p3: ldo2 {
437			regulator-name = "vreg_l2f_1p3";
438			regulator-min-microvolt = <1056000>;
439			regulator-max-microvolt = <1200000>;
440			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
441		};
442
443		/* L3 & L4 are unused. */
444
445		vreg_l5f_2p8: ldo5 {
446			regulator-name = "vreg_l5f_2p85";
447			regulator-min-microvolt = <2800000>;
448			regulator-max-microvolt = <3000000>;
449			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
450		};
451
452		vreg_l6f_2p8: ldo6 {
453			regulator-name = "vreg_l6f_2p8";
454			regulator-min-microvolt = <2800000>;
455			regulator-max-microvolt = <3000000>;
456			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
457		};
458
459		vreg_l7f_1p8: ldo7 {
460			regulator-name = "vreg_l7f_1p8";
461			regulator-min-microvolt = <1800000>;
462			regulator-max-microvolt = <1800000>;
463			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
464		};
465	};
466};
467
468&cdsp {
469	firmware-name = "qcom/sm8250/xiaomi/pipa/cdsp.mbn";
470	status = "okay";
471};
472
473&gmu {
474	status = "okay";
475};
476
477&gpi_dma0 {
478	status = "okay";
479};
480
481&gpi_dma1 {
482	status = "okay";
483};
484
485&gpi_dma2 {
486	status = "okay";
487};
488
489&gpu {
490	status = "okay";
491
492	zap-shader {
493		memory-region = <&gpu_mem>;
494		firmware-name = "qcom/sm8250/xiaomi/pipa/a650_zap.mbn";
495	};
496};
497
498&i2c0 {
499	clock-frequency = <400000>;
500	status = "okay";
501
502	fuel-gauge@55 {
503		compatible = "ti,bq27z561";
504		reg = <0x55>;
505		monitored-battery = <&battery_r>;
506	};
507};
508
509&i2c11 {
510	clock-frequency = <400000>;
511	status = "okay";
512
513	backlight: backlight@11 {
514		compatible = "kinetic,ktz8866";
515		reg = <0x11>;
516		vddpos-supply = <&bl_vddpos_5p5>;
517		vddneg-supply = <&bl_vddneg_5p5>;
518		enable-gpios = <&tlmm 139 GPIO_ACTIVE_HIGH>;
519		current-num-sinks = <5>;
520		kinetic,current-ramp-delay-ms = <128>;
521		kinetic,led-enable-ramp-delay-ms = <1>;
522		kinetic,enable-lcd-bias;
523	};
524};
525
526&i2c13 {
527	clock-frequency = <400000>;
528	status = "okay";
529
530	fuel-gauge@55 {
531		compatible = "ti,bq27z561";
532		reg = <0x55>;
533		monitored-battery = <&battery_l>;
534	};
535};
536
537&pcie0 {
538	status = "okay";
539};
540
541&pcie0_phy {
542	vdda-phy-supply = <&vreg_l5a_0p88>;
543	vdda-pll-supply = <&vreg_l9a_1p2>;
544	status = "okay";
545};
546
547&pm8150_gpios {
548	vol_up_n: vol-up-n-state {
549		pins = "gpio6";
550		function = "normal";
551		power-source = <1>;
552		input-enable;
553		bias-pull-up;
554	};
555};
556
557&pon_pwrkey {
558	status = "okay";
559};
560
561&pon_resin {
562	linux,code = <KEY_VOLUMEDOWN>;
563	status = "okay";
564};
565
566&qupv3_id_0 {
567	status = "okay";
568};
569
570&qupv3_id_1 {
571	status = "okay";
572};
573
574&qupv3_id_2 {
575	status = "okay";
576};
577
578&slpi {
579	firmware-name = "qcom/sm8250/xiaomi/pipa/slpi.mbn";
580	status = "okay";
581};
582
583&usb_1 {
584	status = "okay";
585};
586
587&usb_1_dwc3 {
588	dr_mode = "peripheral";
589};
590
591&usb_1_hsphy {
592	vdda-pll-supply = <&vreg_l5a_0p88>;
593	vdda18-supply = <&vreg_l12a_1p8>;
594	vdda33-supply = <&vreg_l2a_3p1>;
595	status = "okay";
596};
597
598&usb_1_qmpphy {
599	status = "okay";
600	vdda-phy-supply = <&vreg_l9a_1p2>;
601	vdda-pll-supply = <&vreg_l18a_0p9>;
602};
603
604&ufs_mem_hc {
605	vcc-supply = <&vreg_l17a_3p0>;
606	vcc-max-microamp = <800000>;
607	vccq-supply = <&vreg_l6a_1p2>;
608	vccq-max-microamp = <800000>;
609	vccq2-supply = <&vreg_s4a_1p8>;
610	vccq2-max-microamp = <800000>;
611	status = "okay";
612};
613
614&ufs_mem_phy {
615	vdda-phy-supply = <&vreg_l5a_0p88>;
616	vdda-pll-supply = <&vreg_l9a_1p2>;
617	status = "okay";
618};
619
620&venus {
621	firmware-name = "qcom/sm8250/xiaomi/pipa/venus.mbn";
622	status = "okay";
623};
624