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&dsi0 {
474	vdda-supply = <&vreg_l9a_1p2>;
475	qcom,dual-dsi-mode;
476	qcom,sync-dual-dsi;
477	qcom,master-dsi;
478	status = "okay";
479
480	display_panel: panel@0 {
481		reg = <0>;
482		vddio-supply = <&vreg_l14a_1p88>;
483		reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;
484		backlight = <&backlight>;
485
486		status = "disabled";
487
488		ports {
489			#address-cells = <1>;
490			#size-cells = <0>;
491
492			port@0 {
493				reg = <0>;
494
495				panel_in_0: endpoint {
496					remote-endpoint = <&dsi0_out>;
497				};
498			};
499
500			port@1{
501				reg = <1>;
502
503				panel_in_1: endpoint {
504					remote-endpoint = <&dsi1_out>;
505				};
506			};
507
508		};
509	};
510};
511
512&dsi0_out {
513	data-lanes = <0 1 2>;
514	remote-endpoint = <&panel_in_0>;
515};
516
517&dsi0_phy {
518	vdds-supply = <&vreg_l5a_0p88>;
519	phy-type = <PHY_TYPE_CPHY>;
520	status = "okay";
521};
522
523&dsi1 {
524	vdda-supply = <&vreg_l9a_1p2>;
525	qcom,dual-dsi-mode;
526	qcom,sync-dual-dsi;
527	/* DSI1 is slave, so use DSI0 clocks */
528	assigned-clock-parents = <&dsi0_phy 0>, <&dsi0_phy 1>;
529	status = "okay";
530};
531
532&dsi1_out {
533	data-lanes = <0 1 2>;
534	remote-endpoint = <&panel_in_1>;
535};
536
537&dsi1_phy {
538	vdds-supply = <&vreg_l5a_0p88>;
539	phy-type = <PHY_TYPE_CPHY>;
540	status = "okay";
541};
542
543&gmu {
544	status = "okay";
545};
546
547&gpi_dma0 {
548	status = "okay";
549};
550
551&gpi_dma1 {
552	status = "okay";
553};
554
555&gpi_dma2 {
556	status = "okay";
557};
558
559&gpu {
560	status = "okay";
561
562	zap-shader {
563		memory-region = <&gpu_mem>;
564		firmware-name = "qcom/sm8250/xiaomi/elish/a650_zap.mbn";
565	};
566};
567
568&i2c0 {
569	clock-frequency = <400000>;
570	status = "okay";
571
572	fuel-gauge@55 {
573		compatible = "ti,bq27z561";
574		reg = <0x55>;
575		monitored-battery = <&battery_r>;
576	};
577};
578
579&i2c11 {
580	clock-frequency = <400000>;
581	status = "okay";
582
583	backlight: backlight@11 {
584		compatible = "kinetic,ktz8866";
585		reg = <0x11>;
586		vddpos-supply = <&bl_vddpos_5p5>;
587		vddneg-supply = <&bl_vddneg_5p5>;
588		enable-gpios = <&tlmm 139 GPIO_ACTIVE_HIGH>;
589		current-num-sinks = <5>;
590		kinetic,current-ramp-delay-ms = <128>;
591		kinetic,led-enable-ramp-delay-ms = <1>;
592		kinetic,enable-lcd-bias;
593	};
594};
595
596&i2c13 {
597	clock-frequency = <400000>;
598	status = "okay";
599
600	fuel-gauge@55 {
601		compatible = "ti,bq27z561";
602		reg = <0x55>;
603		monitored-battery = <&battery_l>;
604	};
605};
606
607&mdss {
608	status = "okay";
609};
610
611&pcie0 {
612	status = "okay";
613};
614
615&pcie0_phy {
616	vdda-phy-supply = <&vreg_l5a_0p88>;
617	vdda-pll-supply = <&vreg_l9a_1p2>;
618	status = "okay";
619};
620
621&pm8150_gpios {
622	vol_up_n: vol-up-n-state {
623		pins = "gpio6";
624		function = "normal";
625		power-source = <1>;
626		input-enable;
627		bias-pull-up;
628	};
629};
630
631&pon_pwrkey {
632	status = "okay";
633};
634
635&pon_resin {
636	linux,code = <KEY_VOLUMEDOWN>;
637	status = "okay";
638};
639
640&qupv3_id_0 {
641	status = "okay";
642};
643
644&qupv3_id_1 {
645	status = "okay";
646};
647
648&qupv3_id_2 {
649	status = "okay";
650};
651
652&slpi {
653	firmware-name = "qcom/sm8250/xiaomi/elish/slpi.mbn";
654	status = "okay";
655};
656
657&tlmm {
658	gpio-reserved-ranges = <40 4>;
659};
660
661&usb_1 {
662	/* USB 2.0 only */
663	qcom,select-utmi-as-pipe-clk;
664	status = "okay";
665};
666
667&usb_1_dwc3 {
668	dr_mode = "peripheral";
669	maximum-speed = "high-speed";
670	/* Remove USB3 phy */
671	phys = <&usb_1_hsphy>;
672	phy-names = "usb2-phy";
673};
674
675&usb_1_hsphy {
676	vdda-pll-supply = <&vreg_l5a_0p88>;
677	vdda18-supply = <&vreg_l12a_1p8>;
678	vdda33-supply = <&vreg_l2a_3p1>;
679	status = "okay";
680};
681
682&ufs_mem_hc {
683	vcc-supply = <&vreg_l17a_3p0>;
684	vcc-max-microamp = <800000>;
685	vccq-supply = <&vreg_l6a_1p2>;
686	vccq-max-microamp = <800000>;
687	vccq2-supply = <&vreg_s4a_1p8>;
688	vccq2-max-microamp = <800000>;
689	status = "okay";
690};
691
692&ufs_mem_phy {
693	vdda-phy-supply = <&vreg_l5a_0p88>;
694	vdda-pll-supply = <&vreg_l9a_1p2>;
695	status = "okay";
696};
697
698&venus {
699	firmware-name = "qcom/sm8250/xiaomi/elish/venus.mbn";
700	status = "okay";
701};
702