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		continuous_splash: framebuffer@3401000{
74			reg = <0x0 0x3401000 0x0 0x2200000>;
75			no-map;
76		};
77
78		dfps_data_mem: dfps_data_mem@3400000 {
79			reg = <0x0 0x3400000 0x0 0x1000>;
80			no-map;
81		};
82
83		peripheral_region: peripheral_region@7400000 {
84			reg = <0x0 0x7400000 0x0 0x1c00000>;
85			no-map;
86		};
87
88		modem_region: modem_region@9000000 {
89			reg = <0x0 0x9000000 0x0 0x5a00000>;
90			no-map;
91		};
92
93		tzapp: modem_region@ea00000 {
94			reg = <0x0 0xea00000 0x0 0x1900000>;
95			no-map;
96		};
97	};
98};
99
100&blsp_i2c2 {
101	status = "okay";
102
103	/* Atmel or Synaptics touchscreen */
104};
105
106&blsp_i2c5 {
107	status = "okay";
108
109	/* Silabs si4705 FM transmitter */
110};
111
112&blsp_i2c6 {
113	status = "okay";
114
115	/* NCI NFC,
116	 * TI USB320 Type-C controller,
117	 * Pericom 30216a USB (de)mux switch
118	 */
119};
120
121&blsp_i2c7 {
122	status = "okay";
123
124	/* cm36686 proximity and ambient light sensor */
125};
126
127&blsp_i2c13 {
128	status = "okay";
129
130	/* ST lsm6db0 gyro/accelerometer */
131};
132
133&blsp2_uart2 {
134	status = "okay";
135};
136
137&rpm_requests {
138	pm8994-regulators {
139		compatible = "qcom,rpm-pm8994-regulators";
140
141		vdd_l1-supply = <&pm8994_s7>;
142		vdd_l2_26_28-supply = <&pm8994_s3>;
143		vdd_l3_11-supply = <&pm8994_s3>;
144		vdd_l4_27_31-supply = <&pm8994_s3>;
145		vdd_l5_7-supply = <&pm8994_s3>;
146		vdd_l6_12_32-supply = <&pm8994_s5>;
147		vdd_l8_16_30-supply = <&vreg_vph_pwr>;
148		vdd_l9_10_18_22-supply = <&vreg_vph_pwr>;
149		vdd_l13_19_23_24-supply = <&vreg_vph_pwr>;
150		vdd_l14_15-supply = <&pm8994_s5>;
151		vdd_l17_29-supply = <&vreg_vph_pwr>;
152		vdd_l20_21-supply = <&vreg_vph_pwr>;
153		vdd_l25-supply = <&pm8994_s5>;
154		vdd_lvs1_2 = <&pm8994_s4>;
155
156		pm8994_s1: s1 {
157			/* unused */
158			status = "disabled";
159		};
160
161		pm8994_s2: s2 {
162			/* unused */
163			status = "disabled";
164		};
165
166		pm8994_s3: s3 {
167			regulator-min-microvolt = <1300000>;
168			regulator-max-microvolt = <1300000>;
169		};
170
171		pm8994_s4: s4 {
172			regulator-min-microvolt = <1800000>;
173			regulator-max-microvolt = <1800000>;
174			regulator-allow-set-load;
175			regulator-always-on;
176			regulator-system-load = <325000>;
177		};
178
179		pm8994_s5: s5 {
180			regulator-min-microvolt = <2150000>;
181			regulator-max-microvolt = <2150000>;
182		};
183
184		pm8994_s7: s7 {
185			regulator-min-microvolt = <1000000>;
186			regulator-max-microvolt = <1000000>;
187		};
188
189		pm8994_l1: l1 {
190			regulator-min-microvolt = <1000000>;
191			regulator-max-microvolt = <1000000>;
192		};
193
194		pm8994_l2: l2 {
195			regulator-min-microvolt = <1250000>;
196			regulator-max-microvolt = <1250000>;
197		};
198
199		pm8994_l3: l3 {
200			regulator-min-microvolt = <1200000>;
201			regulator-max-microvolt = <1200000>;
202		};
203
204		pm8994_l4: l4 {
205			regulator-min-microvolt = <1225000>;
206			regulator-max-microvolt = <1225000>;
207		};
208
209		pm8994_l5: l5 {
210			/* unused */
211			status = "disabled";
212		};
213
214		pm8994_l6: l6 {
215			regulator-min-microvolt = <1800000>;
216			regulator-max-microvolt = <1800000>;
217		};
218
219		pm8994_l7: l7 {
220			/* unused */
221			status = "disabled";
222		};
223
224		pm8994_l8: l8 {
225			regulator-min-microvolt = <1800000>;
226			regulator-max-microvolt = <1800000>;
227		};
228
229		pm8994_l9: l9 {
230			regulator-min-microvolt = <1800000>;
231			regulator-max-microvolt = <1800000>;
232		};
233
234		pm8994_l10: l10 {
235			regulator-min-microvolt = <1800000>;
236			regulator-max-microvolt = <1800000>;
237		};
238
239		pm8994_l11: l11 {
240			regulator-min-microvolt = <1200000>;
241			regulator-max-microvolt = <1200000>;
242		};
243
244		pm8994_l12: l12 {
245			regulator-min-microvolt = <1800000>;
246			regulator-max-microvolt = <1800000>;
247		};
248
249		pm8994_l13: l13 {
250			regulator-min-microvolt = <1800000>;
251			regulator-max-microvolt = <2950000>;
252		};
253
254		pm8994_l14: l14 {
255			regulator-min-microvolt = <1800000>;
256			regulator-max-microvolt = <1800000>;
257		};
258
259		pm8994_l15: l15 {
260			regulator-min-microvolt = <1800000>;
261			regulator-max-microvolt = <1800000>;
262		};
263
264		pm8994_l16: l16 {
265			regulator-min-microvolt = <2700000>;
266			regulator-max-microvolt = <2700000>;
267		};
268
269		pm8994_l17: l17 {
270			regulator-min-microvolt = <2700000>;
271			regulator-max-microvolt = <2700000>;
272		};
273
274		pm8994_l18: l18 {
275			regulator-min-microvolt = <2850000>;
276			regulator-max-microvolt = <2850000>;
277			regulator-always-on;
278		};
279
280		pm8994_l19: l19 {
281			regulator-min-microvolt = <2800000>;
282			regulator-max-microvolt = <2800000>;
283		};
284
285		pm8994_l20: l20 {
286			regulator-min-microvolt = <2950000>;
287			regulator-max-microvolt = <2950000>;
288			regulator-always-on;
289			regulator-boot-on;
290			regulator-allow-set-load;
291			regulator-system-load = <570000>;
292		};
293
294		pm8994_l21: l21 {
295			regulator-min-microvolt = <2950000>;
296			regulator-max-microvolt = <2950000>;
297			regulator-always-on;
298		};
299
300		pm8994_l22: l22 {
301			regulator-min-microvolt = <3000000>;
302			regulator-max-microvolt = <3000000>;
303		};
304
305		pm8994_l23: l23 {
306			regulator-min-microvolt = <2800000>;
307			regulator-max-microvolt = <2800000>;
308		};
309
310		pm8994_l24: l24 {
311			regulator-min-microvolt = <3075000>;
312			regulator-max-microvolt = <3150000>;
313		};
314
315		pm8994_l25: l25 {
316			regulator-min-microvolt = <1000000>;
317			regulator-max-microvolt = <1000000>;
318		};
319
320		pm8994_l26: l26 {
321			regulator-min-microvolt = <987500>;
322			regulator-max-microvolt = <987500>;
323
324		};
325
326		pm8994_l27: l27 {
327			regulator-min-microvolt = <1050000>;
328			regulator-max-microvolt = <1050000>;
329		};
330
331		pm8994_l28: l28 {
332			regulator-min-microvolt = <1000000>;
333			regulator-max-microvolt = <1000000>;
334		};
335
336		pm8994_l29: l29 {
337			regulator-min-microvolt = <2800000>;
338			regulator-max-microvolt = <2800000>;
339		};
340
341		pm8994_l30: l30 {
342			regulator-min-microvolt = <1800000>;
343			regulator-max-microvolt = <1800000>;
344		};
345
346		pm8994_l31: l31 {
347			regulator-min-microvolt = <1262500>;
348			regulator-max-microvolt = <1262500>;
349		};
350
351		pm8994_l32: l32 {
352			regulator-min-microvolt = <1800000>;
353			regulator-max-microvolt = <1800000>;
354		};
355	};
356};
357
358&sdhc_1 {
359	status = "okay";
360
361	mmc-hs400-1_8v;
362	vmmc-supply = <&pm8994_l20>;
363	vqmmc-supply = <&pm8994_s4>;
364};
365