1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6#include <dt-bindings/input/input.h>
7#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
8#include "sdm845.dtsi"
9#include "pm8005.dtsi"
10#include "pm8998.dtsi"
11#include "pmi8998.dtsi"
12
13/ {
14	qcom,msm-id = <321 0x20001>; /* SDM845 v2.1 */
15	qcom,board-id = <8 0>;
16
17	gpio-keys {
18		compatible = "gpio-keys";
19
20		/* Neither Camera Focus, nor Camera Shutter seem to work... */
21
22		key-vol-down {
23			label = "volume_down";
24			gpios = <&pm8998_gpio 5 GPIO_ACTIVE_LOW>;
25			linux,code = <KEY_VOLUMEDOWN>;
26			debounce-interval = <15>;
27			gpio-key,wakeup;
28		};
29	};
30
31	vph_pwr: vph-pwr-regulator {
32		compatible = "regulator-fixed";
33		regulator-name = "vph_pwr";
34		regulator-min-microvolt = <3700000>;
35		regulator-max-microvolt = <3700000>;
36	};
37
38	vreg_s4a_1p8: pm8998-smps4 {
39		compatible = "regulator-fixed";
40		regulator-name = "vreg_s4a_1p8";
41
42		regulator-min-microvolt = <1800000>;
43		regulator-max-microvolt = <1800000>;
44
45		regulator-always-on;
46		regulator-boot-on;
47
48		vin-supply = <&vph_pwr>;
49	};
50
51	reserved-memory {
52		/* SONY was cool and didn't diverge from MTP this time, yay! */
53		cont_splash_mem: memory@9d400000 {
54			reg = <0x0 0x9d400000 0x0 0x2400000>;
55			no-map;
56		};
57
58		ramoops@ffc00000 {
59			compatible = "ramoops";
60			reg = <0x0 0xffc00000 0x0 0x100000>;
61			record-size = <0x10000>;
62			console-size = <0x60000>;
63			ftrace-size = <0x10000>;
64			pmsg-size = <0x20000>;
65			ecc-size = <16>;
66			no-map;
67		};
68	};
69};
70
71&apps_rsc {
72	pm8998-rpmh-regulators {
73		compatible = "qcom,pm8998-rpmh-regulators";
74		qcom,pmic-id = "a";
75
76		vdd-s1-supply = <&vph_pwr>;
77		vdd-s2-supply = <&vph_pwr>;
78		vdd-s3-supply = <&vph_pwr>;
79		vdd-s4-supply = <&vph_pwr>;
80		vdd-s5-supply = <&vph_pwr>;
81		vdd-s6-supply = <&vph_pwr>;
82		vdd-s7-supply = <&vph_pwr>;
83		vdd-s8-supply = <&vph_pwr>;
84		vdd-s9-supply = <&vph_pwr>;
85		vdd-s10-supply = <&vph_pwr>;
86		vdd-s11-supply = <&vph_pwr>;
87		vdd-s12-supply = <&vph_pwr>;
88		vdd-s13-supply = <&vph_pwr>;
89		vdd-l1-l27-supply = <&vreg_s7a_0p9>;
90		vdd-l2-l8-l17-supply = <&vreg_s3a_1p3>;
91		vdd-l3-l11-supply = <&vreg_s7a_0p9>;
92		vdd-l4-l5-supply = <&vreg_s7a_0p9>;
93		vdd-l6-supply = <&vph_pwr>;
94		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
95		vdd-l9-supply = <&vreg_s5a_1p9>;
96		vdd-l10-l23-l25-supply = <&src_vreg_bob>;
97		vdd-l13-l19-l21-supply = <&src_vreg_bob>;
98		vdd-l16-l28-supply = <&src_vreg_bob>;
99		vdd-l18-l22-supply = <&src_vreg_bob>;
100		vdd-l20-l24-supply = <&src_vreg_bob>;
101		vdd-l26-supply = <&vreg_s3a_1p3>;
102		vin-lvs-1-2-supply = <&vreg_s4a_1p8>;
103
104		vreg_s2a_1p1: smps2 {
105			regulator-min-microvolt = <1100000>;
106			regulator-max-microvolt = <1100000>;
107		};
108
109		vreg_s3a_1p3: smps3 {
110			regulator-min-microvolt = <1352000>;
111			regulator-max-microvolt = <1352000>;
112		};
113
114		vreg_s5a_1p9: smps5 {
115			regulator-min-microvolt = <1904000>;
116			regulator-max-microvolt = <2040000>;
117		};
118
119		vreg_s7a_0p9: smps7 {
120			regulator-min-microvolt = <900000>;
121			regulator-max-microvolt = <1028000>;
122		};
123
124		vreg_l1a_0p9: ldo1 {
125			regulator-min-microvolt = <880000>;
126			regulator-max-microvolt = <880000>;
127			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
128		};
129
130		vreg_l2a_1p2: ldo2 {
131			regulator-min-microvolt = <1200000>;
132			regulator-max-microvolt = <1200000>;
133			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
134			regulator-always-on;
135		};
136
137		vreg_l3a_1p0: ldo3 {
138			regulator-min-microvolt = <1000000>;
139			regulator-max-microvolt = <1000000>;
140			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
141		};
142
143		vreg_l5a_0p8: ldo5 {
144			regulator-min-microvolt = <800000>;
145			regulator-max-microvolt = <800000>;
146			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
147		};
148
149		vreg_l6a_1p8: ldo6 {
150			regulator-min-microvolt = <1856000>;
151			regulator-max-microvolt = <1856000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		vreg_l7a_1p8: ldo7 {
156			regulator-min-microvolt = <1800000>;
157			regulator-max-microvolt = <1800000>;
158			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
159		};
160
161		vreg_l8a_1p2: ldo8 {
162			regulator-min-microvolt = <1200000>;
163			regulator-max-microvolt = <1248000>;
164			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
165		};
166
167		vreg_l9a_1p7: ldo9 {
168			regulator-min-microvolt = <1704000>;
169			regulator-max-microvolt = <2928000>;
170			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
171		};
172
173		vreg_l10a_1p7: ldo10 {
174			regulator-min-microvolt = <1704000>;
175			regulator-max-microvolt = <2928000>;
176			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
177		};
178
179		vreg_l11a_1p0: ldo11 {
180			regulator-min-microvolt = <1000000>;
181			regulator-max-microvolt = <1048000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183		};
184
185		vreg_l12a_1p8: ldo12 {
186			regulator-min-microvolt = <1800000>;
187			regulator-max-microvolt = <1800000>;
188			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
189		};
190
191		vreg_l13a_1p8: ldo13 {
192			regulator-min-microvolt = <1800000>;
193			regulator-max-microvolt = <2960000>;
194			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
195		};
196
197		vreg_l14a_1p8: ldo14 {
198			regulator-min-microvolt = <1800000>;
199			regulator-max-microvolt = <1800000>;
200			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
201		};
202
203		vreg_l15a_1p8: ldo15 {
204			regulator-min-microvolt = <1800000>;
205			regulator-max-microvolt = <1800000>;
206			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
207		};
208
209		vreg_l16a_2p7: ldo16 {
210			regulator-min-microvolt = <2704000>;
211			regulator-max-microvolt = <2704000>;
212			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
213		};
214
215		vreg_l17a_1p3: ldo17 {
216			regulator-min-microvolt = <1304000>;
217			regulator-max-microvolt = <1304000>;
218			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
219		};
220
221		vreg_l18a_2p7: ldo18 {
222			regulator-min-microvolt = <2704000>;
223			regulator-max-microvolt = <2960000>;
224			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
225		};
226
227		vreg_l19a_2p7: ldo19 {
228			regulator-min-microvolt = <2700000>;
229			regulator-max-microvolt = <2700000>;
230			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
231
232			/*
233			 * The driver *really* doesn't want this regualtor to exist,
234			 * saying that it could not get the current voltage (-ENOTRECOVERABLE)
235			 * even though it surely is used on these devices (as a voltage
236			 * source for camera autofocus)
237			 */
238			status = "disabled";
239		};
240
241		vreg_l20a_2p7: ldo20 {
242			regulator-min-microvolt = <2704000>;
243			regulator-max-microvolt = <2960000>;
244			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245		};
246
247		vreg_l21a_2p7: ldo21 {
248			regulator-min-microvolt = <2704000>;
249			regulator-max-microvolt = <2960000>;
250			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
251		};
252
253		vreg_l22a_2p8: ldo22 {
254			regulator-min-microvolt = <2800000>;
255			regulator-max-microvolt = <2800000>;
256			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
257		};
258
259		vreg_l23a_3p0: ldo23 {
260			regulator-min-microvolt = <3000000>;
261			regulator-max-microvolt = <3312000>;
262			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
263		};
264
265		vreg_l24a_3p1: ldo24 {
266			regulator-min-microvolt = <3088000>;
267			regulator-max-microvolt = <3088000>;
268			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
269		};
270
271		vreg_l25a_3p0: ldo25 {
272			regulator-min-microvolt = <3000000>;
273			regulator-max-microvolt = <3312000>;
274			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
275		};
276
277		vreg_l26a_1p2: ldo26 {
278			regulator-min-microvolt = <1200000>;
279			regulator-max-microvolt = <1200000>;
280			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
281		};
282
283		vreg_l28a_2p8: ldo28 {
284			regulator-min-microvolt = <2856000>;
285			regulator-max-microvolt = <3008000>;
286			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
287		};
288
289		vreg_lvs1a_1p8: lvs1 {
290			regulator-min-microvolt = <1800000>;
291			regulator-max-microvolt = <1800000>;
292			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
293		};
294
295		vreg_lvs2a_1p8: lvs2 {
296			regulator-min-microvolt = <1800000>;
297			regulator-max-microvolt = <1800000>;
298			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
299		};
300	};
301
302	pmi8998-rpmh-regulators {
303		compatible = "qcom,pmi8998-rpmh-regulators";
304		qcom,pmic-id = "b";
305
306		src_vreg_bob: bob {
307			regulator-min-microvolt = <3312000>;
308			regulator-max-microvolt = <3600000>;
309			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
310		};
311	};
312
313	pm8005-rpmh-regulators {
314		compatible = "qcom,pm8005-rpmh-regulators";
315		qcom,pmic-id = "c";
316
317		vdd-s1-supply = <&vph_pwr>;
318		vdd-s2-supply = <&vph_pwr>;
319		vdd-s3-supply = <&vph_pwr>;
320		vdd-s4-supply = <&vph_pwr>;
321
322		vreg_s3c_0p6: smps3 {
323			regulator-min-microvolt = <600000>;
324			regulator-max-microvolt = <600000>;
325		};
326	};
327};
328
329&gcc {
330	protected-clocks = <GCC_QSPI_CORE_CLK>,
331			<GCC_QSPI_CORE_CLK_SRC>,
332			<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
333			<GCC_LPASS_Q6_AXI_CLK>,
334			<GCC_LPASS_SWAY_CLK>;
335};
336
337&i2c5 {
338	status = "okay";
339	clock-frequency = <400000>;
340
341	/* Synaptics touchscreen @ 2c, 3c */
342};
343
344&i2c10 {
345	status = "okay";
346	clock-frequency = <400000>;
347
348	/* Qcom SMB1355 @ 8, c */
349	/* NXP PN547 NFC @ 28 */
350	/* Renesas IDTP9221 Qi charger @ 61 */
351};
352
353&i2c14 {
354	status = "okay";
355	clock-frequency = <400000>;
356
357	/* SONY ToF sensor @ 52 */
358	/* AMS TCS3490 RGB+IR color sensor @ 72 */
359};
360
361&qupv3_id_0 {
362	status = "okay";
363};
364
365&qupv3_id_1 {
366	status = "okay";
367};
368
369&sdhc_2 {
370	status = "okay";
371
372	vmmc-supply = <&vreg_l21a_2p7>;
373	vqmmc-supply = <&vreg_l13a_1p8>;
374	cd-gpios = <&tlmm 126 GPIO_ACTIVE_HIGH>;
375	pinctrl-0 = <&sdc2_default_state>;
376	pinctrl-names = "default";
377	bus-width = <4>;
378	no-sdio;
379	no-mmc;
380};
381
382&tlmm {
383	gpio-reserved-ranges = <0 4>, <81 4>;
384
385	sdc2_default_state: sdc2-default-state {
386		clk {
387			pins = "sdc2_clk";
388			drive-strength = <16>;
389			bias-disable;
390		};
391
392		cmd {
393			pins = "sdc2_cmd";
394			drive-strength = <10>;
395			bias-pull-up;
396		};
397
398		data {
399			pins = "sdc2_data";
400			drive-strength = <10>;
401			bias-pull-up;
402		};
403	};
404};
405
406&uart6 {
407	status = "okay";
408};
409
410&uart9 {
411	status = "okay";
412};
413
414/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
415&ufs_mem_hc { status = "disabled"; };
416&ufs_mem_phy { status = "disabled"; };
417
418&usb_1 {
419	status = "okay";
420
421	qcom,select-utmi-as-pipe-clk;
422};
423
424&usb_1_dwc3 {
425	dr_mode = "peripheral";
426
427	maximum-speed = "high-speed";
428	phys = <&usb_1_hsphy>;
429	phy-names = "usb2-phy";
430};
431
432&usb_1_hsphy {
433	status = "okay";
434
435	vdd-supply = <&vreg_l1a_0p9>;
436	vdda-pll-supply = <&vreg_l12a_1p8>;
437	vdda-phy-dpdm-supply = <&vreg_l24a_3p1>;
438};
439