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