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