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_gpios 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	qcom,gsi-loader = "self";
453	memory-region = <&ipa_fw_mem>;
454	firmware-name = "qcom/sdm845/polaris/ipa_fws.mbn";
455	status = "okay";
456};
457
458&i2c14 {
459	clock-frequency = <400000>;
460	status = "okay";
461
462	touchscreen@20 {
463		compatible = "syna,rmi4-i2c";
464		reg = <0x20>;
465		#address-cells = <1>;
466		#size-cells = <0>;
467		interrupts-extended = <&tlmm 125 0x2008>;
468
469		pinctrl-names = "default", "sleep";
470		pinctrl-0 = <&ts_int_default &ts_reset_default>;
471		pinctrl-1 = <&ts_int_sleep &ts_reset_sleep>;
472
473		vdd-supply = <&vreg_l28a_3p0>;
474		vio-supply = <&vreg_tp_vddio>;
475
476		syna,startup-delay-ms = <0xc8>;
477		syna,reset-delay-ms = <0xc8>;
478
479		rmi4-f01@1 {
480			syna,nosleep-mode = <0x1>;
481			reg = <0x1>;
482		};
483
484		rmi4-f12@12 {
485			syna,rezero-wait-ms = <0xc8>;
486			syna,clip-x-high = <0x438>;
487			syna,clip-y-high = <0x870>;
488			syna,sensor-type = <0x1>;
489			syna,clip-x-low = <0x0>;
490			syna,clip-y-low = <0x0>;
491		};
492	};
493};
494
495&lab {
496	regulator-min-microvolt = <4600000>;
497	regulator-max-microvolt = <6000000>;
498	regulator-soft-start;
499	regulator-pull-down;
500};
501
502&mdss {
503	status = "okay";
504};
505
506&mss_pil {
507	firmware-name = "qcom/sdm845/polaris/mba.mbn", "qcom/sdm845/polaris/modem.mbn";
508	status = "okay";
509};
510
511&pmi8998_wled {
512	qcom,current-limit-microamp = <20000>;
513	qcom,current-boost-limit = <970>;
514	qcom,ovp-millivolt = <19600>;
515	qcom,switching-freq = <600>;
516	qcom,num-strings = <4>;
517	qcom,cabc;
518
519	status = "okay";
520};
521
522&pm8998_gpios {
523	volume_up_gpio: pm8998-gpio6-state {
524		pinconf {
525			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
526			function = "normal";
527			pins = "gpio6";
528			input-enable;
529			bias-pull-up;
530		};
531	};
532};
533
534&pm8998_resin {
535	linux,code = <KEY_VOLUMEDOWN>;
536	status = "okay";
537};
538
539&q6afedai {
540	dai@22 {
541		reg = <QUATERNARY_MI2S_RX>;
542		qcom,sd-lines = <0>;
543	};
544};
545
546&q6asmdai {
547	dai@0 {
548		reg = <0>;
549	};
550
551	dai@1 {
552		reg = <1>;
553	};
554
555	dai@2 {
556		reg = <2>;
557	};
558};
559
560&qupv3_id_0 {
561	status = "okay";
562};
563
564&qupv3_id_1 {
565	status = "okay";
566};
567
568&qup_i2c14_default {
569	drive-strength = <2>;
570	bias-disable;
571};
572
573&tlmm {
574	gpio-reserved-ranges = <0 4>, <81 4>;
575
576	ts_reset_default: ts-reset-default-state {
577		pins = "gpio99";
578		function = "gpio";
579		drive-strength = <16>;
580		output-high;
581	};
582
583	ts_int_default: ts-int-default-state {
584		pins = "gpio125";
585		function = "gpio";
586		bias-pull-down;
587		drive-strength = <16>;
588		input-enable;
589	};
590
591	ts_reset_sleep: ts-reset-sleep-state {
592		pins = "gpio99";
593		function = "gpio";
594		bias-disable;
595		drive-strength = <2>;
596	};
597
598	ts_int_sleep: ts-int-sleep-state {
599		pins = "gpio125";
600		function = "gpio";
601		bias-pull-down;
602		drive-strength = <2>;
603		input-enable;
604	};
605
606	sde_dsi_active: sde-dsi-active-state {
607		pins = "gpio6", "gpio10";
608		function = "gpio";
609		drive-strength = <8>;
610		bias-disable;
611	};
612
613	sde_dsi_suspend: sde-dsi-suspend-state {
614		pins = "gpio6", "gpio10";
615		function = "gpio";
616		drive-strength = <2>;
617		bias-pull-down;
618	};
619
620	wcd_intr_default: wcd-intr-default-state {
621		pins = "gpio54";
622		function = "gpio";
623		input-enable;
624		bias-pull-down;
625		drive-strength = <2>;
626	};
627};
628
629&uart6 {
630	status = "okay";
631
632	pinctrl-0 = <&qup_uart6_4pin>;
633
634	bluetooth {
635		compatible = "qcom,wcn3990-bt";
636
637		/* This path is relative to the qca/ subdir under lib/firmware. */
638		firmware-name = "polaris/crnv21.bin";
639
640		vddio-supply = <&vreg_s4a_1p8>;
641		vddxo-supply = <&vreg_l7a_1p8>;
642		vddrf-supply = <&vreg_l17a_1p3>;
643		vddch0-supply = <&vreg_l25a_3p3>;
644		max-speed = <3200000>;
645	};
646};
647
648&usb_1 {
649	/* We'll use this as USB 2.0 only */
650	qcom,select-utmi-as-pipe-clk;
651	status = "okay";
652};
653
654&usb_1_dwc3 {
655	dr_mode = "peripheral";
656
657	/* Fastest mode for USB 2 */
658	maximum-speed = "high-speed";
659
660	/* Remove USB3 phy */
661	phys = <&usb_1_hsphy>;
662	phy-names = "usb2-phy";
663};
664
665&usb_1_hsphy {
666	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
667	vdda-pll-supply = <&vreg_l12a_1p8>;
668	vdd-supply = <&vreg_l1a_0p875>;
669
670	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
671	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
672	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
673	qcom,imp-res-offset-value = <8>;
674
675	status = "okay";
676};
677
678&usb_1_qmpphy {
679	vdda-pll-supply = <&vreg_l1a_0p875>;
680	vdda-phy-supply = <&vreg_l26a_1p2>;
681	status = "okay";
682};
683
684&ufs_mem_hc {
685	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
686	vcc-supply = <&vreg_l20a_2p95>;
687	vcc-max-microamp = <800000>;
688	status = "okay";
689};
690
691&ufs_mem_phy {
692	vdda-phy-supply = <&vdda_ufs1_core>;
693	vdda-pll-supply = <&vdda_ufs1_1p2>;
694	status = "okay";
695};
696
697&venus {
698	firmware-name = "qcom/sdm845/polaris/venus.mbn";
699	status = "okay";
700};
701
702&wcd9340 {
703	pinctrl-0 = <&wcd_intr_default>;
704	pinctrl-names = "default";
705	clock-names = "extclk";
706	clocks = <&rpmhcc RPMH_LN_BB_CLK2>;
707	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
708	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
709	vdd-buck-supply = <&vreg_s4a_1p8>;
710	vdd-tx-supply = <&vreg_s4a_1p8>;
711	vdd-rx-supply = <&vreg_s4a_1p8>;
712	vdd-io-supply = <&vreg_s4a_1p8>;
713
714	qcom,micbias1-microvolt = <2700000>;
715	qcom,micbias2-microvolt = <1800000>;
716	qcom,micbias3-microvolt = <2700000>;
717	qcom,micbias4-microvolt = <2700000>;
718};
719
720&wifi {
721	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
722	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
723	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
724	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
725	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
726
727	qcom,snoc-host-cap-skip-quirk;
728	status = "okay";
729};
730