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	vdd_bl: regulator@0 {
25		compatible = "regulator-fixed";
26		regulator-name = "bl-3v3";
27		regulator-min-microvolt = <3300000>;
28		regulator-max-microvolt = <3300000>;
29		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
30		enable-active-high;
31	};
32
33	backlight: backlight {
34		compatible = "pwm-backlight";
35		pwms = <&pwm 0 50000 0>;
36		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
37		default-brightness-level = <2>;
38		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
39		power-supply = <&vdd_bl>;
40	};
41
42	chosen {
43		stdout-path = "serial0:115200n8";
44
45		framebuffer-lcd {
46			panel-supply = <&reg_dc1sw>;
47			dvdd25-supply = <&reg_dldo2>;
48			dvdd12-supply = <&reg_fldo1>;
49		};
50	};
51
52	gpio_keys {
53		compatible = "gpio-keys";
54
55		lid_switch {
56			label = "Lid Switch";
57			gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
58			linux,input-type = <EV_SW>;
59			linux,code = <SW_LID>;
60			linux,can-disable;
61			wakeup-source;
62			wakeup-event-action = <EV_ACT_DEASSERTED>;
63		};
64	};
65
66	reg_vcc3v3: vcc3v3 {
67		compatible = "regulator-fixed";
68		regulator-name = "vcc3v3";
69		regulator-min-microvolt = <3300000>;
70		regulator-max-microvolt = <3300000>;
71	};
72
73	wifi_pwrseq: wifi_pwrseq {
74		compatible = "mmc-pwrseq-simple";
75		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
76	};
77
78	speaker_amp: audio-amplifier {
79		compatible = "simple-audio-amplifier";
80		/*
81		 * TODO This is actually a fixed regulator controlled by
82		 * the GPIO line on the PMIC. This should be corrected
83		 * once GPIO support is added for this PMIC.
84		 */
85		VCC-supply = <&reg_ldo_io0>;
86		enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
87		sound-name-prefix = "Speaker Amp";
88	};
89
90};
91
92&codec {
93	status = "okay";
94};
95
96&codec_analog {
97	cpvdd-supply = <&reg_eldo1>;
98	status = "okay";
99};
100
101&cpu0 {
102	cpu-supply = <&reg_dcdc2>;
103};
104
105&cpu1 {
106	cpu-supply = <&reg_dcdc2>;
107};
108
109&cpu2 {
110	cpu-supply = <&reg_dcdc2>;
111};
112
113&cpu3 {
114	cpu-supply = <&reg_dcdc2>;
115};
116
117&dai {
118	status = "okay";
119};
120
121&ehci0 {
122	phys = <&usbphy 0>;
123	phy-names = "usb";
124	status = "okay";
125};
126
127&ehci1 {
128	status = "okay";
129};
130
131&mmc0 {
132	pinctrl-names = "default";
133	pinctrl-0 = <&mmc0_pins>;
134	vmmc-supply = <&reg_dcdc1>;
135	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
136	disable-wp;
137	bus-width = <4>;
138	status = "okay";
139};
140
141&mmc1 {
142	pinctrl-names = "default";
143	pinctrl-0 = <&mmc1_pins>;
144	vmmc-supply = <&reg_dldo4>;
145	vqmmc-supply = <&reg_eldo1>;
146	mmc-pwrseq = <&wifi_pwrseq>;
147	bus-width = <4>;
148	non-removable;
149	status = "okay";
150
151	rtl8723cs: wifi@1 {
152		reg = <1>;
153	};
154};
155
156&mmc2 {
157	pinctrl-names = "default";
158	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
159	vmmc-supply = <&reg_dcdc1>;
160	vqmmc-supply = <&reg_eldo1>;
161	bus-width = <8>;
162	non-removable;
163	cap-mmc-hw-reset;
164	mmc-hs200-1_8v;
165	status = "okay";
166};
167
168&ohci0 {
169	phys = <&usbphy 0>;
170	phy-names = "usb";
171	status = "okay";
172};
173
174&ohci1 {
175	status = "okay";
176};
177
178&pwm {
179	status = "okay";
180};
181
182&r_rsb {
183	status = "okay";
184
185	axp803: pmic@3a3 {
186		compatible = "x-powers,axp803";
187		reg = <0x3a3>;
188		interrupt-parent = <&r_intc>;
189		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
190	};
191};
192
193/* The ANX6345 eDP-bridge is on r_i2c */
194&r_i2c {
195	clock-frequency = <100000>;
196	pinctrl-names = "default";
197	pinctrl-0 = <&r_i2c_pl89_pins>;
198	status = "okay";
199};
200
201#include "axp803.dtsi"
202
203&ac_power_supply {
204	status = "okay";
205};
206
207&battery_power_supply {
208	status = "okay";
209};
210
211&reg_aldo1 {
212	regulator-min-microvolt = <2800000>;
213	regulator-max-microvolt = <2800000>;
214	regulator-name = "vcc-csi";
215};
216
217&reg_aldo2 {
218	regulator-always-on;
219	regulator-min-microvolt = <1800000>;
220	regulator-max-microvolt = <3300000>;
221	regulator-name = "vcc-pl";
222};
223
224&reg_aldo3 {
225	regulator-always-on;
226	regulator-min-microvolt = <2700000>;
227	regulator-max-microvolt = <3300000>;
228	regulator-name = "vcc-pll-avcc";
229};
230
231&reg_dc1sw {
232	regulator-name = "vcc-lcd";
233};
234
235&reg_dcdc1 {
236	regulator-always-on;
237	regulator-min-microvolt = <3300000>;
238	regulator-max-microvolt = <3300000>;
239	regulator-name = "vcc-3v3";
240};
241
242&reg_dcdc2 {
243	regulator-always-on;
244	regulator-min-microvolt = <1000000>;
245	regulator-max-microvolt = <1300000>;
246	regulator-name = "vdd-cpux";
247};
248
249/* DCDC3 is polyphased with DCDC2 */
250
251&reg_dcdc5 {
252	regulator-always-on;
253	regulator-min-microvolt = <1200000>;
254	regulator-max-microvolt = <1200000>;
255	regulator-name = "vcc-dram";
256};
257
258&reg_dcdc6 {
259	regulator-always-on;
260	regulator-min-microvolt = <1100000>;
261	regulator-max-microvolt = <1100000>;
262	regulator-name = "vdd-sys";
263};
264
265&reg_dldo1 {
266	regulator-min-microvolt = <3300000>;
267	regulator-max-microvolt = <3300000>;
268	regulator-name = "vcc-hdmi";
269};
270
271&reg_dldo2 {
272	regulator-min-microvolt = <2500000>;
273	regulator-max-microvolt = <2500000>;
274	regulator-name = "vcc-edp";
275};
276
277&reg_dldo3 {
278	regulator-min-microvolt = <3300000>;
279	regulator-max-microvolt = <3300000>;
280	regulator-name = "avdd-csi";
281};
282
283&reg_dldo4 {
284	regulator-min-microvolt = <3300000>;
285	regulator-max-microvolt = <3300000>;
286	regulator-name = "vcc-wifi";
287};
288
289&reg_eldo1 {
290	regulator-always-on;
291	regulator-min-microvolt = <1800000>;
292	regulator-max-microvolt = <1800000>;
293	regulator-name = "cpvdd";
294};
295
296&reg_eldo3 {
297	regulator-min-microvolt = <1800000>;
298	regulator-max-microvolt = <1800000>;
299	regulator-name = "vdd-1v8-csi";
300};
301
302&reg_fldo1 {
303	regulator-min-microvolt = <1200000>;
304	regulator-max-microvolt = <1200000>;
305	regulator-name = "vcc-1v2-hsic";
306};
307
308&reg_fldo2 {
309	regulator-always-on;
310	regulator-min-microvolt = <1100000>;
311	regulator-max-microvolt = <1100000>;
312	regulator-name = "vdd-cpus";
313};
314
315&reg_ldo_io0 {
316	regulator-min-microvolt = <3300000>;
317	regulator-max-microvolt = <3300000>;
318	regulator-name = "vcc-usb";
319	status = "okay";
320};
321
322&reg_rtc_ldo {
323	regulator-name = "vcc-rtc";
324};
325
326&simplefb_hdmi {
327	vcc-hdmi-supply = <&reg_dldo1>;
328};
329
330&sound {
331	status = "okay";
332	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
333	simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
334				    "Microphone", "Internal Microphone Right",
335				    "Headphone", "Headphone Jack",
336				    "Speaker", "Internal Speaker";
337	simple-audio-card,routing =
338			"Left DAC", "AIF1 Slot 0 Left",
339			"Right DAC", "AIF1 Slot 0 Right",
340			"Speaker Amp INL", "LINEOUT",
341			"Speaker Amp INR", "LINEOUT",
342			"Internal Speaker", "Speaker Amp OUTL",
343			"Internal Speaker", "Speaker Amp OUTR",
344			"Headphone Jack", "HP",
345			"AIF1 Slot 0 Left ADC", "Left ADC",
346			"AIF1 Slot 0 Right ADC", "Right ADC",
347			"Internal Microphone Left", "MBIAS",
348			"MIC1", "Internal Microphone Left",
349			"Internal Microphone Right", "HBIAS",
350			"MIC2", "Internal Microphone Right";
351};
352
353&uart0 {
354	pinctrl-names = "default";
355	pinctrl-0 = <&uart0_pb_pins>;
356	status = "okay";
357};
358
359&usb_otg {
360	dr_mode = "host";
361};
362
363&usbphy {
364	usb0_vbus-supply = <&reg_ldo_io0>;
365	usb1_vbus-supply = <&reg_ldo_io0>;
366	status = "okay";
367};
368