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