xref: /linux/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi (revision 02680c23d7b3febe45ea3d4f9818c2b2dc89020a)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.xyz>
3// Copyright (C) 2020 Martijn Braam <martijn@brixit.nl>
4// Copyright (C) 2020 Ondrej Jirman <megous@megous.com>
5
6#include "sun50i-a64.dtsi"
7#include "sun50i-a64-cpu-opp.dtsi"
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/leds/common.h>
12#include <dt-bindings/pwm/pwm.h>
13
14/ {
15	aliases {
16		ethernet0 = &rtl8723cs;
17		serial0 = &uart0;
18	};
19
20	backlight: backlight {
21		compatible = "pwm-backlight";
22		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
23		enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
24		power-supply = <&reg_ps>;
25		/* Backlight configuration differs per PinePhone revision. */
26	};
27
28	chosen {
29		stdout-path = "serial0:115200n8";
30	};
31
32	leds {
33		compatible = "gpio-leds";
34
35		led-0 {
36			function = LED_FUNCTION_INDICATOR;
37			color = <LED_COLOR_ID_BLUE>;
38			gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
39		};
40
41		led-1 {
42			function = LED_FUNCTION_INDICATOR;
43			color = <LED_COLOR_ID_GREEN>;
44			gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */
45		};
46
47		led-2 {
48			function = LED_FUNCTION_INDICATOR;
49			color = <LED_COLOR_ID_RED>;
50			gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
51		};
52	};
53
54	reg_ps: ps-regulator {
55		compatible = "regulator-fixed";
56		regulator-name = "ps";
57		regulator-min-microvolt = <5000000>;
58		regulator-max-microvolt = <5000000>;
59		regulator-boot-on;
60	};
61
62	reg_vbat_wifi: vbat-wifi {
63		compatible = "regulator-fixed";
64		regulator-min-microvolt = <3300000>;
65		regulator-max-microvolt = <3300000>;
66		regulator-name = "vbat-wifi";
67	};
68
69	sgm3140: led-controller {
70		compatible = "sgmicro,sgm3140";
71		vin-supply = <&reg_dcdc1>;
72
73		sgm3140_flash: led {
74			function = LED_FUNCTION_FLASH;
75			color = <LED_COLOR_ID_WHITE>;
76			flash-max-timeout-us = <250000>;
77		};
78	};
79
80	speaker_amp: audio-amplifier {
81		compatible = "simple-audio-amplifier";
82		enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */
83		sound-name-prefix = "Speaker Amp";
84	};
85
86	vibrator {
87		compatible = "gpio-vibrator";
88		enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */
89		vcc-supply = <&reg_dcdc1>;
90	};
91};
92
93&codec {
94	status = "okay";
95};
96
97&codec_analog {
98	cpvdd-supply = <&reg_eldo1>;
99	status = "okay";
100};
101
102&cpu0 {
103	cpu-supply = <&reg_dcdc2>;
104};
105
106&cpu1 {
107	cpu-supply = <&reg_dcdc2>;
108};
109
110&cpu2 {
111	cpu-supply = <&reg_dcdc2>;
112};
113
114&cpu3 {
115	cpu-supply = <&reg_dcdc2>;
116};
117
118&dai {
119	status = "okay";
120};
121
122&de {
123	status = "okay";
124};
125
126&dphy {
127	status = "okay";
128};
129
130&dsi {
131	vcc-dsi-supply = <&reg_dldo1>;
132	status = "okay";
133
134	panel@0 {
135		compatible = "xingbangda,xbd599";
136		reg = <0>;
137		reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */
138		iovcc-supply = <&reg_dldo2>;
139		vcc-supply = <&reg_ldo_io0>;
140		backlight = <&backlight>;
141	};
142};
143
144&ehci0 {
145	status = "okay";
146};
147
148&ehci1 {
149	status = "okay";
150};
151
152&i2c0 {
153	status = "okay";
154
155	touchscreen@5d {
156		compatible = "goodix,gt917s";
157		reg = <0x5d>;
158		interrupt-parent = <&pio>;
159		interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */
160		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
161		reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
162		AVDD28-supply = <&reg_ldo_io0>;
163		VDDIO-supply = <&reg_ldo_io0>;
164		touchscreen-size-x = <720>;
165		touchscreen-size-y = <1440>;
166	};
167};
168
169&i2c1 {
170	status = "okay";
171
172	/* Magnetometer */
173	lis3mdl: magnetometer@1e {
174		compatible = "st,lis3mdl-magn";
175		reg = <0x1e>;
176		vdd-supply = <&reg_dldo1>;
177		vddio-supply = <&reg_dldo1>;
178	};
179
180	/* Light/proximity sensor */
181	light-sensor@48 {
182		compatible = "sensortek,stk3311";
183		reg = <0x48>;
184		interrupt-parent = <&pio>;
185		interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */
186	};
187
188	/* Accelerometer/gyroscope */
189	accelerometer@68 {
190		compatible = "invensense,mpu6050";
191		reg = <0x68>;
192		interrupt-parent = <&pio>;
193		interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */
194		vdd-supply = <&reg_dldo1>;
195		vddio-supply = <&reg_dldo1>;
196	};
197};
198
199/* Connected to pogo pins (external spring based pinheader for user addons) */
200&i2c2 {
201	status = "okay";
202};
203
204&lradc {
205	vref-supply = <&reg_aldo3>;
206	wakeup-source;
207	status = "okay";
208
209	button-200 {
210		label = "Volume Up";
211		linux,code = <KEY_VOLUMEUP>;
212		channel = <0>;
213		voltage = <200000>;
214	};
215
216	button-400 {
217		label = "Volume Down";
218		linux,code = <KEY_VOLUMEDOWN>;
219		channel = <0>;
220		voltage = <400000>;
221	};
222};
223
224&mmc0 {
225	pinctrl-names = "default";
226	pinctrl-0 = <&mmc0_pins>;
227	vmmc-supply = <&reg_dcdc1>;
228	vqmmc-supply = <&reg_dcdc1>;
229	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
230	disable-wp;
231	bus-width = <4>;
232	status = "okay";
233};
234
235&mmc1 {
236	pinctrl-names = "default";
237	pinctrl-0 = <&mmc1_pins>;
238	vmmc-supply = <&reg_vbat_wifi>;
239	vqmmc-supply = <&reg_dldo4>;
240	bus-width = <4>;
241	non-removable;
242	status = "okay";
243
244	rtl8723cs: wifi@1 {
245		reg = <1>;
246	};
247};
248
249&mmc2 {
250	pinctrl-names = "default";
251	pinctrl-0 = <&mmc2_pins>;
252	vmmc-supply = <&reg_dcdc1>;
253	vqmmc-supply = <&reg_dcdc1>;
254	bus-width = <8>;
255	non-removable;
256	cap-mmc-hw-reset;
257	status = "okay";
258};
259
260&ohci0 {
261	status = "okay";
262};
263
264&ohci1 {
265	status = "okay";
266};
267
268&pio {
269	vcc-pb-supply = <&reg_dcdc1>;
270	vcc-pc-supply = <&reg_dcdc1>;
271	vcc-pd-supply = <&reg_dcdc1>;
272	vcc-pe-supply = <&reg_aldo1>;
273	vcc-pf-supply = <&reg_dcdc1>;
274	vcc-pg-supply = <&reg_dldo4>;
275	vcc-ph-supply = <&reg_dcdc1>;
276};
277
278&r_pio {
279	/*
280	 * FIXME: We can't add that supply for now since it would
281	 * create a circular dependency between pinctrl, the regulator
282	 * and the RSB Bus.
283	 *
284	 * vcc-pl-supply = <&reg_aldo2>;
285	 */
286};
287
288&r_pwm {
289	status = "okay";
290};
291
292&r_rsb {
293	status = "okay";
294
295	axp803: pmic@3a3 {
296		compatible = "x-powers,axp803";
297		reg = <0x3a3>;
298		interrupt-parent = <&r_intc>;
299		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
300	};
301};
302
303#include "axp803.dtsi"
304
305&battery_power_supply {
306	status = "okay";
307};
308
309&reg_aldo1 {
310	regulator-min-microvolt = <1800000>;
311	regulator-max-microvolt = <1800000>;
312	regulator-name = "dovdd-csi";
313};
314
315&reg_aldo2 {
316	regulator-always-on;
317	regulator-min-microvolt = <1800000>;
318	regulator-max-microvolt = <1800000>;
319	regulator-name = "vcc-pl";
320};
321
322&reg_aldo3 {
323	regulator-always-on;
324	regulator-min-microvolt = <3000000>;
325	regulator-max-microvolt = <3000000>;
326	regulator-name = "vcc-pll-avcc";
327};
328
329&reg_dcdc1 {
330	regulator-always-on;
331	regulator-min-microvolt = <3300000>;
332	regulator-max-microvolt = <3300000>;
333	regulator-name = "vcc-3v3";
334};
335
336&reg_dcdc2 {
337	regulator-always-on;
338	regulator-min-microvolt = <1000000>;
339	regulator-max-microvolt = <1300000>;
340	regulator-name = "vdd-cpux";
341};
342
343/* DCDC3 is polyphased with DCDC2 */
344
345&reg_dcdc5 {
346	regulator-always-on;
347	regulator-min-microvolt = <1200000>;
348	regulator-max-microvolt = <1200000>;
349	regulator-name = "vcc-dram";
350};
351
352&reg_dcdc6 {
353	regulator-always-on;
354	regulator-min-microvolt = <1100000>;
355	regulator-max-microvolt = <1100000>;
356	regulator-name = "vdd-sys";
357};
358
359&reg_dldo1 {
360	regulator-min-microvolt = <3300000>;
361	regulator-max-microvolt = <3300000>;
362	regulator-name = "vcc-dsi-sensor";
363};
364
365&reg_dldo2 {
366	regulator-min-microvolt = <1800000>;
367	regulator-max-microvolt = <1800000>;
368	regulator-name = "vcc-mipi-io";
369};
370
371&reg_dldo3 {
372	regulator-min-microvolt = <2800000>;
373	regulator-max-microvolt = <2800000>;
374	regulator-name = "avdd-csi";
375};
376
377&reg_dldo4 {
378	regulator-min-microvolt = <1800000>;
379	regulator-max-microvolt = <1800000>;
380	regulator-name = "vcc-wifi-io";
381};
382
383&reg_eldo1 {
384	regulator-always-on;
385	regulator-min-microvolt = <1800000>;
386	regulator-max-microvolt = <1800000>;
387	regulator-name = "vcc-lpddr";
388};
389
390&reg_eldo3 {
391	regulator-min-microvolt = <1800000>;
392	regulator-max-microvolt = <1800000>;
393	regulator-name = "dvdd-1v8-csi";
394};
395
396&reg_fldo1 {
397	regulator-min-microvolt = <1200000>;
398	regulator-max-microvolt = <1200000>;
399	regulator-name = "vcc-1v2-hsic";
400};
401
402&reg_fldo2 {
403	regulator-always-on;
404	regulator-min-microvolt = <1100000>;
405	regulator-max-microvolt = <1100000>;
406	regulator-name = "vdd-cpus";
407};
408
409&reg_ldo_io0 {
410	regulator-min-microvolt = <3300000>;
411	regulator-max-microvolt = <3300000>;
412	regulator-name = "vcc-lcd-ctp-stk";
413	status = "okay";
414};
415
416&reg_ldo_io1 {
417	regulator-min-microvolt = <1800000>;
418	regulator-max-microvolt = <1800000>;
419	regulator-name = "vcc-1v8-typec";
420	status = "okay";
421};
422
423&reg_rtc_ldo {
424	regulator-name = "vcc-rtc";
425};
426
427&sound {
428	status = "okay";
429	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
430	simple-audio-card,widgets = "Microphone", "Headset Microphone",
431				    "Microphone", "Internal Microphone",
432				    "Headphone", "Headphone Jack",
433				    "Speaker", "Internal Earpiece",
434				    "Speaker", "Internal Speaker";
435	simple-audio-card,routing =
436			"Headphone Jack", "HP",
437			"Internal Earpiece", "EARPIECE",
438			"Internal Speaker", "Speaker Amp OUTL",
439			"Internal Speaker", "Speaker Amp OUTR",
440			"Speaker Amp INL", "LINEOUT",
441			"Speaker Amp INR", "LINEOUT",
442			"Left DAC", "DACL",
443			"Right DAC", "DACR",
444			"ADCL", "Left ADC",
445			"ADCR", "Right ADC",
446			"Internal Microphone", "MBIAS",
447			"MIC1", "Internal Microphone",
448			"Headset Microphone", "HBIAS",
449			"MIC2", "Headset Microphone";
450};
451
452&uart0 {
453	pinctrl-names = "default";
454	pinctrl-0 = <&uart0_pb_pins>;
455	status = "okay";
456};
457
458&uart1 {
459	pinctrl-names = "default";
460	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
461	status = "okay";
462
463	bluetooth {
464		compatible = "realtek,rtl8723cs-bt";
465		device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */
466		enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
467		host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
468	};
469};
470
471/* Connected to the modem (hardware flow control can't be used) */
472&uart3 {
473	pinctrl-names = "default";
474	pinctrl-0 = <&uart3_pins>;
475	status = "okay";
476};
477
478&usb_otg {
479	dr_mode = "peripheral";
480	status = "okay";
481};
482
483&usb_power_supply {
484	status = "okay";
485};
486
487&usbphy {
488	status = "okay";
489};
490