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