1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2022, 2023 Jianhua Lu <lujianhua000@gmail.com>
4 */
5
6#include <dt-bindings/arm/qcom,ids.h>
7#include <dt-bindings/phy/phy.h>
8#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
9#include "sm8250.dtsi"
10#include "pm8150.dtsi"
11#include "pm8150b.dtsi"
12#include "pm8150l.dtsi"
13#include "pm8009.dtsi"
14
15/*
16 * Delete following upstream (sm8250.dtsi) reserved
17 * memory mappings which are different on this device.
18 */
19/delete-node/ &adsp_mem;
20/delete-node/ &cdsp_secure_heap;
21/delete-node/ &slpi_mem;
22/delete-node/ &spss_mem;
23/delete-node/ &xbl_aop_mem;
24
25/ {
26	classis-type = "tablet";
27
28	/* required for bootloader to select correct board */
29	qcom,msm-id = <QCOM_ID_SM8250 0x20001>; /* SM8250 v2.1 */
30	qcom,board-id = <0x10008 0>;
31
32	chosen {
33		#address-cells = <2>;
34		#size-cells = <2>;
35		ranges;
36
37		framebuffer: framebuffer@9c000000 {
38			compatible = "simple-framebuffer";
39			reg = <0x0 0x9c000000 0x0 0x2300000>;
40			width = <1600>;
41			height = <2560>;
42			stride = <(1600 * 4)>;
43			format = "a8r8g8b8";
44		};
45	};
46
47	battery_l: battery-l {
48		compatible = "simple-battery";
49		voltage-min-design-microvolt = <3870000>;
50		energy-full-design-microwatt-hours = <16600000>;
51		charge-full-design-microamp-hours = <4300000>;
52	};
53
54	battery_r: battery-r {
55		compatible = "simple-battery";
56		voltage-min-design-microvolt = <3870000>;
57		energy-full-design-microwatt-hours = <16600000>;
58		charge-full-design-microamp-hours = <4300000>;
59	};
60
61	bl_vddpos_5p5: bl-vddpos-regulator {
62		compatible = "regulator-fixed";
63		regulator-name = "bl_vddpos_5p5";
64		regulator-min-microvolt = <5500000>;
65		regulator-max-microvolt = <5500000>;
66		regulator-enable-ramp-delay = <233>;
67		gpio = <&tlmm 130 GPIO_ACTIVE_HIGH>;
68		enable-active-high;
69		regulator-boot-on;
70	};
71
72	bl_vddneg_5p5: bl-vddneg-regulator {
73		compatible = "regulator-fixed";
74		regulator-name = "bl_vddneg_5p5";
75		regulator-min-microvolt = <5500000>;
76		regulator-max-microvolt = <5500000>;
77		regulator-enable-ramp-delay = <233>;
78		gpio = <&tlmm 131 GPIO_ACTIVE_HIGH>;
79		enable-active-high;
80		regulator-boot-on;
81	};
82
83	gpio_keys: gpio-keys {
84		compatible = "gpio-keys";
85
86		pinctrl-names = "default";
87		pinctrl-0 = <&vol_up_n>;
88
89		key-vol-up {
90			label = "Volume Up";
91			gpios = <&pm8150_gpios 6 GPIO_ACTIVE_LOW>;
92			linux,code = <KEY_VOLUMEUP>;
93			debounce-interval = <15>;
94			linux,can-disable;
95			wakeup-source;
96		};
97	};
98
99	vph_pwr: vph-pwr-regulator {
100		compatible = "regulator-fixed";
101		regulator-name = "vph_pwr";
102		regulator-min-microvolt = <3700000>;
103		regulator-max-microvolt = <3700000>;
104	};
105
106	/* S6c is really ebi.lvl but it's there for supply map completeness sake. */
107	vreg_s6c_0p88: smpc6-regulator {
108		compatible = "regulator-fixed";
109		regulator-name = "vreg_s6c_0p88";
110		regulator-min-microvolt = <880000>;
111		regulator-max-microvolt = <880000>;
112		regulator-always-on;
113		vin-supply = <&vph_pwr>;
114	};
115
116	reserved-memory {
117		xbl_aop_mem: xbl-aop@80700000 {
118			reg = <0x0 0x80600000 0x0 0x260000>;
119			no-map;
120		};
121
122		slpi_mem: slpi@88c00000 {
123			reg = <0x0 0x88c00000 0x0 0x2f00000>;
124			no-map;
125		};
126
127		adsp_mem: adsp@8bb00000 {
128			reg = <0x0 0x8bb00000 0x0 0x2500000>;
129			no-map;
130		};
131
132		spss_mem: spss@8e000000 {
133			reg = <0x0 0x8e000000 0x0 0x100000>;
134			no-map;
135		};
136
137		cdsp_secure_heap: cdsp-secure-heap@8e100000 {
138			reg = <0x0 0x8e100000 0x0 0x4600000>;
139			no-map;
140		};
141
142		cont_splash_mem: cont-splash@9c000000 {
143			reg = <0x0 0x9c000000 0x0 0x2300000>;
144			no-map;
145		};
146
147		ramoops@b0000000 {
148			compatible = "ramoops";
149			reg = <0x0 0xb0000000 0x0 0x400000>;
150			record-size = <0x1000>;
151			console-size = <0x200000>;
152			ecc-size = <16>;
153			no-map;
154		};
155	};
156};
157
158&adsp {
159	firmware-name = "qcom/sm8250/xiaomi/elish/adsp.mbn";
160	status = "okay";
161};
162
163&apps_rsc {
164	regulators-0 {
165		compatible = "qcom,pm8150-rpmh-regulators";
166		qcom,pmic-id = "a";
167
168		vdd-s1-supply = <&vph_pwr>;
169		vdd-s2-supply = <&vph_pwr>;
170		vdd-s3-supply = <&vph_pwr>;
171		vdd-s4-supply = <&vph_pwr>;
172		vdd-s5-supply = <&vph_pwr>;
173		vdd-s6-supply = <&vph_pwr>;
174		vdd-s7-supply = <&vph_pwr>;
175		vdd-s8-supply = <&vph_pwr>;
176		vdd-s9-supply = <&vph_pwr>;
177		vdd-s10-supply = <&vph_pwr>;
178		vdd-l1-l8-l11-supply = <&vreg_s6c_0p88>;
179		vdd-l2-l10-supply = <&vreg_bob>;
180		vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p95>;
181		vdd-l6-l9-supply = <&vreg_s8c_1p35>;
182		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
183		vdd-l13-l16-l17-supply = <&vreg_bob>;
184
185		/* (S1+S2+S3) - cx.lvl (ARC) */
186
187		vreg_s4a_1p8: smps4 {
188			regulator-name = "vreg_s4a_1p8";
189			regulator-min-microvolt = <1800000>;
190			regulator-max-microvolt = <1920000>;
191			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
192			regulator-allow-set-load;
193			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
194						   RPMH_REGULATOR_MODE_HPM>;
195		};
196
197		vreg_s5a_1p9: smps5 {
198			regulator-name = "vreg_s5a_1p9";
199			regulator-min-microvolt = <1900000>;
200			regulator-max-microvolt = <2040000>;
201			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
202		};
203
204		vreg_s6a_0p95: smps6 {
205			regulator-name = "vreg_s6a_0p95";
206			regulator-min-microvolt = <950000>;
207			regulator-max-microvolt = <1128000>;
208			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
209		};
210
211		vreg_l2a_3p1: ldo2 {
212			regulator-name = "vreg_l2a_3p1";
213			regulator-min-microvolt = <3072000>;
214			regulator-max-microvolt = <3072000>;
215			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
216		};
217
218		vreg_l3a_0p9: ldo3 {
219			regulator-name = "vreg_l3a_0p9";
220			regulator-min-microvolt = <928000>;
221			regulator-max-microvolt = <932000>;
222			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
223		};
224
225		/* L4 - lmx.lvl (ARC) */
226
227		vreg_l5a_0p88: ldo5 {
228			regulator-name = "vreg_l5a_0p88";
229			regulator-min-microvolt = <880000>;
230			regulator-max-microvolt = <880000>;
231			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
232		};
233
234		vreg_l6a_1p2: ldo6 {
235			regulator-name = "vreg_l6a_1p2";
236			regulator-min-microvolt = <1200000>;
237			regulator-max-microvolt = <1200000>;
238			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
239			regulator-allow-set-load;
240			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
241						   RPMH_REGULATOR_MODE_HPM>;
242		};
243
244		/* L7 is unused. */
245
246		vreg_l9a_1p2: ldo9 {
247			regulator-name = "vreg_l9a_1p2";
248			regulator-min-microvolt = <1200000>;
249			regulator-max-microvolt = <1200000>;
250			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
251		};
252
253		/* L10 is unused, L11 - lcx.lvl (ARC) */
254
255		vreg_l12a_1p8: ldo12 {
256			regulator-name = "vreg_l12a_1p8";
257			regulator-min-microvolt = <1800000>;
258			regulator-max-microvolt = <1800000>;
259			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
260		};
261
262		/* L13 is unused. */
263
264		vreg_l14a_1p88: ldo14 {
265			regulator-name = "vreg_l14a_1p88";
266			regulator-min-microvolt = <1880000>;
267			regulator-max-microvolt = <1880000>;
268			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
269		};
270
271		/* L15 & L16 are unused. */
272
273		vreg_l17a_3p0: ldo17 {
274			regulator-name = "vreg_l17a_3p0";
275			regulator-min-microvolt = <2496000>;
276			regulator-max-microvolt = <3008000>;
277			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
278			regulator-allow-set-load;
279			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
280						   RPMH_REGULATOR_MODE_HPM>;
281		};
282
283		vreg_l18a_0p9: ldo18 {
284			regulator-name = "vreg_l18a_0p9";
285			regulator-min-microvolt = <800000>;
286			regulator-max-microvolt = <920000>;
287			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
288		};
289	};
290
291	/*
292	 * Remaining regulators that are not yet supported:
293	 * OLEDB: 4925000-8100000
294	 * ab: 4600000-6100000
295	 * ibb: 800000-5400000
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 = <1350000>;
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 = <3296000>;
398			regulator-max-microvolt = <3296000>;
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 = <3000000>;
405			regulator-max-microvolt = <3000000>;
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 = <1200000>;
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 = <1304000>;
439			regulator-max-microvolt = <1304000>;
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 = <2800000>;
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 = <2800000>;
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/elish/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/elish/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&mdss {
538	status = "okay";
539};
540
541&mdss_dsi0 {
542	vdda-supply = <&vreg_l9a_1p2>;
543	qcom,dual-dsi-mode;
544	qcom,sync-dual-dsi;
545	qcom,master-dsi;
546	status = "okay";
547
548	display_panel: panel@0 {
549		reg = <0>;
550		vddio-supply = <&vreg_l14a_1p88>;
551		reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;
552		backlight = <&backlight>;
553
554		status = "disabled";
555
556		ports {
557			#address-cells = <1>;
558			#size-cells = <0>;
559
560			port@0 {
561				reg = <0>;
562
563				panel_in_0: endpoint {
564					remote-endpoint = <&mdss_dsi0_out>;
565				};
566			};
567
568			port@1{
569				reg = <1>;
570
571				panel_in_1: endpoint {
572					remote-endpoint = <&mdss_dsi1_out>;
573				};
574			};
575		};
576	};
577};
578
579&mdss_dsi0_out {
580	data-lanes = <0 1 2>;
581	remote-endpoint = <&panel_in_0>;
582};
583
584&mdss_dsi0_phy {
585	vdds-supply = <&vreg_l5a_0p88>;
586	phy-type = <PHY_TYPE_CPHY>;
587	status = "okay";
588};
589
590&mdss_dsi1 {
591	vdda-supply = <&vreg_l9a_1p2>;
592	qcom,dual-dsi-mode;
593	qcom,sync-dual-dsi;
594	/* DSI1 is slave, so use DSI0 clocks */
595	assigned-clock-parents = <&mdss_dsi0_phy 0>, <&mdss_dsi0_phy 1>;
596	status = "okay";
597};
598
599&mdss_dsi1_out {
600	data-lanes = <0 1 2>;
601	remote-endpoint = <&panel_in_1>;
602};
603
604&mdss_dsi1_phy {
605	vdds-supply = <&vreg_l5a_0p88>;
606	phy-type = <PHY_TYPE_CPHY>;
607	status = "okay";
608};
609
610&pcie0 {
611	status = "okay";
612};
613
614&pcie0_phy {
615	vdda-phy-supply = <&vreg_l5a_0p88>;
616	vdda-pll-supply = <&vreg_l9a_1p2>;
617	status = "okay";
618};
619
620&pm8150_gpios {
621	vol_up_n: vol-up-n-state {
622		pins = "gpio6";
623		function = "normal";
624		power-source = <1>;
625		input-enable;
626		bias-pull-up;
627	};
628};
629
630&pon_pwrkey {
631	status = "okay";
632};
633
634&pon_resin {
635	linux,code = <KEY_VOLUMEDOWN>;
636	status = "okay";
637};
638
639&qupv3_id_0 {
640	status = "okay";
641};
642
643&qupv3_id_1 {
644	status = "okay";
645};
646
647&qupv3_id_2 {
648	status = "okay";
649};
650
651&slpi {
652	firmware-name = "qcom/sm8250/xiaomi/elish/slpi.mbn";
653	status = "okay";
654};
655
656&tlmm {
657	gpio-reserved-ranges = <40 4>;
658};
659
660&usb_1 {
661	/* USB 2.0 only */
662	qcom,select-utmi-as-pipe-clk;
663	status = "okay";
664};
665
666&usb_1_dwc3 {
667	dr_mode = "peripheral";
668	maximum-speed = "high-speed";
669	/* Remove USB3 phy */
670	phys = <&usb_1_hsphy>;
671	phy-names = "usb2-phy";
672};
673
674&usb_1_hsphy {
675	vdda-pll-supply = <&vreg_l5a_0p88>;
676	vdda18-supply = <&vreg_l12a_1p8>;
677	vdda33-supply = <&vreg_l2a_3p1>;
678	status = "okay";
679};
680
681&ufs_mem_hc {
682	vcc-supply = <&vreg_l17a_3p0>;
683	vcc-max-microamp = <800000>;
684	vccq-supply = <&vreg_l6a_1p2>;
685	vccq-max-microamp = <800000>;
686	vccq2-supply = <&vreg_s4a_1p8>;
687	vccq2-max-microamp = <800000>;
688	status = "okay";
689};
690
691&ufs_mem_phy {
692	vdda-phy-supply = <&vreg_l5a_0p88>;
693	vdda-pll-supply = <&vreg_l9a_1p2>;
694	status = "okay";
695};
696
697&venus {
698	firmware-name = "qcom/sm8250/xiaomi/elish/venus.mbn";
699	status = "okay";
700};
701