1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
10#include "sm8150.dtsi"
11#include "pm8150.dtsi"
12#include "pm8150b.dtsi"
13#include "pm8150l.dtsi"
14
15/delete-node/ &cdsp_mem;
16/delete-node/ &gpu_mem;
17/delete-node/ &ipa_fw_mem;
18/delete-node/ &ipa_gsi_mem;
19/delete-node/ &mpss_mem;
20/delete-node/ &slpi_mem;
21/delete-node/ &spss_mem;
22/delete-node/ &venus_mem;
23
24/ {
25	qcom,msm-id = <339 0x20000>; /* SM8150 v2 */
26	qcom,board-id = <8 0>;
27
28	chosen {
29		#address-cells = <2>;
30		#size-cells = <2>;
31		ranges;
32
33		framebuffer: framebuffer@9c000000 {
34			compatible = "simple-framebuffer";
35			reg = <0 0x9c000000 0 0x2300000>;
36			/* Griffin BL initializes in 2.5k mode, not 4k */
37			width = <1096>;
38			height = <2560>;
39			stride = <(1096 * 4)>;
40			format = "a8r8g8b8";
41			/*
42			 * That's (going to be) a lot of clocks, but it's necessary due
43			 * to unused clk cleanup & no panel driver yet (& no dispcc either)..
44			 */
45			clocks = <&gcc GCC_DISP_HF_AXI_CLK>,
46				 <&gcc GCC_DISP_SF_AXI_CLK>;
47		};
48	};
49
50	gpio-keys {
51		compatible = "gpio-keys";
52
53		pinctrl-names = "default";
54		pinctrl-0 = <&focus_n &snapshot_n &vol_down_n>;
55
56		key-camera-focus {
57			label = "Camera Focus";
58			linux,code = <KEY_CAMERA_FOCUS>;
59			gpios = <&pm8150b_gpios 2 GPIO_ACTIVE_LOW>;
60			debounce-interval = <15>;
61			linux,can-disable;
62			wakeup-source;
63		};
64
65		key-camera-snapshot {
66			label = "Camera Snapshot";
67			linux,code = <KEY_CAMERA>;
68			gpios = <&pm8150b_gpios 1 GPIO_ACTIVE_LOW>;
69			debounce-interval = <15>;
70			linux,can-disable;
71			wakeup-source;
72		};
73
74		key-vol-down {
75			label = "Volume Down";
76			linux,code = <KEY_VOLUMEDOWN>;
77			gpios = <&pm8150_gpios 1 GPIO_ACTIVE_LOW>;
78			debounce-interval = <15>;
79			linux,can-disable;
80			wakeup-source;
81		};
82	};
83
84	vph_pwr: vph-pwr-regulator {
85		compatible = "regulator-fixed";
86		regulator-name = "vph_pwr";
87		regulator-min-microvolt = <3700000>;
88		regulator-max-microvolt = <3700000>;
89	};
90
91	/*
92	 * Apparently RPMh does not provide support for PM8150 S4 because it
93	 * is always-on; model it as a fixed regulator.
94	 */
95	vreg_s4a_1p8: pm8150-s4 {
96		compatible = "regulator-fixed";
97		regulator-name = "vreg_s4a_1p8";
98
99		regulator-min-microvolt = <1800000>;
100		regulator-max-microvolt = <1800000>;
101
102		regulator-always-on;
103		regulator-boot-on;
104
105		vin-supply = <&vph_pwr>;
106	};
107
108	reserved-memory {
109		mpss_mem: memory@8dc00000 {
110			reg = <0x0 0x8dc00000 0x0 0x9600000>;
111			no-map;
112		};
113
114		venus_mem: memory@97200000 {
115			reg = <0x0 0x97200000 0x0 0x500000>;
116			no-map;
117		};
118
119		slpi_mem: memory@97700000 {
120			reg = <0x0 0x97700000 0x0 0x1400000>;
121			no-map;
122		};
123
124		ipa_fw_mem: memory@98b00000 {
125			reg = <0x0 0x98b00000 0x0 0x10000>;
126			no-map;
127		};
128
129		ipa_gsi_mem: memory@98b10000 {
130			reg = <0x0 0x98b10000 0x0 0x5000>;
131			no-map;
132		};
133
134		gpu_mem: memory@98b15000 {
135			reg = <0x0 0x98b15000 0x0 0x2000>;
136			no-map;
137		};
138
139		spss_mem: memory@98c00000 {
140			reg = <0x0 0x98c00000 0x0 0x100000>;
141			no-map;
142		};
143
144		cdsp_mem: memory@98d00000 {
145			reg = <0x0 0x98d00000 0x0 0x1400000>;
146			no-map;
147		};
148
149		cont_splash_mem: memory@9c000000 {
150			reg = <0x0 0x9c000000 0x0 0x2400000>;
151			no-map;
152		};
153
154		cdsp_sec_mem: memory@a4c00000 {
155			reg = <0x0 0xa4c00000 0x0 0x3c00000>;
156			no-map;
157		};
158
159		ramoops@ffc00000 {
160			compatible = "ramoops";
161			reg = <0x0 0xffc00000 0x0 0x100000>;
162			record-size = <0x1000>;
163			console-size = <0x40000>;
164			msg-size = <0x20000 0x20000>;
165			ecc-size = <16>;
166			no-map;
167		};
168	};
169};
170
171&adsp_mem {
172	reg = <0x0 0x8be00000 0x0 0x1e00000>;
173};
174
175&apps_rsc {
176	regulators-0 {
177		compatible = "qcom,pm8150-rpmh-regulators";
178		qcom,pmic-id = "a";
179
180		vdd-s1-supply = <&vph_pwr>;
181		vdd-s2-supply = <&vph_pwr>;
182		vdd-s3-supply = <&vph_pwr>;
183		vdd-s4-supply = <&vph_pwr>;
184		vdd-s5-supply = <&vph_pwr>;
185		vdd-s6-supply = <&vph_pwr>;
186		vdd-s7-supply = <&vph_pwr>;
187		vdd-s8-supply = <&vph_pwr>;
188		vdd-s9-supply = <&vph_pwr>;
189		vdd-s10-supply = <&vph_pwr>;
190
191		vdd-l1-l8-l11-supply = <&vreg_s6a_0p9>;
192		vdd-l2-l10-supply = <&vreg_bob>;
193		vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p9>;
194		vdd-l6-l9-supply = <&vreg_s8c_1p3>;
195		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
196		vdd-l13-l16-l17-supply = <&vreg_bob>;
197
198		vreg_s2a_0p6: smps2 {
199			regulator-min-microvolt = <600000>;
200			regulator-max-microvolt = <600000>;
201			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
202		};
203
204		vreg_s5a_1p9: smps5 {
205			regulator-min-microvolt = <1904000>;
206			regulator-max-microvolt = <2040000>;
207			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
208		};
209
210		vreg_s6a_0p9: smps6 {
211			regulator-min-microvolt = <920000>;
212			regulator-max-microvolt = <1128000>;
213			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
214		};
215
216		vreg_l1a_0p75: ldo1 {
217			regulator-min-microvolt = <752000>;
218			regulator-max-microvolt = <752000>;
219			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
220		};
221
222		vreg_l2a_3p1: ldo2 {
223			regulator-min-microvolt = <3072000>;
224			regulator-max-microvolt = <3072000>;
225			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
226		};
227
228		vreg_l3a_0p8: ldo3 {
229			regulator-min-microvolt = <480000>;
230			regulator-max-microvolt = <932000>;
231			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
232		};
233
234		vreg_l5a_0p875: ldo5 {
235			regulator-min-microvolt = <880000>;
236			regulator-max-microvolt = <880000>;
237			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
238		};
239
240		vreg_l6a_1p2: ldo6 {
241			regulator-min-microvolt = <1200000>;
242			regulator-max-microvolt = <1200000>;
243			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
244		};
245
246		vreg_l7a_1p8: ldo7 {
247			regulator-min-microvolt = <1800000>;
248			regulator-max-microvolt = <1800000>;
249			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
250		};
251
252		vreg_l9a_1p2: ldo9 {
253			regulator-min-microvolt = <1200000>;
254			regulator-max-microvolt = <1200000>;
255			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
256		};
257
258		vreg_l10a_2p5: ldo10 {
259			regulator-min-microvolt = <2504000>;
260			regulator-max-microvolt = <2960000>;
261			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
262		};
263
264		vreg_l11a_0p8: ldo11 {
265			regulator-min-microvolt = <800000>;
266			regulator-max-microvolt = <800000>;
267			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
268		};
269
270		vreg_l12a_1p8: ldo12 {
271			regulator-min-microvolt = <1800000>;
272			regulator-max-microvolt = <1800000>;
273			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
274		};
275
276		/* L13 is unused. */
277
278		vreg_l14a_1p8: ldo14 {
279			regulator-min-microvolt = <1800000>;
280			regulator-max-microvolt = <1800000>;
281			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
282		};
283
284		vreg_l15a_1p7: ldo15 {
285			regulator-min-microvolt = <1704000>;
286			regulator-max-microvolt = <1704000>;
287			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
288		};
289
290		vreg_l16a_2p7: ldo16 {
291			regulator-min-microvolt = <2704000>;
292			regulator-max-microvolt = <2960000>;
293			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
294		};
295
296		vreg_l17a_3p0: ldo17 {
297			regulator-min-microvolt = <2856000>;
298			regulator-max-microvolt = <3008000>;
299			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
300		};
301
302		vreg_l18a_0p8: ldo18 {
303			regulator-min-microvolt = <880000>;
304			regulator-max-microvolt = <912000>;
305			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
306		};
307	};
308
309	regulators-1 {
310		compatible = "qcom,pm8150l-rpmh-regulators";
311		qcom,pmic-id = "c";
312
313		vdd-s1-supply = <&vph_pwr>;
314		vdd-s2-supply = <&vph_pwr>;
315		vdd-s3-supply = <&vph_pwr>;
316		vdd-s4-supply = <&vph_pwr>;
317		vdd-s5-supply = <&vph_pwr>;
318		vdd-s6-supply = <&vph_pwr>;
319		vdd-s7-supply = <&vph_pwr>;
320		vdd-s8-supply = <&vph_pwr>;
321
322		vdd-l1-l8-supply = <&vreg_s4a_1p8>;
323		vdd-l2-l3-supply = <&vreg_s8c_1p3>;
324		vdd-l4-l5-l6-supply = <&vreg_bob>;
325		vdd-l7-l11-supply = <&vreg_bob>;
326		vdd-l9-l10-supply = <&vreg_bob>;
327
328		vdd-bob-supply = <&vph_pwr>;
329		vdd-flash-supply = <&vreg_bob>;
330		vdd-rgb-supply = <&vreg_bob>;
331
332		vreg_bob: bob {
333			regulator-min-microvolt = <3350000>;
334			regulator-max-microvolt = <4000000>;
335			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
336			regulator-allow-bypass;
337		};
338
339		vreg_s1c_1p1: smps1 {
340			regulator-min-microvolt = <1128000>;
341			regulator-max-microvolt = <1128000>;
342			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
343		};
344
345		vreg_s8c_1p3: smps8 {
346			regulator-min-microvolt = <1352000>;
347			regulator-max-microvolt = <1352000>;
348			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
349		};
350
351		vreg_l1c_1p8: ldo1 {
352			regulator-min-microvolt = <1800000>;
353			regulator-max-microvolt = <1800000>;
354			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
355		};
356
357		vreg_l2c_1p3: ldo2 {
358			regulator-min-microvolt = <1304000>;
359			regulator-max-microvolt = <1304000>;
360			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
361		};
362
363		vreg_l3c_1p2: ldo3 {
364			regulator-min-microvolt = <1200000>;
365			regulator-max-microvolt = <1200000>;
366			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
367		};
368
369		vreg_l4c_1p8: ldo4 {
370			regulator-min-microvolt = <1704000>;
371			regulator-max-microvolt = <2928000>;
372			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
373		};
374
375		vreg_l5c_1p8: ldo5 {
376			regulator-min-microvolt = <1704000>;
377			regulator-max-microvolt = <2928000>;
378			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
379		};
380
381		vreg_l6c_2p9: ldo6 {
382			regulator-min-microvolt = <1800000>;
383			regulator-max-microvolt = <2960000>;
384			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
385			regulator-allow-set-load;
386			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
387						   RPMH_REGULATOR_MODE_HPM>;
388		};
389
390		vreg_l7c_3p0: ldo7 {
391			regulator-min-microvolt = <2856000>;
392			regulator-max-microvolt = <3104000>;
393			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
394		};
395
396		vreg_l8c_1p8: ldo8 {
397			regulator-min-microvolt = <1800000>;
398			regulator-max-microvolt = <1800000>;
399			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
400		};
401
402		vreg_l9c_2p9: ldo9 {
403			regulator-min-microvolt = <2704000>;
404			regulator-max-microvolt = <2960000>;
405			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
406			regulator-allow-set-load;
407			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
408						   RPMH_REGULATOR_MODE_HPM>;
409		};
410
411		vreg_l10c_3p3: ldo10 {
412			regulator-min-microvolt = <3000000>;
413			regulator-max-microvolt = <3312000>;
414			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
415		};
416
417		vreg_l11c_3p3: ldo11 {
418			regulator-min-microvolt = <3000000>;
419			regulator-max-microvolt = <3312000>;
420			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
421		};
422	};
423
424	/* PM8009 is not present on these boards, even if downstream sources suggest so. */
425};
426
427&i2c4 {
428	status = "okay";
429
430	/* Qcom SMB1355 @ c */
431	/* Qcom SMB1390 @ 10 */
432	/* Qcom FSA4480 USB-C audio switch @ 43 */
433
434	nfc@28 {
435		compatible = "nxp,nxp-nci-i2c";
436		reg = <0x28>;
437
438		interrupt-parent = <&tlmm>;
439		interrupts = <47 IRQ_TYPE_EDGE_RISING>;
440
441		enable-gpios = <&tlmm 41 GPIO_ACTIVE_HIGH>;
442		firmware-gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>;
443	};
444};
445
446&i2c7 {
447	status = "okay";
448
449	/* AMS TCS3490 RGB+IR color sensor @ 72 */
450};
451
452&i2c10 {
453	status = "okay";
454
455	/* Samsung touchscreen @ 48 */
456};
457
458&pm8150_gpios {
459	vol_down_n: vol-down-n-state {
460		pins = "gpio1";
461		function = "normal";
462		power-source = <0>;
463		bias-pull-up;
464		input-enable;
465	};
466};
467
468&pm8150b_gpios {
469	snapshot_n: snapshot-n-state {
470		pins = "gpio1";
471		function = "normal";
472		power-source = <0>;
473		bias-pull-up;
474		input-enable;
475	};
476
477	focus_n: focus-n-state {
478		pins = "gpio2";
479		function = "normal";
480		power-source = <0>;
481		bias-pull-up;
482		input-enable;
483	};
484};
485
486&pon_pwrkey {
487	status = "okay";
488};
489
490&pon_resin {
491	linux,code = <KEY_VOLUMEUP>;
492	status = "okay";
493};
494
495&qupv3_id_0 {
496	status = "okay";
497};
498
499&qupv3_id_1 {
500	status = "okay";
501};
502
503&tlmm {
504	gpio-reserved-ranges = <126 4>;
505};
506
507&uart2 {
508	status = "okay";
509};
510
511/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
512&ufs_mem_hc { status = "disabled"; };
513&ufs_mem_phy { status = "disabled"; };
514
515&usb_1 {
516	status = "okay";
517};
518
519&usb_1_dwc3 {
520	dr_mode = "peripheral";
521};
522
523&usb_1_hsphy {
524	status = "okay";
525	vdda-pll-supply = <&vreg_l5a_0p875>;
526	vdda33-supply = <&vreg_l2a_3p1>;
527	vdda18-supply = <&vreg_l12a_1p8>;
528};
529
530&usb_1_qmpphy {
531	status = "okay";
532	vdda-phy-supply = <&vreg_l3c_1p2>;
533	vdda-pll-supply = <&vreg_l18a_0p8>;
534};
535