xref: /freebsd/sys/contrib/device-tree/src/arm64/allwinner/sun50i-a64-pinephone.dtsi (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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	};
206};
207
208/* Connected to pogo pins (external spring based pinheader for user addons) */
209&i2c2 {
210	status = "okay";
211};
212
213&lradc {
214	vref-supply = <&reg_aldo3>;
215	wakeup-source;
216	status = "okay";
217
218	button-200 {
219		label = "Volume Up";
220		linux,code = <KEY_VOLUMEUP>;
221		channel = <0>;
222		voltage = <200000>;
223	};
224
225	button-400 {
226		label = "Volume Down";
227		linux,code = <KEY_VOLUMEDOWN>;
228		channel = <0>;
229		voltage = <400000>;
230	};
231};
232
233&mmc0 {
234	pinctrl-names = "default";
235	pinctrl-0 = <&mmc0_pins>;
236	vmmc-supply = <&reg_dcdc1>;
237	vqmmc-supply = <&reg_dcdc1>;
238	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
239	disable-wp;
240	bus-width = <4>;
241	status = "okay";
242};
243
244&mmc1 {
245	pinctrl-names = "default";
246	pinctrl-0 = <&mmc1_pins>;
247	vmmc-supply = <&reg_vbat_wifi>;
248	vqmmc-supply = <&reg_dldo4>;
249	bus-width = <4>;
250	non-removable;
251	status = "okay";
252
253	rtl8723cs: wifi@1 {
254		reg = <1>;
255	};
256};
257
258&mmc2 {
259	pinctrl-names = "default";
260	pinctrl-0 = <&mmc2_pins>;
261	vmmc-supply = <&reg_dcdc1>;
262	vqmmc-supply = <&reg_dcdc1>;
263	bus-width = <8>;
264	non-removable;
265	cap-mmc-hw-reset;
266	status = "okay";
267};
268
269&ohci0 {
270	status = "okay";
271};
272
273&ohci1 {
274	status = "okay";
275};
276
277&pio {
278	vcc-pb-supply = <&reg_dcdc1>;
279	vcc-pc-supply = <&reg_dcdc1>;
280	vcc-pd-supply = <&reg_dcdc1>;
281	vcc-pe-supply = <&reg_aldo1>;
282	vcc-pf-supply = <&reg_dcdc1>;
283	vcc-pg-supply = <&reg_dldo4>;
284	vcc-ph-supply = <&reg_dcdc1>;
285};
286
287&r_pio {
288	/*
289	 * FIXME: We can't add that supply for now since it would
290	 * create a circular dependency between pinctrl, the regulator
291	 * and the RSB Bus.
292	 *
293	 * vcc-pl-supply = <&reg_aldo2>;
294	 */
295};
296
297&r_pwm {
298	status = "okay";
299};
300
301&r_rsb {
302	status = "okay";
303
304	axp803: pmic@3a3 {
305		compatible = "x-powers,axp803";
306		reg = <0x3a3>;
307		interrupt-parent = <&r_intc>;
308		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
309	};
310};
311
312#include "axp803.dtsi"
313
314&battery_power_supply {
315	status = "okay";
316};
317
318&reg_aldo1 {
319	regulator-min-microvolt = <1800000>;
320	regulator-max-microvolt = <1800000>;
321	regulator-name = "dovdd-csi";
322};
323
324&reg_aldo2 {
325	regulator-always-on;
326	regulator-min-microvolt = <1800000>;
327	regulator-max-microvolt = <1800000>;
328	regulator-name = "vcc-pl";
329};
330
331&reg_aldo3 {
332	regulator-always-on;
333	regulator-min-microvolt = <3000000>;
334	regulator-max-microvolt = <3000000>;
335	regulator-name = "vcc-pll-avcc";
336};
337
338&reg_dcdc1 {
339	regulator-always-on;
340	regulator-min-microvolt = <3300000>;
341	regulator-max-microvolt = <3300000>;
342	regulator-name = "vcc-3v3";
343};
344
345&reg_dcdc2 {
346	regulator-always-on;
347	regulator-min-microvolt = <1000000>;
348	regulator-max-microvolt = <1300000>;
349	regulator-name = "vdd-cpux";
350};
351
352/* DCDC3 is polyphased with DCDC2 */
353
354&reg_dcdc5 {
355	regulator-always-on;
356	regulator-min-microvolt = <1200000>;
357	regulator-max-microvolt = <1200000>;
358	regulator-name = "vcc-dram";
359};
360
361&reg_dcdc6 {
362	regulator-always-on;
363	regulator-min-microvolt = <1100000>;
364	regulator-max-microvolt = <1100000>;
365	regulator-name = "vdd-sys";
366};
367
368&reg_dldo1 {
369	regulator-min-microvolt = <3300000>;
370	regulator-max-microvolt = <3300000>;
371	regulator-name = "vcc-dsi-sensor";
372};
373
374&reg_dldo2 {
375	regulator-min-microvolt = <1800000>;
376	regulator-max-microvolt = <1800000>;
377	regulator-name = "vcc-mipi-io";
378};
379
380&reg_dldo3 {
381	regulator-min-microvolt = <2800000>;
382	regulator-max-microvolt = <2800000>;
383	regulator-name = "avdd-csi";
384};
385
386&reg_dldo4 {
387	regulator-min-microvolt = <1800000>;
388	regulator-max-microvolt = <1800000>;
389	regulator-name = "vcc-wifi-io";
390};
391
392&reg_eldo1 {
393	regulator-always-on;
394	regulator-min-microvolt = <1800000>;
395	regulator-max-microvolt = <1800000>;
396	regulator-name = "vcc-lpddr";
397};
398
399&reg_eldo3 {
400	regulator-min-microvolt = <1800000>;
401	regulator-max-microvolt = <1800000>;
402	regulator-name = "dvdd-1v8-csi";
403};
404
405&reg_fldo1 {
406	regulator-min-microvolt = <1200000>;
407	regulator-max-microvolt = <1200000>;
408	regulator-name = "vcc-1v2-hsic";
409};
410
411&reg_fldo2 {
412	regulator-always-on;
413	regulator-min-microvolt = <1100000>;
414	regulator-max-microvolt = <1100000>;
415	regulator-name = "vdd-cpus";
416};
417
418&reg_ldo_io0 {
419	regulator-min-microvolt = <3300000>;
420	regulator-max-microvolt = <3300000>;
421	regulator-name = "vcc-lcd-ctp-stk";
422	status = "okay";
423};
424
425&reg_ldo_io1 {
426	regulator-min-microvolt = <1800000>;
427	regulator-max-microvolt = <1800000>;
428	regulator-name = "vcc-1v8-typec";
429	status = "okay";
430};
431
432&reg_rtc_ldo {
433	regulator-name = "vcc-rtc";
434};
435
436&sound {
437	status = "okay";
438	simple-audio-card,name = "PinePhone";
439	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
440	simple-audio-card,widgets = "Microphone", "Headset Microphone",
441				    "Microphone", "Internal Microphone",
442				    "Headphone", "Headphone Jack",
443				    "Speaker", "Internal Earpiece",
444				    "Speaker", "Internal Speaker";
445	simple-audio-card,routing =
446			"Headphone Jack", "HP",
447			"Internal Earpiece", "EARPIECE",
448			"Internal Speaker", "Speaker Amp OUTL",
449			"Internal Speaker", "Speaker Amp OUTR",
450			"Speaker Amp INL", "LINEOUT",
451			"Speaker Amp INR", "LINEOUT",
452			"Left DAC", "DACL",
453			"Right DAC", "DACR",
454			"ADCL", "Left ADC",
455			"ADCR", "Right ADC",
456			"Internal Microphone", "MBIAS",
457			"MIC1", "Internal Microphone",
458			"Headset Microphone", "HBIAS",
459			"MIC2", "Headset Microphone";
460
461	simple-audio-card,dai-link@2 {
462		format = "dsp_a";
463		frame-master = <&link2_codec>;
464		bitclock-master = <&link2_codec>;
465		bitclock-inversion;
466
467		link2_cpu: cpu {
468			sound-dai = <&bt_sco_codec 0>;
469		};
470
471		link2_codec: codec {
472			sound-dai = <&codec 2>;
473			dai-tdm-slot-num = <1>;
474			dai-tdm-slot-width = <32>;
475		};
476	};
477};
478
479&uart0 {
480	pinctrl-names = "default";
481	pinctrl-0 = <&uart0_pb_pins>;
482	status = "okay";
483};
484
485&uart1 {
486	pinctrl-names = "default";
487	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
488	status = "okay";
489
490	bluetooth {
491		compatible = "realtek,rtl8723cs-bt";
492		device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */
493		enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
494		host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
495	};
496};
497
498/* Connected to the modem (hardware flow control can't be used) */
499&uart3 {
500	pinctrl-names = "default";
501	pinctrl-0 = <&uart3_pins>;
502	status = "okay";
503};
504
505&usb_otg {
506	dr_mode = "peripheral";
507	status = "okay";
508};
509
510&usb_power_supply {
511	status = "okay";
512};
513
514&usbphy {
515	status = "okay";
516};
517