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