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	status = "okay";
130};
131
132&ehci1 {
133	status = "okay";
134};
135
136&mixer0 {
137	status = "okay";
138};
139
140&mmc0 {
141	pinctrl-names = "default";
142	pinctrl-0 = <&mmc0_pins>;
143	vmmc-supply = <&reg_dcdc1>;
144	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
145	disable-wp;
146	bus-width = <4>;
147	status = "okay";
148};
149
150&mmc1 {
151	pinctrl-names = "default";
152	pinctrl-0 = <&mmc1_pins>;
153	vmmc-supply = <&reg_dldo4>;
154	vqmmc-supply = <&reg_eldo1>;
155	mmc-pwrseq = <&wifi_pwrseq>;
156	bus-width = <4>;
157	non-removable;
158	status = "okay";
159
160	rtl8723cs: wifi@1 {
161		reg = <1>;
162	};
163};
164
165&mmc2 {
166	pinctrl-names = "default";
167	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
168	vmmc-supply = <&reg_dcdc1>;
169	vqmmc-supply = <&reg_eldo1>;
170	max-frequency = <200000000>;
171	bus-width = <8>;
172	non-removable;
173	cap-mmc-hw-reset;
174	mmc-hs200-1_8v;
175	status = "okay";
176};
177
178&ohci0 {
179	status = "okay";
180};
181
182&ohci1 {
183	status = "okay";
184};
185
186&pio {
187	vcc-pc-supply = <&reg_eldo1>;
188	vcc-pd-supply = <&reg_dcdc1>;
189	vcc-pe-supply = <&reg_aldo1>;
190	vcc-pg-supply = <&reg_eldo1>;
191};
192
193&pwm {
194	status = "okay";
195};
196
197&r_i2c {
198	clock-frequency = <100000>;
199	pinctrl-names = "default";
200	pinctrl-0 = <&r_i2c_pl89_pins>;
201	status = "okay";
202
203	anx6345: anx6345@38 {
204		compatible = "analogix,anx6345";
205		reg = <0x38>;
206		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
207		dvdd25-supply = <&reg_dldo2>;
208		dvdd12-supply = <&reg_fldo1>;
209
210		ports {
211			#address-cells = <1>;
212			#size-cells = <0>;
213
214			anx6345_in: port@0 {
215				reg = <0>;
216				anx6345_in_tcon0: endpoint {
217					remote-endpoint = <&tcon0_out_anx6345>;
218				};
219			};
220
221			anx6345_out: port@1 {
222				reg = <1>;
223				anx6345_out_edp: endpoint {
224					remote-endpoint = <&panel_edp_in>;
225				};
226			};
227		};
228	};
229};
230
231&r_pio {
232	/*
233	 * FIXME: We can't add that supply for now since it would
234	 * create a circular dependency between pinctrl, the regulator
235	 * and the RSB Bus.
236	 *
237	 * vcc-pl-supply = <&reg_aldo2>;
238	 */
239};
240
241&r_rsb {
242	status = "okay";
243
244	axp803: pmic@3a3 {
245		compatible = "x-powers,axp803";
246		reg = <0x3a3>;
247		interrupt-parent = <&r_intc>;
248		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
249	};
250};
251
252#include "axp803.dtsi"
253
254&ac_power_supply {
255	status = "okay";
256};
257
258&battery_power_supply {
259	status = "okay";
260};
261
262&reg_aldo1 {
263	regulator-name = "vcc-pe";
264};
265
266&reg_aldo2 {
267	regulator-always-on;
268	regulator-min-microvolt = <1800000>;
269	regulator-max-microvolt = <3300000>;
270	regulator-name = "vcc-pl";
271};
272
273&reg_aldo3 {
274	regulator-always-on;
275	regulator-min-microvolt = <2700000>;
276	regulator-max-microvolt = <3300000>;
277	regulator-name = "vcc-pll-avcc";
278};
279
280&reg_dc1sw {
281	regulator-name = "vcc-lcd";
282};
283
284&reg_dcdc1 {
285	regulator-always-on;
286	regulator-min-microvolt = <3300000>;
287	regulator-max-microvolt = <3300000>;
288	regulator-name = "vcc-3v3";
289};
290
291&reg_dcdc2 {
292	regulator-always-on;
293	regulator-min-microvolt = <1000000>;
294	regulator-max-microvolt = <1300000>;
295	regulator-name = "vdd-cpux";
296};
297
298/* DCDC3 is polyphased with DCDC2 */
299
300&reg_dcdc5 {
301	regulator-always-on;
302	regulator-min-microvolt = <1200000>;
303	regulator-max-microvolt = <1200000>;
304	regulator-name = "vcc-dram";
305};
306
307&reg_dcdc6 {
308	regulator-always-on;
309	regulator-min-microvolt = <1100000>;
310	regulator-max-microvolt = <1100000>;
311	regulator-name = "vdd-sys";
312};
313
314&reg_dldo1 {
315	regulator-min-microvolt = <3300000>;
316	regulator-max-microvolt = <3300000>;
317	regulator-name = "vcc-hdmi";
318};
319
320&reg_dldo2 {
321	regulator-min-microvolt = <2500000>;
322	regulator-max-microvolt = <2500000>;
323	regulator-name = "vcc-edp";
324};
325
326&reg_dldo4 {
327	regulator-min-microvolt = <3300000>;
328	regulator-max-microvolt = <3300000>;
329	regulator-name = "vcc-wifi";
330};
331
332&reg_eldo1 {
333	regulator-always-on;
334	regulator-min-microvolt = <1800000>;
335	regulator-max-microvolt = <1800000>;
336	regulator-name = "cpvdd";
337};
338
339&reg_fldo1 {
340	regulator-min-microvolt = <1200000>;
341	regulator-max-microvolt = <1200000>;
342	regulator-name = "vcc-1v2-hsic";
343};
344
345&reg_fldo2 {
346	regulator-always-on;
347	regulator-min-microvolt = <1100000>;
348	regulator-max-microvolt = <1100000>;
349	regulator-name = "vdd-cpus";
350};
351
352&reg_rtc_ldo {
353	regulator-name = "vcc-rtc";
354};
355
356&simplefb_lcd {
357	panel-supply = <&reg_dc1sw>;
358	dvdd25-supply = <&reg_dldo2>;
359	dvdd12-supply = <&reg_fldo1>;
360};
361
362&simplefb_hdmi {
363	vcc-hdmi-supply = <&reg_dldo1>;
364};
365
366&sound {
367	status = "okay";
368	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
369	simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
370				    "Microphone", "Internal Microphone Right",
371				    "Headphone", "Headphone Jack",
372				    "Speaker", "Internal Speaker";
373	simple-audio-card,routing =
374			"Left DAC", "DACL",
375			"Right DAC", "DACR",
376			"Speaker Amp INL", "LINEOUT",
377			"Speaker Amp INR", "LINEOUT",
378			"Internal Speaker", "Speaker Amp OUTL",
379			"Internal Speaker", "Speaker Amp OUTR",
380			"Headphone Jack", "HP",
381			"ADCL", "Left ADC",
382			"ADCR", "Right ADC",
383			"Internal Microphone Left", "MBIAS",
384			"MIC1", "Internal Microphone Left",
385			"Internal Microphone Right", "HBIAS",
386			"MIC2", "Internal Microphone Right";
387};
388
389&tcon0 {
390	pinctrl-names = "default";
391	pinctrl-0 = <&lcd_rgb666_pins>;
392
393	status = "okay";
394};
395
396&tcon0_out {
397	tcon0_out_anx6345: endpoint {
398		remote-endpoint = <&anx6345_in_tcon0>;
399	};
400};
401
402&uart0 {
403	pinctrl-names = "default";
404	pinctrl-0 = <&uart0_pb_pins>;
405	status = "okay";
406};
407
408&usb_otg {
409	dr_mode = "host";
410};
411
412&usbphy {
413	usb0_vbus-supply = <&reg_vcc5v0>;
414	usb1_vbus-supply = <&reg_vcc5v0>;
415	status = "okay";
416};
417