1// SPDX-License-Identifier: GPL-2.0
2
3/dts-v1/;
4
5#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
6#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
7#include <dt-bindings/sound/qcom,q6afe.h>
8#include <dt-bindings/sound/qcom,q6asm.h>
9#include "sdm845.dtsi"
10#include "pm8998.dtsi"
11#include "pmi8998.dtsi"
12
13/*
14 * Delete following upstream (sdm845.dtsi) reserved
15 * memory mappings which are different in this device.
16 */
17/delete-node/ &tz_mem;
18/delete-node/ &adsp_mem;
19/delete-node/ &wlan_msa_mem;
20/delete-node/ &mpss_region;
21/delete-node/ &venus_mem;
22/delete-node/ &cdsp_mem;
23/delete-node/ &mba_region;
24/delete-node/ &slpi_mem;
25/delete-node/ &spss_mem;
26/delete-node/ &rmtfs_mem;
27
28/ {
29	model = "Xiaomi Pocophone F1";
30	compatible = "xiaomi,beryllium", "qcom,sdm845";
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		hsuart0 = &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		vol-up {
49			label = "Volume Up";
50			linux,code = <KEY_VOLUMEUP>;
51			gpios = <&pm8998_gpio 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		rmtfs_mem: memory@f6301000 {
103			compatible = "qcom,rmtfs-mem";
104			reg = <0 0xf6301000 0 0x200000>;
105			no-map;
106
107			qcom,client-id = <1>;
108			qcom,vmid = <15>;
109		};
110	};
111
112	vreg_s4a_1p8: vreg-s4a-1p8 {
113		compatible = "regulator-fixed";
114		regulator-name = "vreg_s4a_1p8";
115
116		regulator-min-microvolt = <1800000>;
117		regulator-max-microvolt = <1800000>;
118		regulator-always-on;
119	};
120};
121
122&adsp_pas {
123	status = "okay";
124	firmware-name = "qcom/sdm845/adsp.mdt";
125};
126
127&apps_rsc {
128	pm8998-rpmh-regulators {
129		compatible = "qcom,pm8998-rpmh-regulators";
130		qcom,pmic-id = "a";
131
132		vreg_l1a_0p875: ldo1 {
133			regulator-min-microvolt = <880000>;
134			regulator-max-microvolt = <880000>;
135			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
136		};
137
138		vreg_l5a_0p8: ldo5 {
139			regulator-min-microvolt = <800000>;
140			regulator-max-microvolt = <800000>;
141			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
142		};
143
144		vreg_l7a_1p8: ldo7 {
145			regulator-min-microvolt = <1800000>;
146			regulator-max-microvolt = <1800000>;
147			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
148		};
149
150		vreg_l12a_1p8: ldo12 {
151			regulator-min-microvolt = <1800000>;
152			regulator-max-microvolt = <1800000>;
153			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
154		};
155
156		vreg_l13a_2p95: ldo13 {
157			regulator-min-microvolt = <1800000>;
158			regulator-max-microvolt = <2960000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161
162		vreg_l14a_1p8: ldo14 {
163			regulator-min-microvolt = <1800000>;
164			regulator-max-microvolt = <1800000>;
165			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
166			regulator-boot-on;
167			regulator-always-on;
168		};
169
170		vreg_l17a_1p3: ldo17 {
171			regulator-min-microvolt = <1304000>;
172			regulator-max-microvolt = <1304000>;
173			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
174		};
175
176		vreg_l20a_2p95: ldo20 {
177			regulator-min-microvolt = <2960000>;
178			regulator-max-microvolt = <2968000>;
179			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
180		};
181
182		vreg_l21a_2p95: ldo21 {
183			regulator-min-microvolt = <2960000>;
184			regulator-max-microvolt = <2968000>;
185			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
186		};
187
188		vreg_l24a_3p075: ldo24 {
189			regulator-min-microvolt = <3088000>;
190			regulator-max-microvolt = <3088000>;
191			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
192		};
193
194		vreg_l25a_3p3: ldo25 {
195			regulator-min-microvolt = <3300000>;
196			regulator-max-microvolt = <3312000>;
197			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
198		};
199
200		vreg_l26a_1p2: ldo26 {
201			regulator-min-microvolt = <1200000>;
202			regulator-max-microvolt = <1200000>;
203			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
204			regulator-boot-on;
205		};
206	};
207};
208
209&cdsp_pas {
210	status = "okay";
211	firmware-name = "qcom/sdm845/cdsp.mdt";
212};
213
214&dsi0 {
215	status = "okay";
216	vdda-supply = <&vreg_l26a_1p2>;
217
218	panel@0 {
219		compatible = "tianma,fhd-video";
220		reg = <0>;
221		vddi0-supply = <&vreg_l14a_1p8>;
222		vddpos-supply = <&lab>;
223		vddneg-supply = <&ibb>;
224
225		#address-cells = <1>;
226		#size-cells = <0>;
227
228		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
229
230		port {
231			tianma_nt36672a_in_0: endpoint {
232				remote-endpoint = <&dsi0_out>;
233			};
234		};
235	};
236};
237
238&dsi0_out {
239	remote-endpoint = <&tianma_nt36672a_in_0>;
240	data-lanes = <0 1 2 3>;
241};
242
243&dsi0_phy {
244	status = "okay";
245	vdds-supply = <&vreg_l1a_0p875>;
246};
247
248&gcc {
249	protected-clocks = <GCC_QSPI_CORE_CLK>,
250			   <GCC_QSPI_CORE_CLK_SRC>,
251			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
252			   <GCC_LPASS_Q6_AXI_CLK>,
253			   <GCC_LPASS_SWAY_CLK>;
254};
255
256&gmu {
257	status = "okay";
258};
259
260&gpu {
261	status = "okay";
262
263	zap-shader {
264		memory-region = <&gpu_mem>;
265		firmware-name = "qcom/sdm845/a630_zap.mbn";
266	};
267};
268
269&ibb {
270	regulator-min-microvolt = <4600000>;
271	regulator-max-microvolt = <6000000>;
272	regulator-over-current-protection;
273	regulator-pull-down;
274	regulator-soft-start;
275	qcom,discharge-resistor-kohms = <300>;
276};
277
278&lab {
279	regulator-min-microvolt = <4600000>;
280	regulator-max-microvolt = <6000000>;
281	regulator-over-current-protection;
282	regulator-pull-down;
283	regulator-soft-start;
284};
285
286&mdss {
287	status = "okay";
288};
289
290&mss_pil {
291	status = "okay";
292	firmware-name = "qcom/sdm845/mba.mbn", "qcom/sdm845/modem.mdt";
293};
294
295&pm8998_gpio {
296	vol_up_pin_a: vol-up-active {
297		pins = "gpio6";
298		function = "normal";
299		input-enable;
300		bias-pull-up;
301		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
302	};
303};
304
305&pm8998_pon {
306	resin {
307		compatible = "qcom,pm8941-resin";
308		interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
309		debounce = <15625>;
310		bias-pull-up;
311		linux,code = <KEY_VOLUMEDOWN>;
312	};
313};
314
315/* QUAT I2S Uses 1 I2S SD Line for audio on TAS2559/60 amplifiers */
316&q6afedai {
317	qi2s@22 {
318		reg = <22>;
319		qcom,sd-lines = <0>;
320	};
321};
322
323&q6asmdai {
324	dai@0 {
325		reg = <0>;
326	};
327
328	dai@1 {
329		reg = <1>;
330	};
331
332	dai@2 {
333		reg = <2>;
334	};
335};
336
337&qupv3_id_0 {
338	status = "okay";
339};
340
341&sdhc_2 {
342	status = "okay";
343
344	pinctrl-names = "default";
345	pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
346
347	vmmc-supply = <&vreg_l21a_2p95>;
348	vqmmc-supply = <&vreg_l13a_2p95>;
349
350	bus-width = <4>;
351	cd-gpios = <&tlmm 126 GPIO_ACTIVE_HIGH>;
352};
353
354&sound {
355	compatible = "qcom,db845c-sndcard";
356	pinctrl-0 = <&quat_mi2s_active
357			&quat_mi2s_sd0_active>;
358	pinctrl-names = "default";
359	model = "Xiaomi Poco F1";
360	audio-routing =
361		"RX_BIAS", "MCLK",
362		"AMIC1", "MIC BIAS1",
363		"AMIC2", "MIC BIAS2",
364		"AMIC3", "MIC BIAS3";
365
366	mm1-dai-link {
367		link-name = "MultiMedia1";
368		cpu {
369			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
370		};
371	};
372
373	mm2-dai-link {
374		link-name = "MultiMedia2";
375		cpu {
376			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
377		};
378	};
379
380	mm3-dai-link {
381		link-name = "MultiMedia3";
382		cpu {
383			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
384		};
385	};
386
387	slim-dai-link {
388		link-name = "SLIM Playback";
389		cpu {
390			sound-dai = <&q6afedai SLIMBUS_0_RX>;
391		};
392
393		platform {
394			sound-dai = <&q6routing>;
395		};
396
397		codec {
398			sound-dai =  <&wcd9340 0>;
399		};
400	};
401
402	slimcap-dai-link {
403		link-name = "SLIM Capture";
404		cpu {
405			sound-dai = <&q6afedai SLIMBUS_0_TX>;
406		};
407
408		platform {
409			sound-dai = <&q6routing>;
410		};
411
412		codec {
413			sound-dai = <&wcd9340 1>;
414		};
415	};
416};
417
418&tlmm {
419	gpio-reserved-ranges = <0 4>, <81 4>;
420
421	sdc2_default_state: sdc2-default {
422		clk {
423			pins = "sdc2_clk";
424			bias-disable;
425			drive-strength = <16>;
426		};
427
428		cmd {
429			pins = "sdc2_cmd";
430			bias-pull-up;
431			drive-strength = <10>;
432		};
433
434		data {
435			pins = "sdc2_data";
436			bias-pull-up;
437			drive-strength = <10>;
438		};
439	};
440
441	sdc2_card_det_n: sd-card-det-n {
442		pins = "gpio126";
443		function = "gpio";
444		bias-pull-up;
445	};
446
447	wcd_intr_default: wcd_intr_default {
448		pins = <54>;
449		function = "gpio";
450
451		input-enable;
452		bias-pull-down;
453		drive-strength = <2>;
454	};
455};
456
457&uart6 {
458	status = "okay";
459
460	bluetooth {
461		compatible = "qcom,wcn3990-bt";
462
463		vddio-supply = <&vreg_s4a_1p8>;
464		vddxo-supply = <&vreg_l7a_1p8>;
465		vddrf-supply = <&vreg_l17a_1p3>;
466		vddch0-supply = <&vreg_l25a_3p3>;
467		max-speed = <3200000>;
468	};
469};
470
471&ufs_mem_hc {
472	status = "okay";
473
474	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
475
476	vcc-supply = <&vreg_l20a_2p95>;
477	vcc-max-microamp = <800000>;
478};
479
480&ufs_mem_phy {
481	status = "okay";
482
483	vdda-phy-supply = <&vreg_l1a_0p875>;
484	vdda-pll-supply = <&vreg_l26a_1p2>;
485};
486
487&usb_1 {
488	status = "okay";
489};
490
491&usb_1_dwc3 {
492	dr_mode = "peripheral";
493};
494
495&usb_1_hsphy {
496	status = "okay";
497
498	vdd-supply = <&vreg_l1a_0p875>;
499	vdda-pll-supply = <&vreg_l12a_1p8>;
500	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
501
502	qcom,imp-res-offset-value = <8>;
503	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
504	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
505	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
506};
507
508&usb_1_qmpphy {
509	status = "okay";
510
511	vdda-phy-supply = <&vreg_l26a_1p2>;
512	vdda-pll-supply = <&vreg_l1a_0p875>;
513};
514
515&venus {
516	status = "okay";
517};
518
519&wcd9340{
520	pinctrl-0 = <&wcd_intr_default>;
521	pinctrl-names = "default";
522	clock-names = "extclk";
523	clocks = <&rpmhcc RPMH_LN_BB_CLK2>;
524	reset-gpios = <&tlmm 64 0>;
525	vdd-buck-supply = <&vreg_s4a_1p8>;
526	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
527	vdd-tx-supply = <&vreg_s4a_1p8>;
528	vdd-rx-supply = <&vreg_s4a_1p8>;
529	vdd-io-supply = <&vreg_s4a_1p8>;
530	qcom,micbias1-microvolt = <2700000>;
531	qcom,micbias2-microvolt = <1800000>;
532	qcom,micbias3-microvolt = <2700000>;
533	qcom,micbias4-microvolt = <2700000>;
534};
535
536&wifi {
537	status = "okay";
538
539	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
540	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
541	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
542	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
543};
544
545/* PINCTRL - additions to nodes defined in sdm845.dtsi */
546
547&qup_uart6_default {
548	pinmux {
549		pins = "gpio45", "gpio46", "gpio47", "gpio48";
550		function = "qup6";
551	};
552
553	cts {
554		pins = "gpio45";
555		bias-disable;
556	};
557
558	rts-tx {
559		pins = "gpio46", "gpio47";
560		drive-strength = <2>;
561		bias-disable;
562	};
563
564	rx {
565		pins = "gpio48";
566		bias-pull-up;
567	};
568};
569