1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Xilin Wu <strongtz@yeah.net>
4 * Copyright (c) 2022, Molly Sophia <mollysophia379@gmail.com>
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
11#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
12#include <dt-bindings/input/linux-event-codes.h>
13#include <dt-bindings/sound/qcom,q6afe.h>
14#include <dt-bindings/sound/qcom,q6asm.h>
15#include "sdm845.dtsi"
16#include "sdm845-wcd9340.dtsi"
17#include "pm8998.dtsi"
18#include "pmi8998.dtsi"
19#include "pm8005.dtsi"
20
21/*
22 * Delete following upstream (sdm845.dtsi) reserved
23 * memory mappings which are different in this device.
24 */
25/delete-node/ &rmtfs_mem;
26/delete-node/ &adsp_mem;
27/delete-node/ &wlan_msa_mem;
28/delete-node/ &mpss_region;
29/delete-node/ &venus_mem;
30/delete-node/ &cdsp_mem;
31/delete-node/ &mba_region;
32/delete-node/ &slpi_mem;
33/delete-node/ &spss_mem;
34
35/ {
36	model = "Xiaomi Mi MIX 2S";
37	compatible = "xiaomi,polaris", "qcom,sdm845";
38	chassis-type = "handset";
39
40	/* required for bootloader to select correct board */
41	qcom,msm-id = <0x141 0x20001>;
42	qcom,board-id = <0x2a 0x0>;
43
44	aliases {
45		serial0 = &uart9;
46		serial1 = &uart6;
47	};
48
49	gpio-keys {
50		compatible = "gpio-keys";
51		autorepeat;
52
53		pinctrl-names = "default";
54		pinctrl-0 = <&volume_up_gpio>;
55
56		key-vol-up {
57			label = "Volume Up";
58			linux,code = <KEY_VOLUMEUP>;
59			gpios = <&pm8998_gpios 6 GPIO_ACTIVE_LOW>;
60			debounce-interval = <15>;
61		};
62	};
63
64	reserved-memory {
65		adsp_mem: memory@8c500000 {
66			reg = <0 0x8c500000 0 0x1e00000>;
67			no-map;
68		};
69
70		wlan_msa_mem: memory@8e300000 {
71			reg = <0 0x8e300000 0 0x100000>;
72			no-map;
73		};
74
75		mpss_region: memory@8e400000 {
76			reg = <0 0x8e400000 0 0x7800000>;
77			no-map;
78		};
79
80		venus_mem: memory@95c00000 {
81			reg = <0 0x95c00000 0 0x500000>;
82			no-map;
83		};
84
85		cdsp_mem: memory@96100000 {
86			reg = <0 0x96100000 0 0x800000>;
87			no-map;
88		};
89
90		mba_region: memory@96900000 {
91			reg = <0 0x96900000 0 0x200000>;
92			no-map;
93		};
94
95		slpi_mem: memory@96b00000 {
96			reg = <0 0x96b00000 0 0x1400000>;
97			no-map;
98		};
99
100		spss_mem: memory@97f00000 {
101			reg = <0 0x97f00000 0 0x100000>;
102			no-map;
103		};
104
105		rmtfs_mem: memory@f6301000 {
106			compatible = "qcom,rmtfs-mem";
107			reg = <0 0xf6301000 0 0x200000>;
108			no-map;
109
110			qcom,client-id = <1>;
111			qcom,vmid = <15>;
112		};
113	};
114
115	battery: battery {
116		compatible = "simple-battery";
117
118		charge-full-design-microamp-hours = <3400000>;
119		voltage-min-design-microvolt = <3400000>;
120		voltage-max-design-microvolt = <4400000>;
121	};
122
123	vreg_tp_vddio: vreg-tp-vddio {
124		compatible = "regulator-fixed";
125		regulator-name = "vreg_tp_vddio";
126
127		regulator-min-microvolt = <1800000>;
128		regulator-max-microvolt = <1800000>;
129
130		gpio = <&tlmm 23 GPIO_ACTIVE_HIGH>;
131		regulator-always-on;
132		regulator-boot-on;
133		enable-active-high;
134	};
135
136	vreg_s4a_1p8: vreg-s4a-1p8 {
137		compatible = "regulator-fixed";
138		regulator-name = "vreg_s4a_1p8";
139
140		regulator-min-microvolt = <1800000>;
141		regulator-max-microvolt = <1800000>;
142		regulator-always-on;
143	};
144};
145
146&apps_rsc {
147	regulators-0 {
148		compatible = "qcom,pm8998-rpmh-regulators";
149		qcom,pmic-id = "a";
150
151		vreg_s2a_1p1: smps2 {
152			regulator-min-microvolt = <1100000>;
153			regulator-max-microvolt = <1100000>;
154		};
155
156		vreg_s3a_1p35: smps3 {
157			regulator-min-microvolt = <1352000>;
158			regulator-max-microvolt = <1352000>;
159		};
160
161		vreg_s5a_2p04: smps5 {
162			regulator-min-microvolt = <1904000>;
163			regulator-max-microvolt = <2040000>;
164		};
165
166		vreg_s7a_1p025: smps7 {
167			regulator-min-microvolt = <900000>;
168			regulator-max-microvolt = <1028000>;
169		};
170
171		vdda_mipi_dsi0_pll:
172		vdda_ufs1_core:
173		vreg_l1a_0p875: ldo1 {
174			regulator-min-microvolt = <880000>;
175			regulator-max-microvolt = <880000>;
176			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
177		};
178
179		vreg_l2a_1p2: ldo2 {
180			regulator-min-microvolt = <1200000>;
181			regulator-max-microvolt = <1200000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183			regulator-always-on;
184		};
185
186		vreg_l3a_1p0: ldo3 {
187			regulator-min-microvolt = <1000000>;
188			regulator-max-microvolt = <1000000>;
189			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
190		};
191
192		vreg_l5a_0p8: ldo5 {
193			regulator-min-microvolt = <800000>;
194			regulator-max-microvolt = <800000>;
195			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
196		};
197
198		vreg_l6a_1p8: ldo6 {
199			regulator-min-microvolt = <1856000>;
200			regulator-max-microvolt = <1856000>;
201			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
202		};
203
204		vreg_l7a_1p8: ldo7 {
205			regulator-min-microvolt = <1800000>;
206			regulator-max-microvolt = <1800000>;
207			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
208		};
209
210		vreg_l8a_1p2: ldo8 {
211			regulator-min-microvolt = <1200000>;
212			regulator-max-microvolt = <1248000>;
213			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
214		};
215
216		vreg_l9a_1p8: ldo9 {
217			regulator-min-microvolt = <1704000>;
218			regulator-max-microvolt = <2928000>;
219			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
220		};
221
222		vreg_l10a_2p95: ldo10 {
223			regulator-min-microvolt = <1704000>;
224			regulator-max-microvolt = <2928000>;
225			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
226		};
227
228		vreg_l11a_1p05: ldo11 {
229			regulator-min-microvolt = <1000000>;
230			regulator-max-microvolt = <1048000>;
231			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
232		};
233
234		vreg_l12a_1p8: ldo12 {
235			regulator-min-microvolt = <1800000>;
236			regulator-max-microvolt = <1800000>;
237			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
238		};
239
240		vreg_l13a_2p95: ldo13 {
241			regulator-min-microvolt = <1800000>;
242			regulator-max-microvolt = <2960000>;
243			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
244		};
245
246		vreg_l14a_1p8: ldo14 {
247			regulator-min-microvolt = <1800000>;
248			regulator-max-microvolt = <1880000>;
249			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
250			regulator-always-on;
251		};
252
253		vreg_l15a_1p8: ldo15 {
254			regulator-min-microvolt = <1800000>;
255			regulator-max-microvolt = <1800000>;
256			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
257		};
258
259		vreg_l16a_2p7: ldo16 {
260			regulator-min-microvolt = <2704000>;
261			regulator-max-microvolt = <2704000>;
262			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
263		};
264
265		vreg_l17a_1p3: ldo17 {
266			regulator-min-microvolt = <1304000>;
267			regulator-max-microvolt = <1304000>;
268			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
269			regulator-always-on;
270		};
271
272		vreg_l18a_2p9: ldo18 {
273			regulator-min-microvolt = <2704000>;
274			regulator-max-microvolt = <2960000>;
275			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
276		};
277
278		vreg_l19a_3p1: ldo19 {
279			regulator-min-microvolt = <2856000>;
280			regulator-max-microvolt = <3104000>;
281			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
282		};
283
284		vreg_l20a_2p95: ldo20 {
285			regulator-min-microvolt = <2704000>;
286			regulator-max-microvolt = <2960000>;
287			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
288		};
289
290		vreg_l21a_2p95: ldo21 {
291			regulator-min-microvolt = <2704000>;
292			regulator-max-microvolt = <2960000>;
293			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
294		};
295
296		vreg_l22a_3p3: ldo22 {
297			regulator-min-microvolt = <2864000>;
298			regulator-max-microvolt = <3312000>;
299			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
300		};
301
302		vreg_l23a_3p3: ldo23 {
303			regulator-min-microvolt = <3000000>;
304			regulator-max-microvolt = <3312000>;
305			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
306		};
307
308		vreg_l24a_3p075: ldo24 {
309			regulator-min-microvolt = <3088000>;
310			regulator-max-microvolt = <3088000>;
311			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
312		};
313
314		vreg_l25a_3p3: ldo25 {
315			regulator-min-microvolt = <3000000>;
316			regulator-max-microvolt = <3312000>;
317			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
318			regulator-always-on;
319		};
320
321		vdda_mipi_dsi0_1p2:
322		vdda_ufs1_1p2:
323		vreg_l26a_1p2: ldo26 {
324			regulator-min-microvolt = <1200000>;
325			regulator-max-microvolt = <1200000>;
326			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
327		};
328
329		vreg_l28a_3p0: ldo28 {
330			regulator-min-microvolt = <2856000>;
331			regulator-max-microvolt = <3008000>;
332			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
333			regulator-always-on;
334		};
335
336		vreg_lvs1a_1p8: lvs1 {
337			regulator-min-microvolt = <1800000>;
338			regulator-max-microvolt = <1800000>;
339		};
340
341		vreg_lvs2a_1p8: lvs2 {
342			regulator-min-microvolt = <1800000>;
343			regulator-max-microvolt = <1800000>;
344		};
345	};
346
347	regulators-1 {
348		compatible = "qcom,pmi8998-rpmh-regulators";
349		qcom,pmic-id = "b";
350
351		vreg_bob: bob {
352			regulator-min-microvolt = <3312000>;
353			regulator-max-microvolt = <3600000>;
354			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
355			regulator-allow-bypass;
356		};
357	};
358
359	regulators-2 {
360		compatible = "qcom,pm8005-rpmh-regulators";
361		qcom,pmic-id = "c";
362
363		vreg_smp3c_0p6: smps3 {
364			regulator-min-microvolt = <600000>;
365			regulator-max-microvolt = <600000>;
366			regulator-always-on;
367		};
368	};
369};
370
371&cdsp_pas {
372	firmware-name = "qcom/sdm845/polaris/cdsp.mbn";
373	status = "okay";
374};
375
376&dsi0 {
377	vdda-supply = <&vdda_mipi_dsi0_1p2>;
378	status = "okay";
379
380	display_panel: panel@0 {
381		compatible = "jdi,fhd-nt35596s";
382		#address-cells = <1>;
383		#size-cells = <0>;
384		reg = <0>;
385
386		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
387		vddio-supply = <&vreg_l14a_1p8>;
388		backlight = <&pmi8998_wled>;
389		vddpos-supply = <&lab>;
390		vddneg-supply = <&ibb>;
391
392		pinctrl-names = "default", "sleep";
393		pinctrl-0 = <&sde_dsi_active>;
394		pinctrl-1 = <&sde_dsi_suspend>;
395
396		port {
397			panel_in: endpoint {
398				remote-endpoint = <&dsi0_out>;
399			};
400		};
401	};
402};
403
404&dsi0_out {
405	remote-endpoint = <&panel_in>;
406	data-lanes = <0 1 2 3>;
407};
408
409&dsi0_phy {
410	vdds-supply = <&vdda_mipi_dsi0_pll>;
411	status = "okay";
412};
413
414&gcc {
415	protected-clocks = <GCC_QSPI_CORE_CLK>,
416				<GCC_QSPI_CORE_CLK_SRC>,
417				<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
418				<GCC_LPASS_Q6_AXI_CLK>,
419				<GCC_LPASS_SWAY_CLK>;
420};
421
422&gmu {
423	status = "okay";
424};
425
426&gpi_dma0 {
427	status = "okay";
428};
429
430&gpi_dma1 {
431	status = "okay";
432};
433
434&gpu {
435	status = "okay";
436
437	zap-shader {
438		memory-region = <&gpu_mem>;
439		firmware-name = "qcom/sdm845/polaris/a630_zap.mbn";
440	};
441};
442
443&ibb {
444	regulator-min-microvolt = <4600000>;
445	regulator-max-microvolt = <6000000>;
446	regulator-over-current-protection;
447	regulator-pull-down;
448	regulator-soft-start;
449	qcom,discharge-resistor-kohms = <300>;
450};
451
452&ipa {
453	qcom,gsi-loader = "self";
454	memory-region = <&ipa_fw_mem>;
455	firmware-name = "qcom/sdm845/polaris/ipa_fws.mbn";
456	status = "okay";
457};
458
459&i2c14 {
460	clock-frequency = <400000>;
461	status = "okay";
462
463	touchscreen@20 {
464		compatible = "syna,rmi4-i2c";
465		reg = <0x20>;
466		#address-cells = <1>;
467		#size-cells = <0>;
468		interrupts-extended = <&tlmm 125 0x2008>;
469
470		pinctrl-names = "default", "sleep";
471		pinctrl-0 = <&ts_int_default &ts_reset_default>;
472		pinctrl-1 = <&ts_int_sleep &ts_reset_sleep>;
473
474		vdd-supply = <&vreg_l28a_3p0>;
475		vio-supply = <&vreg_tp_vddio>;
476
477		syna,startup-delay-ms = <0xc8>;
478		syna,reset-delay-ms = <0xc8>;
479
480		rmi4-f01@1 {
481			syna,nosleep-mode = <0x1>;
482			reg = <0x1>;
483		};
484
485		rmi4-f12@12 {
486			syna,rezero-wait-ms = <0xc8>;
487			syna,clip-x-high = <0x438>;
488			syna,clip-y-high = <0x870>;
489			syna,sensor-type = <0x1>;
490			syna,clip-x-low = <0x0>;
491			syna,clip-y-low = <0x0>;
492		};
493	};
494};
495
496&lab {
497	regulator-min-microvolt = <4600000>;
498	regulator-max-microvolt = <6000000>;
499	regulator-soft-start;
500	regulator-pull-down;
501};
502
503&mdss {
504	status = "okay";
505};
506
507&mss_pil {
508	firmware-name = "qcom/sdm845/polaris/mba.mbn", "qcom/sdm845/polaris/modem.mbn";
509	status = "okay";
510};
511
512&pmi8998_wled {
513	qcom,current-limit-microamp = <20000>;
514	qcom,current-boost-limit = <970>;
515	qcom,ovp-millivolt = <19600>;
516	qcom,switching-freq = <600>;
517	qcom,num-strings = <4>;
518	qcom,cabc;
519
520	status = "okay";
521};
522
523&pm8998_gpios {
524	volume_up_gpio: pm8998-gpio6-state {
525		pinconf {
526			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
527			function = "normal";
528			pins = "gpio6";
529			input-enable;
530			bias-pull-up;
531		};
532	};
533};
534
535&pm8998_resin {
536	linux,code = <KEY_VOLUMEDOWN>;
537	status = "okay";
538};
539
540&q6afedai {
541	dai@22 {
542		reg = <QUATERNARY_MI2S_RX>;
543		qcom,sd-lines = <0>;
544	};
545};
546
547&q6asmdai {
548	dai@0 {
549		reg = <0>;
550	};
551
552	dai@1 {
553		reg = <1>;
554	};
555
556	dai@2 {
557		reg = <2>;
558	};
559};
560
561&qupv3_id_0 {
562	status = "okay";
563};
564
565&qupv3_id_1 {
566	status = "okay";
567};
568
569&qup_i2c14_default {
570	drive-strength = <2>;
571	bias-disable;
572};
573
574&tlmm {
575	gpio-reserved-ranges = <0 4>, <81 4>;
576
577	ts_reset_default: ts-reset-default-state {
578		pins = "gpio99";
579		function = "gpio";
580		drive-strength = <16>;
581		output-high;
582	};
583
584	ts_int_default: ts-int-default-state {
585		pins = "gpio125";
586		function = "gpio";
587		bias-pull-down;
588		drive-strength = <16>;
589		input-enable;
590	};
591
592	ts_reset_sleep: ts-reset-sleep-state {
593		pins = "gpio99";
594		function = "gpio";
595		bias-disable;
596		drive-strength = <2>;
597	};
598
599	ts_int_sleep: ts-int-sleep-state {
600		pins = "gpio125";
601		function = "gpio";
602		bias-pull-down;
603		drive-strength = <2>;
604		input-enable;
605	};
606
607	sde_dsi_active: sde-dsi-active-state {
608		pins = "gpio6", "gpio10";
609		function = "gpio";
610		drive-strength = <8>;
611		bias-disable;
612	};
613
614	sde_dsi_suspend: sde-dsi-suspend-state {
615		pins = "gpio6", "gpio10";
616		function = "gpio";
617		drive-strength = <2>;
618		bias-pull-down;
619	};
620};
621
622&uart6 {
623	status = "okay";
624
625	pinctrl-0 = <&qup_uart6_4pin>;
626
627	bluetooth {
628		compatible = "qcom,wcn3990-bt";
629
630		/* This path is relative to the qca/ subdir under lib/firmware. */
631		firmware-name = "polaris/crnv21.bin";
632
633		vddio-supply = <&vreg_s4a_1p8>;
634		vddxo-supply = <&vreg_l7a_1p8>;
635		vddrf-supply = <&vreg_l17a_1p3>;
636		vddch0-supply = <&vreg_l25a_3p3>;
637		max-speed = <3200000>;
638	};
639};
640
641&usb_1 {
642	/* We'll use this as USB 2.0 only */
643	qcom,select-utmi-as-pipe-clk;
644	status = "okay";
645};
646
647&usb_1_dwc3 {
648	dr_mode = "peripheral";
649
650	/* Fastest mode for USB 2 */
651	maximum-speed = "high-speed";
652
653	/* Remove USB3 phy */
654	phys = <&usb_1_hsphy>;
655	phy-names = "usb2-phy";
656};
657
658&usb_1_hsphy {
659	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
660	vdda-pll-supply = <&vreg_l12a_1p8>;
661	vdd-supply = <&vreg_l1a_0p875>;
662
663	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
664	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
665	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
666	qcom,imp-res-offset-value = <8>;
667
668	status = "okay";
669};
670
671&usb_1_qmpphy {
672	vdda-pll-supply = <&vreg_l1a_0p875>;
673	vdda-phy-supply = <&vreg_l26a_1p2>;
674	status = "okay";
675};
676
677&ufs_mem_hc {
678	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
679	vcc-supply = <&vreg_l20a_2p95>;
680	vcc-max-microamp = <800000>;
681	status = "okay";
682};
683
684&ufs_mem_phy {
685	vdda-phy-supply = <&vdda_ufs1_core>;
686	vdda-pll-supply = <&vdda_ufs1_1p2>;
687	status = "okay";
688};
689
690&venus {
691	firmware-name = "qcom/sdm845/polaris/venus.mbn";
692	status = "okay";
693};
694
695&wcd9340 {
696	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
697	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
698	vdd-buck-supply = <&vreg_s4a_1p8>;
699	vdd-tx-supply = <&vreg_s4a_1p8>;
700	vdd-rx-supply = <&vreg_s4a_1p8>;
701	vdd-io-supply = <&vreg_s4a_1p8>;
702
703	qcom,micbias1-microvolt = <2700000>;
704	qcom,micbias2-microvolt = <1800000>;
705	qcom,micbias3-microvolt = <2700000>;
706	qcom,micbias4-microvolt = <2700000>;
707};
708
709&wifi {
710	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
711	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
712	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
713	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
714	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
715
716	qcom,snoc-host-cap-skip-quirk;
717	status = "okay";
718};
719