1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2022, Harry Austen <hpausten@protonmail.com>
4 */
5
6#include "msm8996.dtsi"
7#include "pm8994.dtsi"
8#include "pmi8994.dtsi"
9#include "pmi8996.dtsi"
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
12#include <dt-bindings/sound/qcom,q6afe.h>
13#include <dt-bindings/sound/qcom,q6asm.h>
14#include <dt-bindings/sound/qcom,wcd9335.h>
15
16/ {
17	aliases {
18		serial0 = &blsp1_uart2;
19		serial1 = &blsp2_uart2;
20	};
21
22	battery: battery {
23		compatible = "simple-battery";
24
25		constant-charge-current-max-microamp = <3000000>;
26		voltage-min-design-microvolt = <3400000>;
27	};
28
29	chosen {
30		stdout-path = "serial1:115200n8";
31	};
32
33	clocks {
34		div1_mclk: div1-clk {
35			compatible = "gpio-gate-clock";
36			pinctrl-names = "default";
37			pinctrl-0 = <&audio_mclk>;
38			#clock-cells = <0>;
39			clocks = <&rpmcc RPM_SMD_DIV_CLK1>;
40			enable-gpios = <&pm8994_gpios 15 GPIO_ACTIVE_HIGH>;
41		};
42
43		divclk4: div4-clk {
44			compatible = "fixed-clock";
45			pinctrl-names = "default";
46			pinctrl-0 = <&divclk4_pin_a>;
47			#clock-cells = <0>;
48			clock-frequency = <32768>;
49			clock-output-names = "divclk4";
50		};
51	};
52
53	reserved-memory {
54		ramoops@ac000000 {
55			compatible = "ramoops";
56			reg = <0 0xac000000 0 0x200000>;
57			record-size = <0x20000>;
58			console-size = <0x100000>;
59			pmsg-size = <0x80000>;
60		};
61	};
62
63	vph_pwr: vph-pwr-regulator {
64		compatible = "regulator-fixed";
65		regulator-name = "vph_pwr";
66		regulator-min-microvolt = <3700000>;
67		regulator-max-microvolt = <3700000>;
68		regulator-always-on;
69		regulator-boot-on;
70	};
71
72	wlan_en: wlan-en-regulator {
73		compatible = "regulator-fixed";
74		pinctrl-names = "default";
75		pinctrl-0 = <&wlan_en_gpios>;
76		regulator-name = "wlan-en-regulator";
77		regulator-min-microvolt = <1800000>;
78		regulator-max-microvolt = <1800000>;
79
80		gpio = <&pm8994_gpios 8 GPIO_ACTIVE_HIGH>;
81
82		/* WLAN card specific delay */
83		startup-delay-us = <70000>;
84		enable-active-high;
85	};
86};
87
88&adsp_pil {
89	status = "okay";
90};
91
92&blsp1_i2c3 {
93	status = "okay";
94
95	tfa9890_amp: audio-codec@36 {
96		compatible = "nxp,tfa9890";
97		reg = <0x36>;
98		#sound-dai-cells = <0>;
99	};
100};
101
102&blsp1_i2c6 {
103	status = "okay";
104
105	bq27541: fuel-gauge@55 {
106		compatible = "ti,bq27541";
107		reg = <0x55>;
108	};
109};
110
111&blsp1_uart2 {
112	label = "BT-UART";
113	uart-has-rtscts;
114	status = "okay";
115
116	bluetooth {
117		compatible = "qcom,qca6174-bt";
118		pinctrl-names = "default";
119		pinctrl-0 = <&bt_en_gpios>;
120		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
121		clocks = <&divclk4>;
122	};
123};
124
125&blsp2_i2c1 {
126	status = "okay";
127};
128
129&blsp2_i2c6 {
130	status = "okay";
131
132	synaptics_rmi4_i2c: touchscreen@20 {
133		compatible = "syna,rmi4-i2c";
134		reg = <0x20>;
135		#address-cells = <1>;
136		#size-cells = <0>;
137		interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>;
138		pinctrl-names = "default", "sleep";
139		pinctrl-0 = <&touch_default>;
140		pinctrl-1 = <&touch_suspend>;
141		vdd-supply = <&vreg_l22a_3p0>;
142		vio-supply = <&vreg_s4a_1p8>;
143		syna,reset-delay-ms = <200>;
144		syna,startup-delay-ms = <200>;
145
146		rmi4-f01@1 {
147			reg = <0x1>;
148			syna,nosleep-mode = <1>;
149		};
150
151		rmi4-f12@12 {
152			reg = <0x12>;
153			syna,sensor-type = <1>;
154			touchscreen-x-mm = <68>;
155			touchscreen-y-mm = <122>;
156		};
157	};
158};
159
160&blsp2_uart2 {
161	pinctrl-names = "default", "sleep";
162	pinctrl-0 = <&blsp2_uart2_2pins_default>;
163	pinctrl-1 = <&blsp2_uart2_2pins_sleep>;
164	status = "okay";
165};
166
167&camss {
168	vdda-supply = <&vreg_l2a_1p25>;
169};
170
171&dsi0 {
172	vdda-supply = <&vreg_l2a_1p25>;
173	vcca-supply = <&vreg_l22a_3p0>;
174	status = "okay";
175};
176
177&dsi0_out {
178	data-lanes = <0 1 2 3>;
179};
180
181&dsi0_phy {
182	vcca-supply = <&vreg_l28a_0p925>;
183	status = "okay";
184};
185
186&gpu {
187	status = "okay";
188};
189
190&hsusb_phy1 {
191	vdd-supply = <&vreg_l28a_0p925>;
192	vdda-pll-supply = <&vreg_l12a_1p8>;
193	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
194	status = "okay";
195};
196
197&hsusb_phy2 {
198	vdd-supply = <&vreg_l28a_0p925>;
199	vdda-pll-supply = <&vreg_l12a_1p8>;
200	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
201	status = "okay";
202};
203
204&mdp {
205	status = "okay";
206};
207
208&mdss {
209	status = "okay";
210};
211
212&mmcc {
213	vdd-gfx-supply = <&vdd_gfx>;
214};
215
216&mss_pil {
217	pll-supply = <&vreg_l12a_1p8>;
218	status = "okay";
219};
220
221&pcie0 {
222	perst-gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
223	vddpe-3v3-supply = <&wlan_en>;
224	vdda-supply = <&vreg_l28a_0p925>;
225	status = "okay";
226};
227
228&pcie_phy {
229	vdda-phy-supply = <&vreg_l28a_0p925>;
230	vdda-pll-supply = <&vreg_l12a_1p8>;
231	status = "okay";
232};
233
234&pm8994_gpios {
235	bt_en_gpios: bt-en-gpios-state {
236		pins = "gpio19";
237		function = PMIC_GPIO_FUNC_NORMAL;
238		output-low;
239		power-source = <PM8994_GPIO_S4>;
240		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
241		bias-pull-down;
242	};
243
244	wlan_en_gpios: wlan-en-gpios-state {
245		pins = "gpio8";
246		function = PMIC_GPIO_FUNC_NORMAL;
247		output-low;
248		power-source = <PM8994_GPIO_S4>;
249		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
250		bias-pull-down;
251	};
252
253	audio_mclk: divclk1-state {
254		pins = "gpio15";
255		function = PMIC_GPIO_FUNC_FUNC1;
256		power-source = <PM8994_GPIO_S4>;
257	};
258
259	divclk4_pin_a: divclk4-state {
260		pins = "gpio18";
261		function = PMIC_GPIO_FUNC_FUNC2;
262		bias-disable;
263		power-source = <PM8994_GPIO_S4>;
264	};
265};
266
267&pm8994_spmi_regulators {
268	qcom,saw-reg = <&saw3>;
269
270	s9 {
271		qcom,saw-slave;
272	};
273
274	s10 {
275		qcom,saw-slave;
276	};
277
278	s11 {
279		qcom,saw-leader;
280		regulator-min-microvolt = <1140000>;
281		regulator-max-microvolt = <1140000>;
282		regulator-max-step-microvolt = <150000>;
283		regulator-always-on;
284	};
285};
286
287&pmi8994_spmi_regulators {
288	vdd_gfx: s2 {
289		regulator-name = "vdd-gfx";
290		regulator-min-microvolt = <980000>;
291		regulator-max-microvolt = <1230000>;
292	};
293};
294
295&q6asmdai {
296	#address-cells = <1>;
297	#size-cells = <0>;
298
299	dai@0 {
300		reg = <0>;
301	};
302
303	dai@1 {
304		reg = <1>;
305	};
306
307	dai@2 {
308		reg = <2>;
309	};
310};
311
312&rpm_requests {
313	regulators {
314		compatible = "qcom,rpm-pm8994-regulators";
315
316		vreg_s3a_1p3: s3 {
317			regulator-name = "vreg_s3a_1p3";
318			regulator-min-microvolt = <1300000>;
319			regulator-max-microvolt = <1300000>;
320		};
321
322		vreg_s4a_1p8: s4 {
323			regulator-name = "vreg_s4a_1p8";
324			regulator-min-microvolt = <1800000>;
325			regulator-max-microvolt = <1800000>;
326			regulator-always-on;
327		};
328
329		vreg_s5a_2p15: s5 {
330			regulator-name = "vreg_s5a_2p15";
331			regulator-min-microvolt = <2150000>;
332			regulator-max-microvolt = <2150000>;
333		};
334
335		vreg_s7a_0p8: s7 {
336			regulator-name = "vreg_s7a_0p8";
337			regulator-min-microvolt = <800000>;
338			regulator-max-microvolt = <800000>;
339		};
340
341		vreg_l1a_1p0: l1 {
342			regulator-name = "vreg_l1a_1p0";
343			regulator-min-microvolt = <1000000>;
344			regulator-max-microvolt = <1000000>;
345		};
346
347		vreg_l2a_1p25: l2 {
348			regulator-name = "vreg_l2a_1p25";
349			regulator-min-microvolt = <1250000>;
350			regulator-max-microvolt = <1250000>;
351			regulator-allow-set-load;
352		};
353
354		vreg_l3a_1p1: l3 {
355			regulator-name = "vreg_l3a_1p1";
356			regulator-min-microvolt = <1100000>;
357			regulator-max-microvolt = <1100000>;
358		};
359
360		vreg_l4a_1p225: l4 {
361			regulator-name = "vreg_l4a_1p225";
362			regulator-min-microvolt = <1225000>;
363			regulator-max-microvolt = <1225000>;
364		};
365
366		vreg_l6a_1p2: l6 {
367			regulator-name = "vreg_l6a_1p2";
368			regulator-min-microvolt = <1200000>;
369			regulator-max-microvolt = <1200000>;
370		};
371
372		vreg_l7a_1p8: l7 {
373			regulator-name = "vreg_l7a_1p8";
374			regulator-min-microvolt = <1800000>;
375			regulator-max-microvolt = <1800000>;
376		};
377
378		vreg_l9a_1p8: l9 {
379			regulator-name = "vreg_l9a_1p8";
380			regulator-min-microvolt = <1800000>;
381			regulator-max-microvolt = <1800000>;
382		};
383
384		vreg_l10a_1p8: l10 {
385			regulator-name = "vreg_l10a_1p8";
386			regulator-min-microvolt = <1800000>;
387			regulator-max-microvolt = <1800000>;
388		};
389
390		vreg_l11a_1p15: l11 {
391			regulator-name = "vreg_l11a_1p15";
392			regulator-min-microvolt = <1150000>;
393			regulator-max-microvolt = <1150000>;
394		};
395
396		vreg_l12a_1p8: l12 {
397			regulator-name = "vreg_l12a_1p8";
398			regulator-min-microvolt = <1800000>;
399			regulator-max-microvolt = <1800000>;
400			regulator-allow-set-load;
401		};
402
403		vreg_l13a_2p95: l13 {
404			regulator-name = "vreg_l13a_2p95";
405			regulator-min-microvolt = <2950000>;
406			regulator-max-microvolt = <2950000>;
407		};
408
409		vreg_l16a_2p7: l16 {
410			regulator-name = "vreg_l16a_2p7";
411			regulator-min-microvolt = <2700000>;
412			regulator-max-microvolt = <2700000>;
413		};
414
415		vreg_l17a_2p6: l17 {
416			regulator-name = "vreg_l17a_2p6";
417			regulator-min-microvolt = <2600000>;
418			regulator-max-microvolt = <2600000>;
419		};
420
421		vreg_l18a_3p3: l18 {
422			regulator-name = "vreg_l18a_3p3";
423			regulator-min-microvolt = <3300000>;
424			regulator-max-microvolt = <3300000>;
425		};
426
427		vreg_l19a_3p0: l19 {
428			regulator-name = "vreg_l19a_3p0";
429			regulator-min-microvolt = <3000000>;
430			regulator-max-microvolt = <3000000>;
431		};
432
433		vreg_l20a_2p95: l20 {
434			regulator-name = "vreg_l20a_2p95";
435			regulator-min-microvolt = <2950000>;
436			regulator-max-microvolt = <2950000>;
437			regulator-allow-set-load;
438		};
439
440		vreg_l21a_2p95: l21 {
441			regulator-name = "vreg_l21a_2p95";
442			regulator-min-microvolt = <2950000>;
443			regulator-max-microvolt = <2950000>;
444			regulator-allow-set-load;
445			regulator-system-load = <200000>;
446		};
447
448		vreg_l22a_3p0: l22 {
449			regulator-name = "vreg_l22a_3p0";
450			regulator-min-microvolt = <3000000>;
451			regulator-max-microvolt = <3300000>;
452		};
453
454		vreg_l23a_2p8: l23 {
455			regulator-name = "vreg_l23a_2p8";
456			regulator-min-microvolt = <2800000>;
457			regulator-max-microvolt = <2800000>;
458		};
459
460		vreg_l24a_3p075: l24 {
461			regulator-name = "vreg_l24a_3p075";
462			regulator-min-microvolt = <3075000>;
463			regulator-max-microvolt = <3075000>;
464		};
465
466		vreg_l25a_1p2: l25 {
467			regulator-name = "vreg_l25a_1p2";
468			regulator-min-microvolt = <1200000>;
469			regulator-max-microvolt = <1200000>;
470			regulator-allow-set-load;
471			regulator-always-on;
472		};
473
474		vreg_l27a_1p2: l27 {
475			regulator-name = "vreg_l27a_1p2";
476			regulator-min-microvolt = <1200000>;
477			regulator-max-microvolt = <1200000>;
478		};
479
480		vreg_l28a_0p925: l28 {
481			regulator-name = "vreg_l28a_0p925";
482			regulator-min-microvolt = <925000>;
483			regulator-max-microvolt = <925000>;
484			regulator-allow-set-load;
485		};
486
487		vreg_l29a_2p8: l29 {
488			regulator-name = "vreg_l29a_2p8";
489			regulator-min-microvolt = <2800000>;
490			regulator-max-microvolt = <2800000>;
491		};
492
493		vreg_l30a_1p8: l30 {
494			regulator-name = "vreg_l30a_1p8";
495			regulator-min-microvolt = <1800000>;
496			regulator-max-microvolt = <1800000>;
497		};
498
499		vreg_l32a_1p8: l32 {
500			regulator-name = "vreg_l32a_1p8";
501			regulator-min-microvolt = <1800000>;
502			regulator-max-microvolt = <1800000>;
503		};
504	};
505};
506
507&slpi_pil {
508	status = "okay";
509};
510
511&sound {
512	compatible = "qcom,apq8096-sndcard";
513	model = "OnePlus3";
514	audio-routing = "RX_BIAS", "MCLK",
515			"AMIC2", "MIC BIAS2",
516			"MIC BIAS2", "Headset Mic",
517			"AMIC4", "MIC BIAS1",
518			"MIC BIAS1", "Primary Mic",
519			"AMIC5", "MIC BIAS3",
520			"MIC BIAS3", "Noise Mic";
521
522	mm1-dai-link {
523		link-name = "MultiMedia1";
524
525		cpu {
526			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
527		};
528	};
529
530	mm2-dai-link {
531		link-name = "MultiMedia2";
532
533		cpu {
534			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
535		};
536	};
537
538	mm3-dai-link {
539		link-name = "MultiMedia3";
540
541		cpu {
542			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>;
543		};
544	};
545
546	mm4-dai-link {
547		link-name = "MultiMedia4";
548
549		cpu {
550			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA4>;
551		};
552	};
553
554	mm5-dai-link {
555		link-name = "MultiMedia5";
556
557		cpu {
558			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA5>;
559		};
560	};
561
562	mm6-dai-link {
563		link-name = "MultiMedia6";
564
565		cpu {
566			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA6>;
567		};
568	};
569
570	mm7-dai-link {
571		link-name = "MultiMedia7";
572
573		cpu {
574			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA7>;
575		};
576	};
577
578	mm8-dai-link {
579		link-name = "MultiMedia8";
580
581		cpu {
582			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA8>;
583		};
584	};
585
586	mm9-dai-link {
587		link-name = "MultiMedia9";
588
589		cpu {
590			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA9>;
591		};
592	};
593
594	mm10-dai-link {
595		link-name = "MultiMedia10";
596
597		cpu {
598			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA10>;
599		};
600	};
601
602	mm11-dai-link {
603		link-name = "MultiMedia11";
604
605		cpu {
606			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA11>;
607		};
608	};
609
610	mm12-dai-link {
611		link-name = "MultiMedia12";
612
613		cpu {
614			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA12>;
615		};
616	};
617
618	mm13-dai-link {
619		link-name = "MultiMedia13";
620
621		cpu {
622			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA13>;
623		};
624	};
625
626	mm14-dai-link {
627		link-name = "MultiMedia14";
628
629		cpu {
630			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA14>;
631		};
632	};
633
634	mm15-dai-link {
635		link-name = "MultiMedia15";
636
637		cpu {
638			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA15>;
639		};
640	};
641
642	mm16-dai-link {
643		link-name = "MultiMedia16";
644
645		cpu {
646			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA16>;
647		};
648	};
649
650	slim-dai-link {
651		link-name = "SLIM Playback";
652
653		cpu {
654			sound-dai = <&q6afedai SLIMBUS_6_RX>;
655		};
656
657		platform {
658			sound-dai = <&q6routing>;
659		};
660
661		codec {
662			sound-dai = <&wcd9335 AIF4_PB>;
663		};
664	};
665
666	slimcap-dai-link {
667		link-name = "SLIM Capture";
668
669		cpu {
670			sound-dai = <&q6afedai SLIMBUS_0_TX>;
671		};
672
673		platform {
674			sound-dai = <&q6routing>;
675		};
676
677		codec {
678			sound-dai = <&wcd9335 AIF1_CAP>;
679		};
680	};
681
682	speaker-dai-link {
683		link-name = "Speaker";
684
685		cpu {
686			sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
687		};
688
689		codec {
690			sound-dai = <&tfa9890_amp>;
691		};
692	};
693};
694
695&tlmm {
696	gpio-reserved-ranges = <81 4>;
697
698	mdss_dsi_active: mdss-dsi-active-state {
699		pins = "gpio8";
700		function = "gpio";
701		drive-strength = <8>;
702		bias-disable;
703	};
704
705	mdss_dsi_suspend: mdss-dsi-suspend-state {
706		pins = "gpio8";
707		function = "gpio";
708		drive-strength = <2>;
709		bias-pull-down;
710	};
711
712	mdss_te_active: mdss-te-active-state {
713		pins = "gpio10";
714		function = "mdp_vsync";
715		drive-strength = <2>;
716		bias-pull-down;
717	};
718
719	mdss_te_suspend: mdss-te-suspend-state {
720		pins = "gpio10";
721		function = "mdp_vsync";
722		drive-strength = <2>;
723		bias-pull-down;
724	};
725
726	touch_default: touch-default-state {
727		pins = "gpio89", "gpio125", "gpio49";
728		function = "gpio";
729		drive-strength = <16>;
730		bias-pull-up;
731	};
732
733	touch_suspend: touch-suspend-state {
734		pins = "gpio89", "gpio125", "gpio49";
735		function = "gpio";
736		drive-strength = <2>;
737		bias-disable;
738	};
739};
740
741&ufsphy {
742	vdda-phy-supply = <&vreg_l28a_0p925>;
743	vdda-pll-supply = <&vreg_l12a_1p8>;
744	vddp-ref-clk-supply = <&vreg_l25a_1p2>;
745
746	status = "okay";
747};
748
749&ufshc {
750	vcc-supply = <&vreg_l20a_2p95>;
751	vccq-supply = <&vreg_l25a_1p2>;
752	vccq2-supply = <&vreg_s4a_1p8>;
753
754	vcc-max-microamp = <600000>;
755	vccq-max-microamp = <450000>;
756	vccq2-max-microamp = <450000>;
757
758	status = "okay";
759};
760
761&usb3 {
762	status = "okay";
763};
764
765&usb3_dwc3 {
766	phys = <&hsusb_phy1>;
767	phy-names = "usb2-phy";
768
769	maximum-speed = "high-speed";
770};
771
772&venus {
773	status = "okay";
774};
775
776&wcd9335 {
777	clock-names = "mclk", "slimbus";
778	clocks = <&div1_mclk>,
779		 <&rpmcc RPM_SMD_BB_CLK1>;
780
781	vdd-buck-supply = <&vreg_s4a_1p8>;
782	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
783	vdd-tx-supply = <&vreg_s4a_1p8>;
784	vdd-rx-supply = <&vreg_s4a_1p8>;
785	vdd-io-supply = <&vreg_s4a_1p8>;
786};
787