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