1// SPDX-License-Identifier: GPL-2.0
2
3/dts-v1/;
4
5#include <dt-bindings/leds/common.h>
6#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
7#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
8#include <dt-bindings/sound/qcom,q6afe.h>
9#include <dt-bindings/sound/qcom,q6asm.h>
10#include "sdm845.dtsi"
11#include "sdm845-wcd9340.dtsi"
12#include "pm8998.dtsi"
13#include "pmi8998.dtsi"
14
15/*
16 * Delete following upstream (sdm845.dtsi) reserved
17 * memory mappings which are different in this device.
18 */
19/delete-node/ &tz_mem;
20/delete-node/ &adsp_mem;
21/delete-node/ &wlan_msa_mem;
22/delete-node/ &mpss_region;
23/delete-node/ &venus_mem;
24/delete-node/ &cdsp_mem;
25/delete-node/ &mba_region;
26/delete-node/ &slpi_mem;
27/delete-node/ &spss_mem;
28/delete-node/ &rmtfs_mem;
29
30/ {
31	chassis-type = "handset";
32
33	/* required for bootloader to select correct board */
34	qcom,board-id = <69 0>;
35	qcom,msm-id = <321 0x20001>;
36
37	aliases {
38		serial1 = &uart6;
39	};
40
41	gpio-keys {
42		compatible = "gpio-keys";
43		autorepeat;
44
45		pinctrl-names = "default";
46		pinctrl-0 = <&vol_up_pin_a>;
47
48		key-vol-up {
49			label = "Volume Up";
50			linux,code = <KEY_VOLUMEUP>;
51			gpios = <&pm8998_gpios 6 GPIO_ACTIVE_LOW>;
52		};
53	};
54
55	/* Reserved memory changes from downstream */
56	reserved-memory {
57		tz_mem: memory@86200000 {
58			reg = <0 0x86200000 0 0x4900000>;
59			no-map;
60		};
61
62		adsp_mem: memory@8c500000 {
63			reg = <0 0x8c500000 0 0x1e00000>;
64			no-map;
65		};
66
67		wlan_msa_mem: memory@8e300000 {
68			reg = <0 0x8e300000 0 0x100000>;
69			no-map;
70		};
71
72		mpss_region: memory@8e400000 {
73			reg = <0 0x8e400000 0 0x7800000>;
74			no-map;
75		};
76
77		venus_mem: memory@95c00000 {
78			reg = <0 0x95c00000 0 0x500000>;
79			no-map;
80		};
81
82		cdsp_mem: memory@96100000 {
83			reg = <0 0x96100000 0 0x800000>;
84			no-map;
85		};
86
87		mba_region: memory@96900000 {
88			reg = <0 0x96900000 0 0x200000>;
89			no-map;
90		};
91
92		slpi_mem: memory@96b00000 {
93			reg = <0 0x96b00000 0 0x1400000>;
94			no-map;
95		};
96
97		spss_mem: memory@97f00000 {
98			reg = <0 0x97f00000 0 0x100000>;
99			no-map;
100		};
101
102		/* Cont splash region set up by the bootloader */
103		cont_splash_mem: framebuffer@9d400000 {
104			reg = <0 0x9d400000 0 0x2400000>;
105			no-map;
106		};
107
108		rmtfs_mem: memory@f6301000 {
109			compatible = "qcom,rmtfs-mem";
110			reg = <0 0xf6301000 0 0x200000>;
111			no-map;
112
113			qcom,client-id = <1>;
114			qcom,vmid = <15>;
115		};
116	};
117
118	battery: battery {
119		compatible = "simple-battery";
120
121		charge-full-design-microamp-hours = <4000000>;
122		voltage-min-design-microvolt = <3400000>;
123		voltage-max-design-microvolt = <4400000>;
124	};
125
126	vreg_s4a_1p8: vreg-s4a-1p8 {
127		compatible = "regulator-fixed";
128		regulator-name = "vreg_s4a_1p8";
129
130		regulator-min-microvolt = <1800000>;
131		regulator-max-microvolt = <1800000>;
132		regulator-always-on;
133	};
134};
135
136&adsp_pas {
137	status = "okay";
138	firmware-name = "qcom/sdm845/beryllium/adsp.mbn";
139};
140
141&apps_rsc {
142	regulators-0 {
143		compatible = "qcom,pm8998-rpmh-regulators";
144		qcom,pmic-id = "a";
145
146		vreg_l1a_0p875: ldo1 {
147			regulator-min-microvolt = <880000>;
148			regulator-max-microvolt = <880000>;
149			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
150		};
151
152		vreg_l5a_0p8: ldo5 {
153			regulator-min-microvolt = <800000>;
154			regulator-max-microvolt = <800000>;
155			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
156		};
157
158		vreg_l7a_1p8: ldo7 {
159			regulator-min-microvolt = <1800000>;
160			regulator-max-microvolt = <1800000>;
161			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
162		};
163
164		vreg_l12a_1p8: ldo12 {
165			regulator-min-microvolt = <1800000>;
166			regulator-max-microvolt = <1800000>;
167			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
168		};
169
170		vreg_l13a_2p95: ldo13 {
171			regulator-min-microvolt = <1800000>;
172			regulator-max-microvolt = <2960000>;
173			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
174		};
175
176		vreg_l14a_1p8: ldo14 {
177			regulator-min-microvolt = <1800000>;
178			regulator-max-microvolt = <1800000>;
179			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
180			regulator-boot-on;
181			regulator-always-on;
182		};
183
184		vreg_l17a_1p3: ldo17 {
185			regulator-min-microvolt = <1304000>;
186			regulator-max-microvolt = <1304000>;
187			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
188		};
189
190		vreg_l20a_2p95: ldo20 {
191			regulator-min-microvolt = <2960000>;
192			regulator-max-microvolt = <2968000>;
193			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
194		};
195
196		vreg_l21a_2p95: ldo21 {
197			regulator-min-microvolt = <2960000>;
198			regulator-max-microvolt = <2968000>;
199			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
200		};
201
202		vreg_l23a_3p3: ldo23 {
203			regulator-min-microvolt = <3300000>;
204			regulator-max-microvolt = <3312000>;
205			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
206		};
207
208		vreg_l24a_3p075: ldo24 {
209			regulator-min-microvolt = <3088000>;
210			regulator-max-microvolt = <3088000>;
211			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
212		};
213
214		vreg_l25a_3p3: ldo25 {
215			regulator-min-microvolt = <3300000>;
216			regulator-max-microvolt = <3312000>;
217			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
218		};
219
220		vreg_l26a_1p2: ldo26 {
221			regulator-min-microvolt = <1200000>;
222			regulator-max-microvolt = <1200000>;
223			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
224			regulator-boot-on;
225		};
226	};
227};
228
229&cdsp_pas {
230	status = "okay";
231	firmware-name = "qcom/sdm845/beryllium/cdsp.mbn";
232};
233
234&gcc {
235	protected-clocks = <GCC_QSPI_CORE_CLK>,
236			   <GCC_QSPI_CORE_CLK_SRC>,
237			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
238			   <GCC_LPASS_Q6_AXI_CLK>,
239			   <GCC_LPASS_SWAY_CLK>;
240};
241
242&gmu {
243	status = "okay";
244};
245
246&gpu {
247	status = "okay";
248
249	zap-shader {
250		memory-region = <&gpu_mem>;
251		firmware-name = "qcom/sdm845/beryllium/a630_zap.mbn";
252	};
253};
254
255&ibb {
256	regulator-min-microvolt = <4600000>;
257	regulator-max-microvolt = <6000000>;
258	regulator-over-current-protection;
259	regulator-pull-down;
260	regulator-soft-start;
261	qcom,discharge-resistor-kohms = <300>;
262};
263
264&lab {
265	regulator-min-microvolt = <4600000>;
266	regulator-max-microvolt = <6000000>;
267	regulator-over-current-protection;
268	regulator-pull-down;
269	regulator-soft-start;
270};
271
272&mdss {
273	status = "okay";
274};
275
276&mdss_dsi0 {
277	status = "okay";
278	vdda-supply = <&vreg_l26a_1p2>;
279
280	display_panel: panel@0 {
281		reg = <0>;
282		vddio-supply = <&vreg_l14a_1p8>;
283		vddpos-supply = <&lab>;
284		vddneg-supply = <&ibb>;
285
286		backlight = <&pmi8998_wled>;
287		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
288
289		status = "disabled";
290
291		port {
292			panel_in_0: endpoint {
293				remote-endpoint = <&mdss_dsi0_out>;
294			};
295		};
296	};
297};
298
299&mdss_dsi0_out {
300	remote-endpoint = <&panel_in_0>;
301	data-lanes = <0 1 2 3>;
302};
303
304&mdss_dsi0_phy {
305	status = "okay";
306	vdds-supply = <&vreg_l1a_0p875>;
307};
308
309&mss_pil {
310	status = "okay";
311	firmware-name = "qcom/sdm845/beryllium/mba.mbn", "qcom/sdm845/beryllium/modem.mbn";
312};
313
314&ipa {
315	qcom,gsi-loader = "self";
316	memory-region = <&ipa_fw_mem>;
317	firmware-name = "qcom/sdm845/beryllium/ipa_fws.mbn";
318	status = "okay";
319};
320
321&pm8998_gpios {
322	vol_up_pin_a: vol-up-active-state {
323		pins = "gpio6";
324		function = "normal";
325		input-enable;
326		bias-pull-up;
327		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
328	};
329};
330
331&pmi8998_lpg {
332	status = "okay";
333
334	led@5 {
335		reg = <5>;
336		color = <LED_COLOR_ID_WHITE>;
337		function = LED_FUNCTION_STATUS;
338	};
339};
340
341&pmi8998_wled {
342	status = "okay";
343	qcom,current-boost-limit = <970>;
344	qcom,ovp-millivolt = <29600>;
345	qcom,current-limit-microamp = <20000>;
346	qcom,num-strings = <2>;
347	qcom,switching-freq = <600>;
348	qcom,external-pfet;
349	qcom,cabc;
350};
351
352&pmi8998_charger {
353	monitored-battery = <&battery>;
354
355	status = "okay";
356};
357
358&pm8998_resin {
359	linux,code = <KEY_VOLUMEDOWN>;
360	status = "okay";
361};
362
363/* QUAT I2S Uses 1 I2S SD Line for audio on TAS2559/60 amplifiers */
364&q6afedai {
365	dai@22 {
366		reg = <QUATERNARY_MI2S_RX>;
367		qcom,sd-lines = <0>;
368	};
369};
370
371&q6asmdai {
372	dai@0 {
373		reg = <0>;
374	};
375
376	dai@1 {
377		reg = <1>;
378	};
379
380	dai@2 {
381		reg = <2>;
382	};
383};
384
385&qupv3_id_0 {
386	status = "okay";
387};
388
389&sdhc_2 {
390	status = "okay";
391
392	pinctrl-names = "default";
393	pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
394
395	vmmc-supply = <&vreg_l21a_2p95>;
396	vqmmc-supply = <&vreg_l13a_2p95>;
397
398	bus-width = <4>;
399	cd-gpios = <&tlmm 126 GPIO_ACTIVE_HIGH>;
400};
401
402&sound {
403	compatible = "qcom,db845c-sndcard", "qcom,sdm845-sndcard";
404	pinctrl-0 = <&quat_mi2s_active
405			&quat_mi2s_sd0_active>;
406	pinctrl-names = "default";
407	model = "Xiaomi Poco F1";
408	audio-routing =
409		"RX_BIAS", "MCLK",
410		"AMIC1", "MIC BIAS1",
411		"AMIC2", "MIC BIAS2",
412		"AMIC3", "MIC BIAS3";
413
414	mm1-dai-link {
415		link-name = "MultiMedia1";
416		cpu {
417			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
418		};
419	};
420
421	mm2-dai-link {
422		link-name = "MultiMedia2";
423		cpu {
424			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
425		};
426	};
427
428	mm3-dai-link {
429		link-name = "MultiMedia3";
430		cpu {
431			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
432		};
433	};
434
435	slim-dai-link {
436		link-name = "SLIM Playback";
437		cpu {
438			sound-dai = <&q6afedai SLIMBUS_0_RX>;
439		};
440
441		platform {
442			sound-dai = <&q6routing>;
443		};
444
445		codec {
446			sound-dai = <&wcd9340 0>;
447		};
448	};
449
450	slimcap-dai-link {
451		link-name = "SLIM Capture";
452		cpu {
453			sound-dai = <&q6afedai SLIMBUS_0_TX>;
454		};
455
456		platform {
457			sound-dai = <&q6routing>;
458		};
459
460		codec {
461			sound-dai = <&wcd9340 1>;
462		};
463	};
464};
465
466&tlmm {
467	gpio-reserved-ranges = <0 4>, <81 4>;
468
469	sdc2_default_state: sdc2-default-state {
470		clk-pins {
471			pins = "sdc2_clk";
472			bias-disable;
473			drive-strength = <16>;
474		};
475
476		cmd-pins {
477			pins = "sdc2_cmd";
478			bias-pull-up;
479			drive-strength = <10>;
480		};
481
482		data-pins {
483			pins = "sdc2_data";
484			bias-pull-up;
485			drive-strength = <10>;
486		};
487	};
488
489	sdc2_card_det_n: sd-card-det-n-state {
490		pins = "gpio126";
491		function = "gpio";
492		bias-pull-up;
493	};
494};
495
496&uart6 {
497	status = "okay";
498
499	pinctrl-0 = <&qup_uart6_4pin>;
500
501	bluetooth {
502		compatible = "qcom,wcn3990-bt";
503
504		vddio-supply = <&vreg_s4a_1p8>;
505		vddxo-supply = <&vreg_l7a_1p8>;
506		vddrf-supply = <&vreg_l17a_1p3>;
507		vddch0-supply = <&vreg_l25a_3p3>;
508		max-speed = <3200000>;
509	};
510};
511
512&ufs_mem_hc {
513	status = "okay";
514
515	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
516
517	vcc-supply = <&vreg_l20a_2p95>;
518	vcc-max-microamp = <800000>;
519};
520
521&ufs_mem_phy {
522	status = "okay";
523
524	vdda-phy-supply = <&vreg_l1a_0p875>;
525	vdda-pll-supply = <&vreg_l26a_1p2>;
526};
527
528&usb_1 {
529	status = "okay";
530};
531
532&usb_1_dwc3 {
533	dr_mode = "peripheral";
534};
535
536&usb_1_hsphy {
537	status = "okay";
538
539	vdd-supply = <&vreg_l1a_0p875>;
540	vdda-pll-supply = <&vreg_l12a_1p8>;
541	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
542
543	qcom,imp-res-offset-value = <8>;
544	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
545	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
546	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
547};
548
549&usb_1_qmpphy {
550	status = "okay";
551
552	vdda-phy-supply = <&vreg_l26a_1p2>;
553	vdda-pll-supply = <&vreg_l1a_0p875>;
554};
555
556&venus {
557	status = "okay";
558	firmware-name = "qcom/sdm845/beryllium/venus.mbn";
559};
560
561&wcd9340 {
562	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
563	vdd-buck-supply = <&vreg_s4a_1p8>;
564	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
565	vdd-tx-supply = <&vreg_s4a_1p8>;
566	vdd-rx-supply = <&vreg_s4a_1p8>;
567	vdd-io-supply = <&vreg_s4a_1p8>;
568	qcom,micbias1-microvolt = <2700000>;
569	qcom,micbias2-microvolt = <1800000>;
570	qcom,micbias3-microvolt = <2700000>;
571	qcom,micbias4-microvolt = <2700000>;
572};
573
574&wifi {
575	status = "okay";
576
577	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
578	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
579	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
580	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
581	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
582};
583