1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
3// Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
4
5/dts-v1/;
6
7#include "sun50i-a64.dtsi"
8#include "sun50i-a64-cpu-opp.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/gpio-keys.h>
12#include <dt-bindings/input/input.h>
13#include <dt-bindings/pwm/pwm.h>
14
15/ {
16	model = "Pinebook";
17	compatible = "pine64,pinebook", "allwinner,sun50i-a64";
18
19	aliases {
20		serial0 = &uart0;
21		ethernet0 = &rtl8723cs;
22	};
23
24	backlight: backlight {
25		compatible = "pwm-backlight";
26		pwms = <&pwm 0 50000 0>;
27		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
28		default-brightness-level = <2>;
29		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
30		power-supply = <&reg_vbklt>;
31	};
32
33	chosen {
34		stdout-path = "serial0:115200n8";
35	};
36
37	gpio_keys {
38		compatible = "gpio-keys";
39
40		lid_switch {
41			label = "Lid Switch";
42			gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
43			linux,input-type = <EV_SW>;
44			linux,code = <SW_LID>;
45			linux,can-disable;
46			wakeup-source;
47			wakeup-event-action = <EV_ACT_DEASSERTED>;
48		};
49	};
50
51	panel_edp: panel-edp {
52		compatible = "neweast,wjfh116008a";
53		backlight = <&backlight>;
54		power-supply = <&reg_dc1sw>;
55
56		port {
57			panel_edp_in: endpoint {
58				remote-endpoint = <&anx6345_out_edp>;
59			};
60		};
61	};
62
63	reg_vbklt: vbklt {
64		compatible = "regulator-fixed";
65		regulator-name = "vbklt";
66		regulator-min-microvolt = <18000000>;
67		regulator-max-microvolt = <18000000>;
68		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
69		enable-active-high;
70	};
71
72	reg_vcc5v0: vcc5v0 {
73		compatible = "regulator-fixed";
74		regulator-name = "vcc5v0";
75		regulator-min-microvolt = <5000000>;
76		regulator-max-microvolt = <5000000>;
77		gpio = <&axp_gpio 0 GPIO_ACTIVE_HIGH>;
78		enable-active-high;
79	};
80
81	wifi_pwrseq: wifi_pwrseq {
82		compatible = "mmc-pwrseq-simple";
83		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
84	};
85
86	speaker_amp: audio-amplifier {
87		compatible = "simple-audio-amplifier";
88		VCC-supply = <&reg_vcc5v0>;
89		enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
90		sound-name-prefix = "Speaker Amp";
91	};
92
93};
94
95&codec {
96	status = "okay";
97};
98
99&codec_analog {
100	cpvdd-supply = <&reg_eldo1>;
101	status = "okay";
102};
103
104&cpu0 {
105	cpu-supply = <&reg_dcdc2>;
106};
107
108&cpu1 {
109	cpu-supply = <&reg_dcdc2>;
110};
111
112&cpu2 {
113	cpu-supply = <&reg_dcdc2>;
114};
115
116&cpu3 {
117	cpu-supply = <&reg_dcdc2>;
118};
119
120&dai {
121	status = "okay";
122};
123
124&de {
125	status = "okay";
126};
127
128&ehci0 {
129	phys = <&usbphy 0>;
130	phy-names = "usb";
131	status = "okay";
132};
133
134&ehci1 {
135	status = "okay";
136};
137
138&mixer0 {
139	status = "okay";
140};
141
142&mmc0 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&mmc0_pins>;
145	vmmc-supply = <&reg_dcdc1>;
146	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
147	disable-wp;
148	bus-width = <4>;
149	status = "okay";
150};
151
152&mmc1 {
153	pinctrl-names = "default";
154	pinctrl-0 = <&mmc1_pins>;
155	vmmc-supply = <&reg_dldo4>;
156	vqmmc-supply = <&reg_eldo1>;
157	mmc-pwrseq = <&wifi_pwrseq>;
158	bus-width = <4>;
159	non-removable;
160	status = "okay";
161
162	rtl8723cs: wifi@1 {
163		reg = <1>;
164	};
165};
166
167&mmc2 {
168	pinctrl-names = "default";
169	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
170	vmmc-supply = <&reg_dcdc1>;
171	vqmmc-supply = <&reg_eldo1>;
172	bus-width = <8>;
173	non-removable;
174	cap-mmc-hw-reset;
175	mmc-hs200-1_8v;
176	status = "okay";
177};
178
179&ohci0 {
180	phys = <&usbphy 0>;
181	phy-names = "usb";
182	status = "okay";
183};
184
185&ohci1 {
186	status = "okay";
187};
188
189&pio {
190	vcc-pc-supply = <&reg_eldo1>;
191	vcc-pd-supply = <&reg_dcdc1>;
192	vcc-pe-supply = <&reg_aldo1>;
193	vcc-pg-supply = <&reg_eldo1>;
194};
195
196&pwm {
197	status = "okay";
198};
199
200&r_i2c {
201	clock-frequency = <100000>;
202	pinctrl-names = "default";
203	pinctrl-0 = <&r_i2c_pl89_pins>;
204	status = "okay";
205
206	anx6345: anx6345@38 {
207		compatible = "analogix,anx6345";
208		reg = <0x38>;
209		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
210		dvdd25-supply = <&reg_dldo2>;
211		dvdd12-supply = <&reg_fldo1>;
212
213		ports {
214			#address-cells = <1>;
215			#size-cells = <0>;
216
217			anx6345_in: port@0 {
218				reg = <0>;
219				anx6345_in_tcon0: endpoint {
220					remote-endpoint = <&tcon0_out_anx6345>;
221				};
222			};
223
224			anx6345_out: port@1 {
225				reg = <1>;
226				anx6345_out_edp: endpoint {
227					remote-endpoint = <&panel_edp_in>;
228				};
229			};
230		};
231	};
232};
233
234&r_pio {
235	/*
236	 * FIXME: We can't add that supply for now since it would
237	 * create a circular dependency between pinctrl, the regulator
238	 * and the RSB Bus.
239	 *
240	 * vcc-pl-supply = <&reg_aldo2>;
241	 */
242};
243
244&r_rsb {
245	status = "okay";
246
247	axp803: pmic@3a3 {
248		compatible = "x-powers,axp803";
249		reg = <0x3a3>;
250		interrupt-parent = <&r_intc>;
251		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
252	};
253};
254
255#include "axp803.dtsi"
256
257&ac_power_supply {
258	status = "okay";
259};
260
261&battery_power_supply {
262	status = "okay";
263};
264
265&reg_aldo1 {
266	regulator-name = "vcc-pe";
267};
268
269&reg_aldo2 {
270	regulator-always-on;
271	regulator-min-microvolt = <1800000>;
272	regulator-max-microvolt = <3300000>;
273	regulator-name = "vcc-pl";
274};
275
276&reg_aldo3 {
277	regulator-always-on;
278	regulator-min-microvolt = <2700000>;
279	regulator-max-microvolt = <3300000>;
280	regulator-name = "vcc-pll-avcc";
281};
282
283&reg_dc1sw {
284	regulator-name = "vcc-lcd";
285};
286
287&reg_dcdc1 {
288	regulator-always-on;
289	regulator-min-microvolt = <3300000>;
290	regulator-max-microvolt = <3300000>;
291	regulator-name = "vcc-3v3";
292};
293
294&reg_dcdc2 {
295	regulator-always-on;
296	regulator-min-microvolt = <1000000>;
297	regulator-max-microvolt = <1300000>;
298	regulator-name = "vdd-cpux";
299};
300
301/* DCDC3 is polyphased with DCDC2 */
302
303&reg_dcdc5 {
304	regulator-always-on;
305	regulator-min-microvolt = <1200000>;
306	regulator-max-microvolt = <1200000>;
307	regulator-name = "vcc-dram";
308};
309
310&reg_dcdc6 {
311	regulator-always-on;
312	regulator-min-microvolt = <1100000>;
313	regulator-max-microvolt = <1100000>;
314	regulator-name = "vdd-sys";
315};
316
317&reg_dldo1 {
318	regulator-min-microvolt = <3300000>;
319	regulator-max-microvolt = <3300000>;
320	regulator-name = "vcc-hdmi";
321};
322
323&reg_dldo2 {
324	regulator-min-microvolt = <2500000>;
325	regulator-max-microvolt = <2500000>;
326	regulator-name = "vcc-edp";
327};
328
329&reg_dldo4 {
330	regulator-min-microvolt = <3300000>;
331	regulator-max-microvolt = <3300000>;
332	regulator-name = "vcc-wifi";
333};
334
335&reg_eldo1 {
336	regulator-always-on;
337	regulator-min-microvolt = <1800000>;
338	regulator-max-microvolt = <1800000>;
339	regulator-name = "cpvdd";
340};
341
342&reg_fldo1 {
343	regulator-min-microvolt = <1200000>;
344	regulator-max-microvolt = <1200000>;
345	regulator-name = "vcc-1v2-hsic";
346};
347
348&reg_fldo2 {
349	regulator-always-on;
350	regulator-min-microvolt = <1100000>;
351	regulator-max-microvolt = <1100000>;
352	regulator-name = "vdd-cpus";
353};
354
355&reg_rtc_ldo {
356	regulator-name = "vcc-rtc";
357};
358
359&simplefb_lcd {
360	panel-supply = <&reg_dc1sw>;
361	dvdd25-supply = <&reg_dldo2>;
362	dvdd12-supply = <&reg_fldo1>;
363};
364
365&simplefb_hdmi {
366	vcc-hdmi-supply = <&reg_dldo1>;
367};
368
369&sound {
370	status = "okay";
371	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
372	simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
373				    "Microphone", "Internal Microphone Right",
374				    "Headphone", "Headphone Jack",
375				    "Speaker", "Internal Speaker";
376	simple-audio-card,routing =
377			"Left DAC", "DACL",
378			"Right DAC", "DACR",
379			"Speaker Amp INL", "LINEOUT",
380			"Speaker Amp INR", "LINEOUT",
381			"Internal Speaker", "Speaker Amp OUTL",
382			"Internal Speaker", "Speaker Amp OUTR",
383			"Headphone Jack", "HP",
384			"ADCL", "Left ADC",
385			"ADCR", "Right ADC",
386			"Internal Microphone Left", "MBIAS",
387			"MIC1", "Internal Microphone Left",
388			"Internal Microphone Right", "HBIAS",
389			"MIC2", "Internal Microphone Right";
390};
391
392&tcon0 {
393	pinctrl-names = "default";
394	pinctrl-0 = <&lcd_rgb666_pins>;
395
396	status = "okay";
397};
398
399&tcon0_out {
400	tcon0_out_anx6345: endpoint {
401		remote-endpoint = <&anx6345_in_tcon0>;
402	};
403};
404
405&uart0 {
406	pinctrl-names = "default";
407	pinctrl-0 = <&uart0_pb_pins>;
408	status = "okay";
409};
410
411&usb_otg {
412	dr_mode = "host";
413};
414
415&usbphy {
416	usb0_vbus-supply = <&reg_vcc5v0>;
417	usb1_vbus-supply = <&reg_vcc5v0>;
418	status = "okay";
419};
420