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	pm8994_regulators: pm8994-regulators {
191		compatible = "qcom,rpm-pm8994-regulators";
192
193		vdd_s1-supply = <&vph_pwr>;
194		vdd_s2-supply = <&vph_pwr>;
195		vdd_s3-supply = <&vph_pwr>;
196		vdd_s4-supply = <&vph_pwr>;
197		vdd_s5-supply = <&vph_pwr>;
198		vdd_s6-supply = <&vph_pwr>;
199		vdd_s7-supply = <&vph_pwr>;
200		vdd_s8-supply = <&vph_pwr>;
201		vdd_s9-supply = <&vph_pwr>;
202		vdd_s10-supply = <&vph_pwr>;
203		vdd_s11-supply = <&vph_pwr>;
204		vdd_s12-supply = <&vph_pwr>;
205		vdd_l1-supply = <&pmi8994_s1>;
206		vdd_l2_l26_l28-supply = <&pm8994_s3>;
207		vdd_l3_l11-supply = <&pm8994_s3>;
208		vdd_l4_l27_l31-supply = <&pm8994_s3>;
209		vdd_l5_l7-supply = <&pm8994_s5>;
210		vdd_l6_l12_l32-supply = <&pm8994_s5>;
211		vdd_l8_l16_l30-supply = <&vph_pwr>;
212		vdd_l9_l10_l18_l22-supply = <&pmi8994_bby>;
213		vdd_l13_l19_l23_l24-supply = <&pmi8994_bby>;
214		vdd_l14_l15-supply = <&pm8994_s5>;
215		vdd_l17_l29-supply = <&pmi8994_bby>;
216		vdd_l20_l21-supply = <&pmi8994_bby>;
217		vdd_l25-supply = <&pm8994_s3>;
218		vdd_lvs1_2-supply = <&pm8994_s4>;
219
220		/* S1, S2, S6 and S12 are managed by RPMPD */
221
222		pm8994_s3: s3 {
223			regulator-min-microvolt = <1300000>;
224			regulator-max-microvolt = <1300000>;
225		};
226
227		pm8994_s4: s4 {
228			regulator-min-microvolt = <1800000>;
229			regulator-max-microvolt = <1800000>;
230			regulator-allow-set-load;
231			regulator-always-on;
232			regulator-system-load = <325000>;
233		};
234
235		pm8994_s5: s5 {
236			regulator-min-microvolt = <2150000>;
237			regulator-max-microvolt = <2150000>;
238		};
239
240		pm8994_s7: s7 {
241			regulator-min-microvolt = <1000000>;
242			regulator-max-microvolt = <1000000>;
243		};
244
245		/*
246		 * S8 - SPMI-managed VDD_APC0
247		 * S9, S10 and S11 (the main one) - SPMI-managed VDD_APC1
248		 */
249
250		pm8994_l1: l1 {
251			regulator-min-microvolt = <1000000>;
252			regulator-max-microvolt = <1000000>;
253		};
254
255		pm8994_l2: l2 {
256			regulator-min-microvolt = <1250000>;
257			regulator-max-microvolt = <1250000>;
258			regulator-allow-set-load;
259			regulator-system-load = <10000>;
260		};
261
262		pm8994_l3: l3 {
263			regulator-min-microvolt = <1100000>;
264			regulator-max-microvolt = <1100000>;
265		};
266
267		pm8994_l4: l4 {
268			regulator-min-microvolt = <1225000>;
269			regulator-max-microvolt = <1225000>;
270		};
271
272		/* L5 is inaccessible from RPM */
273
274		pm8994_l6: l6 {
275			regulator-min-microvolt = <1800000>;
276			regulator-max-microvolt = <1800000>;
277		};
278
279		/* L7 is inaccessible from RPM */
280
281		pm8994_l8: l8 {
282			regulator-min-microvolt = <1800000>;
283			regulator-max-microvolt = <1800000>;
284		};
285
286		pm8994_l9: l9 {
287			regulator-min-microvolt = <1800000>;
288			regulator-max-microvolt = <1800000>;
289		};
290
291		pm8994_l10: l10 {
292			regulator-min-microvolt = <1800000>;
293			regulator-max-microvolt = <1800000>;
294		};
295
296		pm8994_l11: l11 {
297			regulator-min-microvolt = <1200000>;
298			regulator-max-microvolt = <1200000>;
299		};
300
301		pm8994_l12: l12 {
302			regulator-min-microvolt = <1800000>;
303			regulator-max-microvolt = <1800000>;
304			regulator-allow-set-load;
305			regulator-system-load = <10000>;
306		};
307
308		pm8994_l13: l13 {
309			regulator-min-microvolt = <1800000>;
310			regulator-max-microvolt = <2950000>;
311		};
312
313		pm8994_l14: l14 {
314			regulator-min-microvolt = <1800000>;
315			regulator-max-microvolt = <1800000>;
316			regulator-allow-set-load;
317			regulator-system-load = <10000>;
318		};
319
320		pm8994_l15: l15 {
321			regulator-min-microvolt = <1800000>;
322			regulator-max-microvolt = <1800000>;
323		};
324
325		pm8994_l16: l16 {
326			regulator-min-microvolt = <2700000>;
327			regulator-max-microvolt = <2700000>;
328		};
329
330		pm8994_l17: l17 {
331			regulator-min-microvolt = <2200000>;
332			regulator-max-microvolt = <2200000>;
333		};
334
335		pm8994_l18: l18 {
336			regulator-min-microvolt = <2850000>;
337			regulator-max-microvolt = <2850000>;
338			regulator-always-on;
339		};
340
341		pm8994_l19: l19 {
342			regulator-min-microvolt = <2850000>;
343			regulator-max-microvolt = <2850000>;
344		};
345
346		pm8994_l20: l20 {
347			regulator-min-microvolt = <2950000>;
348			regulator-max-microvolt = <2950000>;
349			regulator-always-on;
350			regulator-boot-on;
351			regulator-allow-set-load;
352			regulator-system-load = <570000>;
353		};
354
355		pm8994_l21: l21 {
356			regulator-min-microvolt = <2950000>;
357			regulator-max-microvolt = <2950000>;
358			regulator-always-on;
359			regulator-allow-set-load;
360			regulator-system-load = <800000>;
361		};
362
363		pm8994_l22: l22 {
364			regulator-min-microvolt = <3000000>;
365			regulator-max-microvolt = <3000000>;
366		};
367
368		pm8994_l23: l23 {
369			regulator-min-microvolt = <2800000>;
370			regulator-max-microvolt = <2800000>;
371		};
372
373		pm8994_l24: l24 {
374			regulator-min-microvolt = <3075000>;
375			regulator-max-microvolt = <3150000>;
376		};
377
378		pm8994_l25: l25 {
379			regulator-min-microvolt = <1000000>;
380			regulator-max-microvolt = <1000000>;
381		};
382
383		pm8994_l26: l26 {
384			regulator-min-microvolt = <987500>;
385			regulator-max-microvolt = <987500>;
386		};
387
388		pm8994_l27: l27 {
389			regulator-min-microvolt = <1200000>;
390			regulator-max-microvolt = <1200000>;
391		};
392
393		pm8994_l28: l28 {
394			regulator-min-microvolt = <1000000>;
395			regulator-max-microvolt = <1000000>;
396			regulator-allow-set-load;
397			regulator-system-load = <10000>;
398		};
399
400		pm8994_l29: l29 {
401			regulator-min-microvolt = <2700000>;
402			regulator-max-microvolt = <2700000>;
403		};
404
405		pm8994_l30: l30 {
406			regulator-min-microvolt = <1800000>;
407			regulator-max-microvolt = <1800000>;
408		};
409
410		pm8994_l31: l31 {
411			regulator-min-microvolt = <1200000>;
412			regulator-max-microvolt = <1200000>;
413			regulator-allow-set-load;
414			regulator-system-load = <10000>;
415		};
416
417		pm8994_l32: l32 {
418			regulator-min-microvolt = <1800000>;
419			regulator-max-microvolt = <1800000>;
420		};
421
422		pm8994_lvs1: lvs1 {};
423		pm8994_lvs2: lvs2 {};
424	};
425
426	pmi8994_regulators: pmi8994-regulators {
427		compatible = "qcom,rpm-pmi8994-regulators";
428
429		vdd_s1-supply = <&vph_pwr>;
430		vdd_bst_byp-supply = <&vph_pwr>;
431
432		pmi8994_s1: s1 {
433			regulator-min-microvolt = <1025000>;
434			regulator-max-microvolt = <1025000>;
435		};
436
437		/* S2 & S3 - VDD_GFX */
438
439		pmi8994_bby: boost-bypass {
440			regulator-min-microvolt = <3150000>;
441			regulator-max-microvolt = <3600000>;
442		};
443	};
444};
445
446&sdhc1 {
447	/*
448	 * There is an issue with the eMMC causing permanent
449	 * damage to the card if a quirk isn't addressed.
450	 * Until it's fixed, disable the MMC so as not to brick
451	 * devices.
452	 */
453	status = "disabled";
454
455	/*
456	 * Downstream pushes 2.95V to the sdhci device,
457	 * but upstream driver REALLY wants to make vmmc 1.8v
458	 * cause of the hs400-1_8v mode. MMC works fine without
459	 * that regulator, so let's not use it for now.
460	 * vqmmc is also disabled cause driver stll complains.
461	 *
462	 * vmmc-supply = <&pm8994_l20>;
463	 * vqmmc-supply = <&pm8994_s4>;
464	 */
465};
466
467&sdhc2 {
468	status = "okay";
469
470	cd-gpios = <&tlmm 100 0>;
471	vmmc-supply = <&pm8994_l21>;
472	vqmmc-supply = <&pm8994_l13>;
473};
474
475&tlmm {
476	ts_int_active: ts-int-active {
477		pins = "gpio42";
478		drive-strength = <2>;
479		bias-disable;
480		input-enable;
481	};
482
483	ts_reset_active: ts-reset-active {
484		pins = "gpio109";
485		drive-strength = <2>;
486		bias-disable;
487		output-low;
488	};
489};
490