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