1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6#include "msm8994.dtsi"
7#include "pm8994.dtsi"
8#include "pmi8994.dtsi"
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/gpio-keys.h>
11
12/ {
13	/* required for bootloader to select correct board */
14
15	/*
16	 * We support MSM8994 v2 (0x20000) and v2.1 (0x20001).
17	 * The V1 chip (0x0 and 0x10000) is significantly different
18	 * and requires driver-side changes (including CPR, be warned!!).
19	 * Besides that, it's very rare.
20	 */
21	qcom,msm-id = <207 0x20000>, <207 0x20001>;
22	/* We only use pm8994+pmi8994. */
23	qcom,pmic-id = <0x10009 0x1000a 0x00 0x00>;
24	/* This property is shared across all kitakami devices. */
25	qcom,board-id = <8 0>;
26
27	/* Kitakami firmware doesn't support PSCI */
28	/delete-node/ psci;
29
30	gpio_keys {
31		compatible = "gpio-keys";
32		input-name = "gpio-keys";
33		#address-cells = <1>;
34		#size-cells = <0>;
35		autorepeat;
36
37		button@0 {
38			label = "Volume Down";
39			gpios = <&pm8994_gpios 2 GPIO_ACTIVE_LOW>;
40			linux,input-type = <1>;
41			linux,code = <KEY_VOLUMEDOWN>;
42			wakeup-source;
43			debounce-interval = <15>;
44		};
45
46		button@1 {
47			label = "Volume Up";
48			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
49			linux,input-type = <1>;
50			linux,code = <KEY_VOLUMEUP>;
51			wakeup-source;
52			debounce-interval = <15>;
53		};
54
55		button@2 {
56			label = "Camera Snapshot";
57			gpios = <&pm8994_gpios 4 GPIO_ACTIVE_LOW>;
58			linux,input-type = <1>;
59			linux,code = <KEY_CAMERA>;
60			wakeup-source;
61			debounce-interval = <15>;
62		};
63
64		button@3 {
65			label = "Camera Focus";
66			gpios = <&pm8994_gpios 5 GPIO_ACTIVE_LOW>;
67			linux,input-type = <1>;
68			linux,code = <KEY_VOLUMEUP>;
69			wakeup-source;
70			debounce-interval = <15>;
71		};
72	};
73
74	reserved-memory {
75		/* This is for getting crash logs using Android downstream kernels */
76		ramoops@1fe00000 {
77			compatible = "ramoops";
78			reg = <0 0x1fe00000 0 0x200000>;
79			console-size = <0x100000>;
80			record-size = <0x10000>;
81			ftrace-size = <0x10000>;
82			pmsg-size = <0x80000>;
83		};
84
85		fb_region: fb_region@40000000 {
86			reg = <0 0x40000000 0 0x1000000>;
87			no-map;
88		};
89
90		tzapp: memory@c7800000 {
91			reg = <0 0xc7800000 0 0x1900000>;
92			no-map;
93		};
94	};
95};
96
97&blsp_spi0 {
98	status = "okay";
99
100	/* FPC fingerprint reader */
101};
102
103/* I2C1 is disabled on this board */
104
105&blsp_i2c2 {
106	status = "okay";
107
108	/* NXP PN547 NFC */
109};
110
111&blsp_i2c4 {
112	status = "okay";
113
114	/* Empty but active */
115};
116
117&blsp_i2c5 {
118	status = "okay";
119
120	/* sii8620 HDMI/MHL bridge */
121};
122
123&blsp_i2c6 {
124	status = "okay";
125
126	touchscreen: rmi4-i2c-dev@2c {
127		compatible = "syna,rmi4-i2c";
128		reg = <0x2c>;
129		#address-cells = <1>;
130		#size-cells = <0>;
131
132		interrupt-parent = <&tlmm>;
133		interrupts = <42 IRQ_TYPE_EDGE_FALLING>;
134
135		pinctrl-names = "default";
136		pinctrl-0 = <&ts_int_active &ts_reset_active>;
137
138		vdd-supply = <&pm8994_l22>;
139		vio-supply = <&pm8994_s4>;
140
141		syna,reset-delay-ms = <220>;
142		syna,startup-delay-ms = <220>;
143
144		rmi4-f01@1 {
145			reg = <0x01>;
146			syna,nosleep-mode = <1>;
147		};
148
149		rmi4-f11@11 {
150			reg = <0x11>;
151			syna,sensor-type = <1>;
152		};
153	};
154};
155
156&blsp1_uart2 {
157	status = "okay";
158};
159
160&blsp2_uart2 {
161	status = "okay";
162};
163
164/*
165 * Kitakami bootloader only turns cont_splash on when it detects
166 * specific downstream MDSS/backlight nodes in the active DTB.
167 * One way to use that framebuffer is to load a secondary instance of
168 * LK with the downstream DTB appended and then, only from there, load
169 * mainline Linux.
170 */
171&cont_splash_mem {
172	reg = <0 0x3401000 0 0x2200000>;
173};
174
175&pmi8994_spmi_regulators {
176	/*
177	 * Yeah, this one *is* managed by RPMPD, but also needs
178	 * to be hacked up as a-o due to the GPU device only accepting a single
179	 * power domain.. which still isn't enough and forces us to bind
180	 * OXILI_CX and OXILI_GX together!
181	 */
182	vdd_gfx: s2@1700 {
183		reg = <0x1700 0x100>;
184		regulator-name = "VDD_GFX";
185		regulator-min-microvolt = <980000>;
186		regulator-max-microvolt = <980000>;
187
188		/* hack until we rig up the gpu consumer */
189		regulator-always-on;
190	};
191};
192
193&rpm_requests {
194	pm8994_regulators: pm8994-regulators {
195		compatible = "qcom,rpm-pm8994-regulators";
196
197		vdd_s1-supply = <&vph_pwr>;
198		vdd_s2-supply = <&vph_pwr>;
199		vdd_s3-supply = <&vph_pwr>;
200		vdd_s4-supply = <&vph_pwr>;
201		vdd_s5-supply = <&vph_pwr>;
202		vdd_s6-supply = <&vph_pwr>;
203		vdd_s7-supply = <&vph_pwr>;
204		vdd_s8-supply = <&vph_pwr>;
205		vdd_s9-supply = <&vph_pwr>;
206		vdd_s10-supply = <&vph_pwr>;
207		vdd_s11-supply = <&vph_pwr>;
208		vdd_s12-supply = <&vph_pwr>;
209		vdd_l1-supply = <&pmi8994_s1>;
210		vdd_l2_l26_l28-supply = <&pm8994_s3>;
211		vdd_l3_l11-supply = <&pm8994_s3>;
212		vdd_l4_l27_l31-supply = <&pm8994_s3>;
213		vdd_l5_l7-supply = <&pm8994_s5>;
214		vdd_l6_l12_l32-supply = <&pm8994_s5>;
215		vdd_l8_l16_l30-supply = <&vph_pwr>;
216		vdd_l9_l10_l18_l22-supply = <&pmi8994_bby>;
217		vdd_l13_l19_l23_l24-supply = <&pmi8994_bby>;
218		vdd_l14_l15-supply = <&pm8994_s5>;
219		vdd_l17_l29-supply = <&pmi8994_bby>;
220		vdd_l20_l21-supply = <&pmi8994_bby>;
221		vdd_l25-supply = <&pm8994_s3>;
222		vdd_lvs1_lvs2-supply = <&pm8994_s4>;
223
224		/* S1, S2, S6 and S12 are managed by RPMPD */
225
226		pm8994_s3: s3 {
227			regulator-min-microvolt = <1300000>;
228			regulator-max-microvolt = <1300000>;
229		};
230
231		pm8994_s4: s4 {
232			regulator-min-microvolt = <1800000>;
233			regulator-max-microvolt = <1800000>;
234			regulator-allow-set-load;
235			regulator-always-on;
236			regulator-system-load = <325000>;
237		};
238
239		pm8994_s5: s5 {
240			regulator-min-microvolt = <2150000>;
241			regulator-max-microvolt = <2150000>;
242		};
243
244		pm8994_s7: s7 {
245			regulator-min-microvolt = <1000000>;
246			regulator-max-microvolt = <1000000>;
247		};
248
249		/*
250		 * S8 - SPMI-managed VDD_APC0
251		 * S9, S10 and S11 (the main one) - SPMI-managed VDD_APC1
252		 */
253
254		pm8994_l1: l1 {
255			regulator-min-microvolt = <1000000>;
256			regulator-max-microvolt = <1000000>;
257		};
258
259		pm8994_l2: l2 {
260			regulator-min-microvolt = <1250000>;
261			regulator-max-microvolt = <1250000>;
262			regulator-allow-set-load;
263			regulator-system-load = <10000>;
264		};
265
266		pm8994_l3: l3 {
267			regulator-min-microvolt = <1100000>;
268			regulator-max-microvolt = <1100000>;
269		};
270
271		pm8994_l4: l4 {
272			regulator-min-microvolt = <1225000>;
273			regulator-max-microvolt = <1225000>;
274		};
275
276		/* L5 is inaccessible from RPM */
277
278		pm8994_l6: l6 {
279			regulator-min-microvolt = <1800000>;
280			regulator-max-microvolt = <1800000>;
281		};
282
283		/* L7 is inaccessible from RPM */
284
285		pm8994_l8: l8 {
286			regulator-min-microvolt = <1800000>;
287			regulator-max-microvolt = <1800000>;
288		};
289
290		pm8994_l9: l9 {
291			regulator-min-microvolt = <1800000>;
292			regulator-max-microvolt = <1800000>;
293		};
294
295		pm8994_l10: l10 {
296			regulator-min-microvolt = <1800000>;
297			regulator-max-microvolt = <1800000>;
298		};
299
300		pm8994_l11: l11 {
301			regulator-min-microvolt = <1200000>;
302			regulator-max-microvolt = <1200000>;
303		};
304
305		pm8994_l12: l12 {
306			regulator-min-microvolt = <1800000>;
307			regulator-max-microvolt = <1800000>;
308			regulator-allow-set-load;
309			regulator-system-load = <10000>;
310		};
311
312		pm8994_l13: l13 {
313			regulator-min-microvolt = <1800000>;
314			regulator-max-microvolt = <2950000>;
315		};
316
317		pm8994_l14: l14 {
318			regulator-min-microvolt = <1800000>;
319			regulator-max-microvolt = <1800000>;
320			regulator-allow-set-load;
321			regulator-system-load = <10000>;
322		};
323
324		pm8994_l15: l15 {
325			regulator-min-microvolt = <1800000>;
326			regulator-max-microvolt = <1800000>;
327		};
328
329		pm8994_l16: l16 {
330			regulator-min-microvolt = <2700000>;
331			regulator-max-microvolt = <2700000>;
332		};
333
334		pm8994_l17: l17 {
335			regulator-min-microvolt = <2200000>;
336			regulator-max-microvolt = <2200000>;
337		};
338
339		pm8994_l18: l18 {
340			regulator-min-microvolt = <2850000>;
341			regulator-max-microvolt = <2850000>;
342			regulator-always-on;
343		};
344
345		pm8994_l19: l19 {
346			regulator-min-microvolt = <2850000>;
347			regulator-max-microvolt = <2850000>;
348		};
349
350		pm8994_l20: l20 {
351			regulator-min-microvolt = <2950000>;
352			regulator-max-microvolt = <2950000>;
353			regulator-always-on;
354			regulator-boot-on;
355			regulator-allow-set-load;
356			regulator-system-load = <570000>;
357		};
358
359		pm8994_l21: l21 {
360			regulator-min-microvolt = <2950000>;
361			regulator-max-microvolt = <2950000>;
362			regulator-always-on;
363			regulator-allow-set-load;
364			regulator-system-load = <800000>;
365		};
366
367		pm8994_l22: l22 {
368			regulator-min-microvolt = <3000000>;
369			regulator-max-microvolt = <3000000>;
370		};
371
372		pm8994_l23: l23 {
373			regulator-min-microvolt = <2800000>;
374			regulator-max-microvolt = <2800000>;
375		};
376
377		pm8994_l24: l24 {
378			regulator-min-microvolt = <3075000>;
379			regulator-max-microvolt = <3150000>;
380		};
381
382		pm8994_l25: l25 {
383			regulator-min-microvolt = <1000000>;
384			regulator-max-microvolt = <1000000>;
385		};
386
387		pm8994_l26: l26 {
388			regulator-min-microvolt = <987500>;
389			regulator-max-microvolt = <987500>;
390		};
391
392		pm8994_l27: l27 {
393			regulator-min-microvolt = <1200000>;
394			regulator-max-microvolt = <1200000>;
395		};
396
397		pm8994_l28: l28 {
398			regulator-min-microvolt = <1000000>;
399			regulator-max-microvolt = <1000000>;
400			regulator-allow-set-load;
401			regulator-system-load = <10000>;
402		};
403
404		pm8994_l29: l29 {
405			regulator-min-microvolt = <2700000>;
406			regulator-max-microvolt = <2700000>;
407		};
408
409		pm8994_l30: l30 {
410			regulator-min-microvolt = <1800000>;
411			regulator-max-microvolt = <1800000>;
412		};
413
414		pm8994_l31: l31 {
415			regulator-min-microvolt = <1200000>;
416			regulator-max-microvolt = <1200000>;
417			regulator-allow-set-load;
418			regulator-system-load = <10000>;
419		};
420
421		pm8994_l32: l32 {
422			regulator-min-microvolt = <1800000>;
423			regulator-max-microvolt = <1800000>;
424		};
425
426		pm8994_lvs1: lvs1 {};
427		pm8994_lvs2: lvs2 {};
428	};
429
430	pmi8994_regulators: pmi8994-regulators {
431		compatible = "qcom,rpm-pmi8994-regulators";
432
433		vdd_s1-supply = <&vph_pwr>;
434		vdd_bst_byp-supply = <&vph_pwr>;
435
436		pmi8994_s1: s1 {
437			regulator-min-microvolt = <1025000>;
438			regulator-max-microvolt = <1025000>;
439		};
440
441		/* S2 & S3 - VDD_GFX */
442
443		pmi8994_bby: boost-bypass {
444			regulator-min-microvolt = <3150000>;
445			regulator-max-microvolt = <3600000>;
446		};
447	};
448};
449
450&sdhc1 {
451	/*
452	 * There is an issue with the eMMC causing permanent
453	 * damage to the card if a quirk isn't addressed.
454	 * Until it's fixed, disable the MMC so as not to brick
455	 * devices.
456	 */
457	status = "disabled";
458
459	/*
460	 * Downstream pushes 2.95V to the sdhci device,
461	 * but upstream driver REALLY wants to make vmmc 1.8v
462	 * cause of the hs400-1_8v mode. MMC works fine without
463	 * that regulator, so let's not use it for now.
464	 * vqmmc is also disabled cause driver stll complains.
465	 *
466	 * vmmc-supply = <&pm8994_l20>;
467	 * vqmmc-supply = <&pm8994_s4>;
468	 */
469};
470
471&sdhc2 {
472	status = "okay";
473
474	cd-gpios = <&tlmm 100 0>;
475	vmmc-supply = <&pm8994_l21>;
476	vqmmc-supply = <&pm8994_l13>;
477};
478
479&tlmm {
480	ts_int_active: ts-int-active {
481		pins = "gpio42";
482		drive-strength = <2>;
483		bias-disable;
484		input-enable;
485	};
486
487	ts_reset_active: ts-reset-active {
488		pins = "gpio109";
489		drive-strength = <2>;
490		bias-disable;
491		output-low;
492	};
493};
494