1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Konrad Dybcio
4 */
5
6/dts-v1/;
7
8#include "msm8992.dtsi"
9#include "pm8994.dtsi"
10#include "pmi8994.dtsi"
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/gpio-keys.h>
13
14/ {
15	model = "Xiaomi Mi 4C";
16	compatible = "xiaomi,libra", "qcom,msm8992";
17	chassis-type = "handset";
18
19	/* required for bootloader to select correct board */
20	qcom,msm-id = <251 0 252 0>;
21	qcom,pmic-id = <65545 65546 0 0>;
22	qcom,board-id = <12 0>;
23
24	/* This enables graphical output via bootloader-enabled display */
25	chosen {
26		bootargs = "earlycon=tty0 console=tty0";
27
28		#address-cells = <2>;
29		#size-cells = <2>;
30		ranges;
31
32		framebuffer0: framebuffer@3404000 {
33			status= "okay";
34			compatible = "simple-framebuffer";
35			reg = <0 0x3404000 0 (1080 * 1920 * 3)>;
36			width = <1080>;
37			height = <1920>;
38			stride = <(1080 * 3)>;
39			format = "r8g8b8";
40		};
41	};
42
43	gpio_keys {
44		compatible = "gpio-keys";
45		#address-cells = <1>;
46		#size-cells = <0>;
47		autorepeat;
48
49		button@0 {
50			label = "Volume Up";
51			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
52			linux,input-type = <1>;
53			linux,code = <KEY_VOLUMEUP>;
54			wakeup-source;
55			debounce-interval = <15>;
56		};
57	};
58
59	reserved-memory {
60		#address-cells = <2>;
61		#size-cells = <2>;
62		ranges;
63
64		/* This is for getting crash logs using Android downstream kernels */
65		ramoops@dfc00000 {
66			compatible = "ramoops";
67			reg = <0x0 0xdfc00000 0x0 0x40000>;
68			console-size = <0x10000>;
69			record-size = <0x10000>;
70			ftrace-size = <0x10000>;
71			pmsg-size = <0x20000>;
72		};
73
74		modem_region: modem_region@9000000 {
75			reg = <0x0 0x9000000 0x0 0x5a00000>;
76			no-map;
77		};
78
79		tzapp: modem_region@ea00000 {
80			reg = <0x0 0xea00000 0x0 0x1900000>;
81			no-map;
82		};
83	};
84};
85
86&blsp1_i2c2 {
87	status = "okay";
88
89	/* Atmel or Synaptics touchscreen */
90};
91
92&blsp1_i2c5 {
93	status = "okay";
94
95	/* ST lsm6db0 gyro/accelerometer */
96};
97
98&blsp1_i2c6 {
99	status = "okay";
100
101	/*
102	 * NXP NCI NFC,
103	 * TI USB320 Type-C controller,
104	 * Pericom 30216a USB (de)mux switch
105	 */
106};
107
108&blsp2_i2c1 {
109	status = "okay";
110
111	/* cm36686 proximity and ambient light sensor */
112};
113
114&blsp2_i2c5 {
115	status = "okay";
116
117	/* Silabs si4705 FM transmitter */
118};
119
120&blsp2_uart2 {
121	status = "okay";
122};
123
124&peripheral_region {
125	reg = <0x0 0x7400000 0x0 0x1c00000>;
126	no-map;
127};
128
129&rpm_requests {
130	pm8994-regulators {
131		compatible = "qcom,rpm-pm8994-regulators";
132
133		vdd_l1-supply = <&pm8994_s7>;
134		vdd_l2_26_28-supply = <&pm8994_s3>;
135		vdd_l3_11-supply = <&pm8994_s3>;
136		vdd_l4_27_31-supply = <&pm8994_s3>;
137		vdd_l5_7-supply = <&pm8994_s3>;
138		vdd_l6_12_32-supply = <&pm8994_s5>;
139		vdd_l8_16_30-supply = <&vph_pwr>;
140		vdd_l9_10_18_22-supply = <&vph_pwr>;
141		vdd_l13_19_23_24-supply = <&vph_pwr>;
142		vdd_l14_15-supply = <&pm8994_s5>;
143		vdd_l17_29-supply = <&vph_pwr>;
144		vdd_l20_21-supply = <&vph_pwr>;
145		vdd_l25-supply = <&pm8994_s5>;
146		vdd_lvs1_2 = <&pm8994_s4>;
147
148		/* S1, S2, S6 and S12 are managed by RPMPD */
149
150		pm8994_s3: s3 {
151			regulator-min-microvolt = <1300000>;
152			regulator-max-microvolt = <1300000>;
153		};
154
155		pm8994_s4: s4 {
156			regulator-min-microvolt = <1800000>;
157			regulator-max-microvolt = <1800000>;
158			regulator-allow-set-load;
159			regulator-always-on;
160			regulator-system-load = <325000>;
161		};
162
163		pm8994_s5: s5 {
164			regulator-min-microvolt = <2150000>;
165			regulator-max-microvolt = <2150000>;
166		};
167
168		pm8994_s7: s7 {
169			regulator-min-microvolt = <1000000>;
170			regulator-max-microvolt = <1000000>;
171		};
172
173		/* S8, S9, S10 and S11 - SPMI-managed VDD_APC */
174
175		pm8994_l1: l1 {
176			regulator-min-microvolt = <1000000>;
177			regulator-max-microvolt = <1000000>;
178		};
179
180		pm8994_l2: l2 {
181			regulator-min-microvolt = <1250000>;
182			regulator-max-microvolt = <1250000>;
183		};
184
185		pm8994_l3: l3 {
186			regulator-min-microvolt = <1200000>;
187			regulator-max-microvolt = <1200000>;
188		};
189
190		pm8994_l4: l4 {
191			regulator-min-microvolt = <1225000>;
192			regulator-max-microvolt = <1225000>;
193		};
194
195		/* L5 is inaccessible from RPM */
196
197		pm8994_l6: l6 {
198			regulator-min-microvolt = <1800000>;
199			regulator-max-microvolt = <1800000>;
200		};
201
202		/* L7 is inaccessible from RPM */
203
204		pm8994_l8: l8 {
205			regulator-min-microvolt = <1800000>;
206			regulator-max-microvolt = <1800000>;
207		};
208
209		pm8994_l9: l9 {
210			regulator-min-microvolt = <1800000>;
211			regulator-max-microvolt = <1800000>;
212		};
213
214		pm8994_l10: l10 {
215			regulator-min-microvolt = <1800000>;
216			regulator-max-microvolt = <1800000>;
217		};
218
219		pm8994_l11: l11 {
220			regulator-min-microvolt = <1200000>;
221			regulator-max-microvolt = <1200000>;
222		};
223
224		pm8994_l12: l12 {
225			regulator-min-microvolt = <1800000>;
226			regulator-max-microvolt = <1800000>;
227		};
228
229		pm8994_l13: l13 {
230			regulator-min-microvolt = <1800000>;
231			regulator-max-microvolt = <2950000>;
232		};
233
234		pm8994_l14: l14 {
235			regulator-min-microvolt = <1800000>;
236			regulator-max-microvolt = <1800000>;
237		};
238
239		pm8994_l15: l15 {
240			regulator-min-microvolt = <1800000>;
241			regulator-max-microvolt = <1800000>;
242		};
243
244		pm8994_l16: l16 {
245			regulator-min-microvolt = <2700000>;
246			regulator-max-microvolt = <2700000>;
247		};
248
249		pm8994_l17: l17 {
250			regulator-min-microvolt = <2700000>;
251			regulator-max-microvolt = <2700000>;
252		};
253
254		pm8994_l18: l18 {
255			regulator-min-microvolt = <2850000>;
256			regulator-max-microvolt = <2850000>;
257			regulator-always-on;
258		};
259
260		pm8994_l19: l19 {
261			regulator-min-microvolt = <2800000>;
262			regulator-max-microvolt = <2800000>;
263		};
264
265		pm8994_l20: l20 {
266			regulator-min-microvolt = <2950000>;
267			regulator-max-microvolt = <2950000>;
268			regulator-always-on;
269			regulator-boot-on;
270			regulator-allow-set-load;
271			regulator-system-load = <570000>;
272		};
273
274		pm8994_l21: l21 {
275			regulator-min-microvolt = <2950000>;
276			regulator-max-microvolt = <2950000>;
277			regulator-always-on;
278		};
279
280		pm8994_l22: l22 {
281			regulator-min-microvolt = <3000000>;
282			regulator-max-microvolt = <3000000>;
283		};
284
285		pm8994_l23: l23 {
286			regulator-min-microvolt = <2800000>;
287			regulator-max-microvolt = <2800000>;
288		};
289
290		pm8994_l24: l24 {
291			regulator-min-microvolt = <3075000>;
292			regulator-max-microvolt = <3150000>;
293		};
294
295		pm8994_l25: l25 {
296			regulator-min-microvolt = <1000000>;
297			regulator-max-microvolt = <1000000>;
298		};
299
300		pm8994_l26: l26 {
301			regulator-min-microvolt = <987500>;
302			regulator-max-microvolt = <987500>;
303
304		};
305
306		pm8994_l27: l27 {
307			regulator-min-microvolt = <1050000>;
308			regulator-max-microvolt = <1050000>;
309		};
310
311		pm8994_l28: l28 {
312			regulator-min-microvolt = <1000000>;
313			regulator-max-microvolt = <1000000>;
314		};
315
316		pm8994_l29: l29 {
317			regulator-min-microvolt = <2800000>;
318			regulator-max-microvolt = <2800000>;
319		};
320
321		pm8994_l30: l30 {
322			regulator-min-microvolt = <1800000>;
323			regulator-max-microvolt = <1800000>;
324		};
325
326		pm8994_l31: l31 {
327			regulator-min-microvolt = <1262500>;
328			regulator-max-microvolt = <1262500>;
329		};
330
331		pm8994_l32: l32 {
332			regulator-min-microvolt = <1800000>;
333			regulator-max-microvolt = <1800000>;
334		};
335
336		pm8994_lvs1: lvs1 {};
337		pm8994_lvs2: lvs2 {};
338	};
339
340	pmi8994_regulators: pmi8994-regulators {
341		compatible = "qcom,rpm-pmi8994-regulators";
342		vdd_s1-supply = <&vph_pwr>;
343		vdd_bst_byp-supply = <&vph_pwr>;
344
345		pmi8994_s1: s1 {
346			regulator-min-microvolt = <1025000>;
347			regulator-max-microvolt = <1025000>;
348		};
349
350		/* S2 & S3 - VDD_GFX */
351
352		pmi8994_bby: boost-bypass {
353			regulator-min-microvolt = <3150000>;
354			regulator-max-microvolt = <3600000>;
355		};
356	};
357};
358
359&sdhc1 {
360	status = "okay";
361
362	mmc-hs400-1_8v;
363	vmmc-supply = <&pm8994_l20>;
364	vqmmc-supply = <&pm8994_s4>;
365};
366