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&gcc {
377	protected-clocks = <GCC_QSPI_CORE_CLK>,
378				<GCC_QSPI_CORE_CLK_SRC>,
379				<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
380				<GCC_LPASS_Q6_AXI_CLK>,
381				<GCC_LPASS_SWAY_CLK>;
382};
383
384&gmu {
385	status = "okay";
386};
387
388&gpi_dma0 {
389	status = "okay";
390};
391
392&gpi_dma1 {
393	status = "okay";
394};
395
396&gpu {
397	status = "okay";
398
399	zap-shader {
400		memory-region = <&gpu_mem>;
401		firmware-name = "qcom/sdm845/polaris/a630_zap.mbn";
402	};
403};
404
405&ibb {
406	regulator-min-microvolt = <4600000>;
407	regulator-max-microvolt = <6000000>;
408	regulator-over-current-protection;
409	regulator-pull-down;
410	regulator-soft-start;
411	qcom,discharge-resistor-kohms = <300>;
412};
413
414&ipa {
415	qcom,gsi-loader = "self";
416	memory-region = <&ipa_fw_mem>;
417	firmware-name = "qcom/sdm845/polaris/ipa_fws.mbn";
418	status = "okay";
419};
420
421&i2c14 {
422	clock-frequency = <400000>;
423	status = "okay";
424
425	touchscreen@20 {
426		compatible = "syna,rmi4-i2c";
427		reg = <0x20>;
428		#address-cells = <1>;
429		#size-cells = <0>;
430		interrupts-extended = <&tlmm 125 0x2008>;
431
432		pinctrl-names = "default", "sleep";
433		pinctrl-0 = <&ts_int_default &ts_reset_default>;
434		pinctrl-1 = <&ts_int_sleep &ts_reset_sleep>;
435
436		vdd-supply = <&vreg_l28a_3p0>;
437		vio-supply = <&vreg_tp_vddio>;
438
439		syna,startup-delay-ms = <0xc8>;
440		syna,reset-delay-ms = <0xc8>;
441
442		rmi4-f01@1 {
443			syna,nosleep-mode = <0x1>;
444			reg = <0x1>;
445		};
446
447		rmi4-f12@12 {
448			reg = <0x12>;
449			syna,rezero-wait-ms = <0xc8>;
450			syna,clip-x-high = <0x438>;
451			syna,clip-y-high = <0x870>;
452			syna,sensor-type = <0x1>;
453			syna,clip-x-low = <0x0>;
454			syna,clip-y-low = <0x0>;
455		};
456	};
457};
458
459&lab {
460	regulator-min-microvolt = <4600000>;
461	regulator-max-microvolt = <6000000>;
462	regulator-soft-start;
463	regulator-pull-down;
464};
465
466&mdss {
467	status = "okay";
468};
469
470&mdss_dsi0 {
471	vdda-supply = <&vdda_mipi_dsi0_1p2>;
472	status = "okay";
473
474	display_panel: panel@0 {
475		compatible = "jdi,fhd-nt35596s";
476		#address-cells = <1>;
477		#size-cells = <0>;
478		reg = <0>;
479
480		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
481		vddio-supply = <&vreg_l14a_1p8>;
482		backlight = <&pmi8998_wled>;
483		vddpos-supply = <&lab>;
484		vddneg-supply = <&ibb>;
485
486		pinctrl-names = "default", "sleep";
487		pinctrl-0 = <&sde_dsi_active>;
488		pinctrl-1 = <&sde_dsi_suspend>;
489
490		port {
491			panel_in: endpoint {
492				remote-endpoint = <&mdss_dsi0_out>;
493			};
494		};
495	};
496};
497
498&mdss_dsi0_out {
499	remote-endpoint = <&panel_in>;
500	data-lanes = <0 1 2 3>;
501};
502
503&mdss_dsi0_phy {
504	vdds-supply = <&vdda_mipi_dsi0_pll>;
505	status = "okay";
506};
507
508&mss_pil {
509	firmware-name = "qcom/sdm845/polaris/mba.mbn", "qcom/sdm845/polaris/modem.mbn";
510	status = "okay";
511};
512
513&pmi8998_wled {
514	qcom,current-limit-microamp = <20000>;
515	qcom,current-boost-limit = <970>;
516	qcom,ovp-millivolt = <19600>;
517	qcom,switching-freq = <600>;
518	qcom,num-strings = <4>;
519	qcom,cabc;
520
521	status = "okay";
522};
523
524&pm8998_gpios {
525	volume_up_gpio: pm8998-gpio6-state {
526		pinconf {
527			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
528			function = "normal";
529			pins = "gpio6";
530			input-enable;
531			bias-pull-up;
532		};
533	};
534};
535
536&pm8998_resin {
537	linux,code = <KEY_VOLUMEDOWN>;
538	status = "okay";
539};
540
541&q6afedai {
542	dai@22 {
543		reg = <QUATERNARY_MI2S_RX>;
544		qcom,sd-lines = <0>;
545	};
546};
547
548&q6asmdai {
549	dai@0 {
550		reg = <0>;
551	};
552
553	dai@1 {
554		reg = <1>;
555	};
556
557	dai@2 {
558		reg = <2>;
559	};
560};
561
562&qupv3_id_0 {
563	status = "okay";
564};
565
566&qupv3_id_1 {
567	status = "okay";
568};
569
570&qup_i2c14_default {
571	drive-strength = <2>;
572	bias-disable;
573};
574
575&tlmm {
576	gpio-reserved-ranges = <0 4>, <81 4>;
577
578	ts_reset_default: ts-reset-default-state {
579		pins = "gpio99";
580		function = "gpio";
581		drive-strength = <16>;
582		output-high;
583	};
584
585	ts_int_default: ts-int-default-state {
586		pins = "gpio125";
587		function = "gpio";
588		bias-pull-down;
589		drive-strength = <16>;
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	};
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
621&uart6 {
622	status = "okay";
623
624	pinctrl-0 = <&qup_uart6_4pin>;
625
626	bluetooth {
627		compatible = "qcom,wcn3990-bt";
628
629		/* This path is relative to the qca/ subdir under lib/firmware. */
630		firmware-name = "polaris/crnv21.bin";
631
632		vddio-supply = <&vreg_s4a_1p8>;
633		vddxo-supply = <&vreg_l7a_1p8>;
634		vddrf-supply = <&vreg_l17a_1p3>;
635		vddch0-supply = <&vreg_l25a_3p3>;
636		max-speed = <3200000>;
637	};
638};
639
640&usb_1 {
641	/* We'll use this as USB 2.0 only */
642	qcom,select-utmi-as-pipe-clk;
643	status = "okay";
644};
645
646&usb_1_dwc3 {
647	dr_mode = "peripheral";
648
649	/* Fastest mode for USB 2 */
650	maximum-speed = "high-speed";
651
652	/* Remove USB3 phy */
653	phys = <&usb_1_hsphy>;
654	phy-names = "usb2-phy";
655};
656
657&usb_1_hsphy {
658	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
659	vdda-pll-supply = <&vreg_l12a_1p8>;
660	vdd-supply = <&vreg_l1a_0p875>;
661
662	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
663	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
664	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
665	qcom,imp-res-offset-value = <8>;
666
667	status = "okay";
668};
669
670&usb_1_qmpphy {
671	vdda-pll-supply = <&vreg_l1a_0p875>;
672	vdda-phy-supply = <&vreg_l26a_1p2>;
673	status = "okay";
674};
675
676&ufs_mem_hc {
677	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
678	vcc-supply = <&vreg_l20a_2p95>;
679	vcc-max-microamp = <800000>;
680	status = "okay";
681};
682
683&ufs_mem_phy {
684	vdda-phy-supply = <&vdda_ufs1_core>;
685	vdda-pll-supply = <&vdda_ufs1_1p2>;
686	status = "okay";
687};
688
689&venus {
690	firmware-name = "qcom/sdm845/polaris/venus.mbn";
691	status = "okay";
692};
693
694&wcd9340 {
695	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
696	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
697	vdd-buck-supply = <&vreg_s4a_1p8>;
698	vdd-tx-supply = <&vreg_s4a_1p8>;
699	vdd-rx-supply = <&vreg_s4a_1p8>;
700	vdd-io-supply = <&vreg_s4a_1p8>;
701
702	qcom,micbias1-microvolt = <2700000>;
703	qcom,micbias2-microvolt = <1800000>;
704	qcom,micbias3-microvolt = <2700000>;
705	qcom,micbias4-microvolt = <2700000>;
706};
707
708&wifi {
709	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
710	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
711	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
712	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
713	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
714	status = "okay";
715};
716