1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Yassine Oudjana <y.oudjana@protonmail.com>
4 */
5
6#include "pm8994.dtsi"
7#include "pmi8994.dtsi"
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
12
13/ {
14	clocks {
15		compatible = "simple-bus";
16
17		divclk1_cdc: divclk1 {
18			compatible = "gpio-gate-clock";
19			clocks = <&rpmcc RPM_SMD_DIV_CLK1>;
20			#clock-cells = <0>;
21			enable-gpios = <&pm8994_gpios 15 GPIO_ACTIVE_HIGH>;
22
23			pinctrl-names = "default";
24			pinctrl-0 = <&divclk1_default>;
25		};
26
27		divclk4: divclk4 {
28			compatible = "fixed-clock";
29			#clock-cells = <0>;
30			clock-frequency = <32768>;
31			clock-output-names = "divclk4";
32
33			pinctrl-names = "default";
34			pinctrl-0 = <&divclk4_pin_a>;
35		};
36	};
37
38	gpio-keys {
39		compatible = "gpio-keys";
40
41		key-vol-up {
42			label = "Volume Up";
43			gpios = <&pm8994_gpios 2 GPIO_ACTIVE_LOW>;
44			linux,code = <KEY_VOLUMEUP>;
45			wakeup-source;
46			debounce-interval = <15>;
47		};
48
49		key-dome {
50			label = "Home";
51			gpios = <&tlmm 34 GPIO_ACTIVE_LOW>;
52			linux,code = <KEY_HOME>;
53			wakeup-source;
54			debounce-interval = <15>;
55		};
56	};
57
58	irled {
59		compatible = "pwm-ir-tx";
60		pwms = <&pm8994_lpg 1 1000000>;
61
62		pinctrl-names = "default";
63		pinctrl-0 = <&irled_default>;
64	};
65
66	reserved-memory {
67		memory@88800000 {
68			reg = <0x0 0x88800000 0x0 0x1400000>;
69			no-map;
70		};
71
72		/* This platform has all PIL regions offset by 0x1400000 */
73		/delete-node/ mpss@88800000;
74		mpss_mem: mpss@89c00000 {
75			reg = <0x0 0x89c00000 0x0 0x6200000>;
76			no-map;
77		};
78
79		/delete-node/ adsp@8ea00000;
80		adsp_mem: adsp@8fe00000 {
81			reg = <0x0 0x8fe00000 0x0 0x1b00000>;
82			no-map;
83		};
84
85		/delete-node/ slpi@90500000;
86		slpi_mem: slpi@91900000 {
87			reg = <0x0 0x91900000 0x0 0xa00000>;
88			no-map;
89		};
90
91		/delete-node/ gpu@90f00000;
92		gpu_mem: gpu@92300000 {
93			compatible = "shared-dma-pool";
94			reg = <0x0 0x92300000 0x0 0x2000>;
95			no-map;
96		};
97
98		/delete-node/ venus@91000000;
99		venus_mem: venus@92400000 {
100			reg = <0x0 0x92400000 0x0 0x500000>;
101			no-map;
102		};
103
104		ramoops@92900000 {
105			compatible = "ramoops";
106			reg = <0x0 0x92900000 0x0 0x100000>;
107			no-map;
108
109			record-size = <0x8000>;
110			console-size = <0x80000>;
111			ftrace-size = <0x20000>;
112			pmsg-size = <0x40000>;
113		};
114
115		/delete-node/ rmtfs;
116		rmtfs@f6c00000 {
117			compatible = "qcom,rmtfs-mem";
118			reg = <0 0xf6c00000 0 0x200000>;
119			no-map;
120
121			qcom,client-id = <1>;
122			qcom,vmid = <15>;
123		};
124
125		/delete-node/ mba@91500000;
126		mba_mem: mba@f6f00000 {
127			reg = <0x0 0xf6f00000 0x0 0x100000>;
128			no-map;
129		};
130	};
131
132	vph_pwr: vph-pwr-regulator {
133		compatible = "regulator-fixed";
134		regulator-name = "vph_pwr";
135		regulator-min-microvolt = <3800000>;
136		regulator-max-microvolt = <3800000>;
137		regulator-always-on;
138		regulator-boot-on;
139	};
140
141	vdd_3v2_tp: vdd-3v2-tp {
142		compatible = "regulator-fixed";
143		regulator-name = "vdd_3v2_tp";
144		regulator-min-microvolt = <3200000>;
145		regulator-max-microvolt = <3200000>;
146		startup-delay-us = <4000>;
147		vin-supply = <&vph_pwr>;
148
149		gpio = <&tlmm 73 0>;
150		enable-active-high;
151	};
152
153	vdd_3v3: rome-vreg {
154		compatible = "regulator-fixed";
155		regulator-name = "vdd_3v3";
156		regulator-min-microvolt = <3300000>;
157		regulator-max-microvolt = <3300000>;
158		startup-delay-us = <4000>;
159		vin-supply = <&vph_pwr_bbyp>;
160
161		gpio = <&pm8994_gpios 9 0>;
162		enable-active-high;
163		pinctrl-names = "default";
164		pinctrl-0 = <&rome_enable_default>;
165
166		/* Required by QCA6174a - vddpe-3v3 */
167		regulator-always-on;
168	};
169
170	/* WL_EN pin defined as a fixed regulator */
171	wlan_en: wlan-en-1-8v {
172		compatible = "regulator-fixed";
173		regulator-name = "wlan-en-regulator";
174		regulator-min-microvolt = <1800000>;
175		regulator-max-microvolt = <1800000>;
176
177		gpio = <&pm8994_gpios 8 0>;
178		/* WLAN card specific delay */
179		startup-delay-us = <70000>;
180		enable-active-high;
181		pinctrl-names = "default";
182		pinctrl-0 = <&wlan_en_default>;
183	};
184};
185
186&adsp_pil {
187	status = "okay";
188};
189
190&blsp2_i2c2 {
191	status = "okay";
192	label = "NFC_I2C";
193	clock-frequency = <400000>;
194
195	nfc: pn548@28 {
196		compatible = "nxp,nxp-nci-i2c";
197
198		reg = <0x28>;
199
200		interrupt-parent = <&tlmm>;
201		interrupts = <9 IRQ_TYPE_LEVEL_HIGH>;
202
203		enable-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
204		firmware-gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>;
205
206		pinctrl-names = "default";
207		pinctrl-0 = <&nfc_default>;
208	};
209};
210
211&blsp2_i2c3 {
212	status = "okay";
213	label = "TYPEC_I2C";
214
215	typec: tusb320l@47 {
216		compatible = "ti,tusb320l";
217		reg = <0x47>;
218		interrupt-parent = <&tlmm>;
219		interrupts = <63 IRQ_TYPE_EDGE_RISING>;
220	};
221};
222
223&blsp2_i2c6 {
224	status = "okay";
225	label = "MSM_TS_I2C";
226};
227
228&blsp1_uart2 {
229	status = "okay";
230	label = "QCA_UART";
231
232	bluetooth: bluetooth {
233		compatible = "qcom,qca6174-bt";
234
235		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
236		clocks = <&divclk4>;
237	};
238};
239
240&dsi0 {
241	status = "okay";
242
243	vdd-supply = <&vreg_l2a_1p25>;
244	vddio-supply = <&vreg_l14a_1p8>;
245
246	pinctrl-names = "default", "sleep";
247	pinctrl-0 = <&mdss_dsi_default &mdss_te_default>;
248	pinctrl-1 = <&mdss_dsi_sleep &mdss_te_sleep>;
249};
250
251&dsi0_out {
252	status = "okay";
253
254	data-lanes = <0 1 2 3>;
255};
256
257&dsi0_phy {
258	status = "okay";
259
260	vcca-supply = <&vreg_l28a_0p925>;
261};
262
263&gpu {
264	status = "okay";
265};
266
267&mdss {
268	status = "okay";
269};
270
271&mmcc {
272	vdd-gfx-supply = <&vdd_gfx>;
273};
274
275&mss_pil {
276	status = "okay";
277
278	pll-supply = <&vreg_l12a_1p8>;
279};
280
281&pcie0 {
282	status = "okay";
283
284	/* Supplied by vdd_3v3, but choose wlan_en to drive enable pin high */
285	vddpe-3v3-supply = <&wlan_en>;
286	vdda-supply = <&vreg_l28a_0p925>;
287
288	perst-gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
289	wake-gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
290};
291
292&pcie_phy {
293	status = "okay";
294
295	vdda-phy-supply = <&vreg_l28a_0p925>;
296	vdda-pll-supply = <&vreg_l12a_1p8>;
297};
298
299&pm8994_resin {
300	status = "okay";
301
302	linux,code = <KEY_VOLUMEDOWN>;
303};
304
305&pm8994_lpg {
306	status = "okay";
307
308	qcom,power-source = <1>;
309};
310
311&pmi8994_lpg {
312	status = "okay";
313
314	qcom,power-source = <1>;
315
316	multi-led {
317		color = <LED_COLOR_ID_RGB>;
318		function = LED_FUNCTION_STATUS;
319
320		#address-cells = <1>;
321		#size-cells = <0>;
322
323		led@1 {
324			reg = <1>;
325			color = <LED_COLOR_ID_BLUE>;
326		};
327
328		led@2 {
329			reg = <2>;
330			color = <LED_COLOR_ID_GREEN>;
331		};
332
333		led@3 {
334			reg = <3>;
335			color = <LED_COLOR_ID_RED>;
336		};
337	};
338};
339
340&slpi_pil {
341	status = "okay";
342
343	px-supply = <&vreg_lvs2a_1p8>;
344};
345
346&usb3 {
347	status = "okay";
348	extcon = <&typec>;
349
350	qcom,select-utmi-as-pipe-clk;
351};
352
353&usb3_dwc3 {
354	extcon = <&typec>;
355
356	/* usb3-phy is not used on this device */
357	phys = <&hsusb_phy1>;
358	phy-names = "usb2-phy";
359
360	maximum-speed = "high-speed";
361	snps,is-utmi-l1-suspend;
362	snps,usb2-gadget-lpm-disable;
363	snps,hird-threshold = /bits/ 8 <0>;
364};
365
366&hsusb_phy1 {
367	status = "okay";
368	extcon = <&typec>;
369
370	vdda-pll-supply = <&vreg_l12a_1p8>;
371	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
372};
373
374&ufshc {
375	status = "okay";
376
377	vcc-supply = <&vreg_l20a_2p95>;
378	vccq-supply = <&vreg_l25a_1p2>;
379	vccq2-supply = <&vreg_s4a_1p8>;
380
381	vcc-max-microamp = <600000>;
382	vccq-max-microamp = <450000>;
383	vccq2-max-microamp = <450000>;
384};
385
386&ufsphy {
387	status = "okay";
388
389	vdda-phy-supply = <&vreg_l28a_0p925>;
390	vdda-pll-supply = <&vreg_l12a_1p8>;
391	vddp-ref-clk-supply = <&vreg_l25a_1p2>;
392};
393
394&venus {
395	status = "okay";
396};
397
398&wcd9335 {
399	clock-names = "mclk", "slimbus";
400	clocks = <&divclk1_cdc>,
401		 <&rpmcc RPM_SMD_BB_CLK1>;
402
403	vdd-buck-supply = <&vreg_s4a_1p8>;
404	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
405	vdd-rx-supply = <&vreg_s4a_1p8>;
406	vdd-tx-supply = <&vreg_s4a_1p8>;
407	vdd-vbat-supply = <&vph_pwr>;
408	vdd-micbias-supply = <&vph_pwr_bbyp>;
409	vdd-io-supply = <&vreg_s4a_1p8>;
410};
411
412&rpm_requests {
413	regulators-0 {
414		compatible = "qcom,rpm-pm8994-regulators";
415
416		vdd_s1-supply = <&vph_pwr>;
417		vdd_s2-supply = <&vph_pwr>;
418		vdd_s3-supply = <&vph_pwr>;
419		vdd_s4-supply = <&vph_pwr>;
420		vdd_s5-supply = <&vph_pwr>;
421		vdd_s6-supply = <&vph_pwr>;
422		vdd_s7-supply = <&vph_pwr>;
423		vdd_s8-supply = <&vph_pwr>;
424		vdd_s9-supply = <&vph_pwr>;
425		vdd_s10-supply = <&vph_pwr>;
426		vdd_s11-supply = <&vph_pwr>;
427		vdd_s12-supply = <&vph_pwr>;
428		vdd_l1-supply = <&vreg_s1b_1p025>;
429		vdd_l2_l26_l28-supply = <&vreg_s3a_1p3>;
430		vdd_l3_l11-supply = <&vreg_s3a_1p3>;
431		vdd_l4_l27_l31-supply = <&vreg_s3a_1p3>;
432		vdd_l5_l7-supply = <&vreg_s5a_2p15>;
433		vdd_l6_l12_l32-supply = <&vreg_s5a_2p15>;
434		vdd_l8_l16_l30-supply = <&vph_pwr>;
435		vdd_l9_l10_l18_l22-supply = <&vph_pwr_bbyp>;
436		vdd_l13_l19_l23_l24-supply = <&vph_pwr_bbyp>;
437		vdd_l14_l15-supply = <&vreg_s5a_2p15>;
438		vdd_l17_l29-supply = <&vph_pwr_bbyp>;
439		vdd_l20_l21-supply = <&vph_pwr_bbyp>;
440		vdd_l25-supply = <&vreg_s3a_1p3>;
441		vdd_lvs1_2-supply = <&vreg_s4a_1p8>;
442
443		vreg_s3a_1p3: s3 {
444			regulator-name = "vreg_s3a_1p3";
445			regulator-min-microvolt = <1300000>;
446			regulator-max-microvolt = <1300000>;
447
448			/* Required by QCA6174a - vdd-core */
449			regulator-always-on;
450		};
451		vreg_s4a_1p8: s4 {
452			regulator-name = "vreg_s4a_1p8";
453			regulator-min-microvolt = <1800000>;
454			regulator-max-microvolt = <1800000>;
455			regulator-allow-set-load;
456
457			/* Required by QCA6174a - vddio */
458			regulator-always-on;
459		};
460		vreg_s5a_2p15: s5 {
461			regulator-name = "vreg_s5a_2p15";
462			regulator-min-microvolt = <2150000>;
463			regulator-max-microvolt = <2150000>;
464		};
465		vreg_s7a_0p8: s7 {
466			regulator-name = "vreg_s7a_0p8";
467			regulator-min-microvolt = <800000>;
468			regulator-max-microvolt = <800000>;
469		};
470		vreg_l1a_1p0: l1 {
471			regulator-name = "vreg_l1a_1p0";
472			regulator-min-microvolt = <1000000>;
473			regulator-max-microvolt = <1000000>;
474		};
475		vreg_l2a_1p25: l2 {
476			regulator-name = "vreg_l2a_1p25";
477			regulator-min-microvolt = <1250000>;
478			regulator-max-microvolt = <1250000>;
479		};
480		vreg_l4a_1p225: l4 {
481			regulator-name = "vreg_l4a_1p225";
482			regulator-min-microvolt = <1225000>;
483			regulator-max-microvolt = <1225000>;
484		};
485		vreg_l6a_1p8: l6 {
486			regulator-name = "vreg_l6a_1p8";
487			regulator-min-microvolt = <1800000>;
488			regulator-max-microvolt = <1800000>;
489		};
490		vreg_l8a_1p8: l8 {
491			regulator-name = "vreg_l8a_1p8";
492			regulator-min-microvolt = <1800000>;
493			regulator-max-microvolt = <1800000>;
494		};
495		vreg_l9a_1p8: l9 {
496			regulator-name = "vreg_l9a_1p8";
497			regulator-min-microvolt = <1800000>;
498			regulator-max-microvolt = <1800000>;
499		};
500		vreg_l10a_1p8: l10 {
501			regulator-name = "vreg_l10a_1p8";
502			regulator-min-microvolt = <1800000>;
503			regulator-max-microvolt = <1800000>;
504		};
505		vreg_l12a_1p8: l12 {
506			regulator-name = "vreg_l12a_1p8";
507			regulator-min-microvolt = <1800000>;
508			regulator-max-microvolt = <1800000>;
509			regulator-allow-set-load;
510		};
511		vreg_l13a_2p95: l13 {
512			regulator-name = "vreg_l13a_2p95";
513			regulator-min-microvolt = <1800000>;
514			regulator-max-microvolt = <2950000>;
515		};
516		vreg_l14a_1p8: l14 {
517			regulator-name = "vreg_l14a_1p8";
518			regulator-min-microvolt = <1800000>;
519			regulator-max-microvolt = <1800000>;
520		};
521		vreg_l15a_1p8: l15 {
522			regulator-name = "vreg_l15a_1p8";
523			regulator-min-microvolt = <1800000>;
524			regulator-max-microvolt = <1800000>;
525		};
526		vreg_l16a_2p7: l16 {
527			regulator-name = "vreg_l16a_2p7";
528			regulator-min-microvolt = <2700000>;
529			regulator-max-microvolt = <2700000>;
530		};
531		vreg_l19a_3p3: l19 {
532			regulator-name = "vreg_l19a_3p3";
533			regulator-min-microvolt = <3000000>;
534			regulator-max-microvolt = <3000000>;
535		};
536		vreg_l20a_2p95: l20 {
537			regulator-name = "vreg_l20a_2p95";
538			regulator-min-microvolt = <2950000>;
539			regulator-max-microvolt = <2950000>;
540			regulator-allow-set-load;
541		};
542		vreg_l21a_2p95: l21 {
543			regulator-name = "vreg_l21a_2p95";
544			regulator-min-microvolt = <3300000>;
545			regulator-max-microvolt = <3300000>;
546			regulator-always-on;
547		};
548		vreg_l23a_2p8: l23 {
549			regulator-name = "vreg_l23a_2p8";
550			regulator-min-microvolt = <2800000>;
551			regulator-max-microvolt = <2800000>;
552		};
553		vreg_l24a_3p075: l24 {
554			regulator-name = "vreg_l24a_3p075";
555			regulator-min-microvolt = <3075000>;
556			regulator-max-microvolt = <3075000>;
557		};
558		vreg_l25a_1p2: l25 {
559			regulator-name = "vreg_l25a_1p2";
560			regulator-min-microvolt = <1200000>;
561			regulator-max-microvolt = <1200000>;
562			regulator-allow-set-load;
563		};
564		vreg_l27a_1p2: l27 {
565			regulator-name = "vreg_l27a_1p2";
566			regulator-min-microvolt = <1200000>;
567			regulator-max-microvolt = <1200000>;
568		};
569		vreg_l28a_0p925: l28 {
570			regulator-name = "vreg_l28a_0p925";
571			regulator-min-microvolt = <925000>;
572			regulator-max-microvolt = <925000>;
573			regulator-allow-set-load;
574		};
575		vreg_l30a_1p8: l30 {
576			regulator-name = "vreg_l30a_1p8";
577			regulator-min-microvolt = <1800000>;
578			regulator-max-microvolt = <1800000>;
579
580			/* Required by QCA6174a - vddio-xtal */
581			regulator-always-on;
582		};
583		vreg_l32a_1p8: l32 {
584			regulator-name = "vreg_l32a_1p8";
585			regulator-min-microvolt = <1800000>;
586			regulator-max-microvolt = <1800000>;
587		};
588		vreg_lvs1a_1p8: lvs1 {
589			regulator-min-microvolt = <1800000>;
590			regulator-max-microvolt = <1800000>;
591		};
592		vreg_lvs2a_1p8: lvs2 {
593			regulator-min-microvolt = <1800000>;
594			regulator-max-microvolt = <1800000>;
595		};
596	};
597
598	regulators-1 {
599		compatible = "qcom,rpm-pmi8994-regulators";
600
601		vdd_s1-supply = <&vph_pwr>;
602		vdd_s2-supply = <&vph_pwr>;
603		vdd_s3-supply = <&vph_pwr>;
604		vdd_bst_byp-supply = <&vph_pwr>;
605
606		vreg_s1b_1p025: s1 {
607			regulator-name = "vreg_s1b_1p025";
608			regulator-min-microvolt = <1025000>;
609			regulator-max-microvolt = <1025000>;
610		};
611
612		vph_pwr_bbyp: boost-bypass {
613			regulator-name = "vph_pwr_bbyp";
614			regulator-min-microvolt = <3150000>;
615			regulator-max-microvolt = <3600000>;
616		};
617	};
618};
619
620&pm8994_spmi_regulators {
621	qcom,saw-reg = <&saw3>;
622	s8 {
623		qcom,saw-slave;
624	};
625	s9 {
626		qcom,saw-slave;
627	};
628	s10 {
629		qcom,saw-slave;
630	};
631	vreg_apc_0p8: s11 {
632		qcom,saw-leader;
633		regulator-name = "vreg_apc_0p8";
634		regulator-min-microvolt = <470000>;
635		regulator-max-microvolt = <1140000>;
636		regulator-max-step-microvolt = <150000>;
637		regulator-always-on;
638	};
639};
640
641&pmi8994_spmi_regulators {
642	vdd_gfx: s2 {
643		regulator-name = "vdd_gfx";
644		regulator-min-microvolt = <400000>;
645		regulator-max-microvolt = <1015000>;
646		regulator-enable-ramp-delay = <500>;
647	};
648};
649
650&pm8994_gpios {
651	irled_default: irled-default-state {
652		pins = "gpio5";
653		function = PMIC_GPIO_FUNC_FUNC1;
654		output-low;
655		qcom,drive-strength = <PMIC_GPIO_STRENGTH_HIGH>;
656		power-source = <PM8994_GPIO_S4>;
657		bias-disable;
658	};
659
660	wlan_en_default: wlan-en-state {
661		pins = "gpio8";
662		function = PMIC_GPIO_FUNC_NORMAL;
663		output-low;
664		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
665		power-source = <PM8994_GPIO_S4>;
666		bias-disable;
667	};
668
669	rome_enable_default: rome-enable-state {
670		pins = "gpio9";
671		function = PMIC_GPIO_FUNC_NORMAL;
672		output-high;
673		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
674		power-source = <PM8994_GPIO_VPH>;
675	};
676
677	divclk1_default: divclk1-state {
678		pins = "gpio15";
679		function = PMIC_GPIO_FUNC_FUNC1;
680		bias-disable;
681		power-source = <PM8994_GPIO_S4>;
682		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
683	};
684
685	divclk4_pin_a: divclk4-state {
686		pins = "gpio18";
687		function = PMIC_GPIO_FUNC_FUNC2;
688		bias-disable;
689		power-source = <PM8994_GPIO_S4>;
690	};
691};
692
693&tlmm {
694	mdss_dsi_default: mdss-dsi-default-state {
695		pins = "gpio8";
696		function = "gpio";
697		drive-strength = <8>;
698		bias-disable;
699	};
700
701	mdss_dsi_sleep: mdss-dsi-sleep-state {
702		pins = "gpio8";
703		function = "gpio";
704		drive-strength = <2>;
705		bias-pull-down;
706	};
707
708	mdss_te_default: mdss-te-default-state {
709		pins = "gpio10";
710		function = "mdp_vsync";
711		drive-strength = <2>;
712		bias-pull-down;
713	};
714
715	mdss_te_sleep: mdss-te-sleep-state {
716		pins = "gpio10";
717		function = "mdp_vsync";
718		drive-strength = <2>;
719		bias-pull-down;
720	};
721
722	nfc_default: nfc-default-state {
723		pins = "gpio12", "gpio21";
724		function = "gpio";
725		drive-strength = <16>;
726		bias-pull-up;
727	};
728};
729