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	status = "okay";
108};
109
110&ehci1 {
111	status = "okay";
112};
113
114&mmc0 {
115	pinctrl-names = "default";
116	pinctrl-0 = <&mmc0_pins>;
117	vmmc-supply = <&reg_dcdc1>;
118	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
119	disable-wp;
120	bus-width = <4>;
121	status = "okay";
122};
123
124&mmc1 {
125	pinctrl-names = "default";
126	pinctrl-0 = <&mmc1_pins>;
127	vmmc-supply = <&reg_dldo4>;
128	vqmmc-supply = <&reg_eldo1>;
129	mmc-pwrseq = <&wifi_pwrseq>;
130	bus-width = <4>;
131	non-removable;
132	status = "okay";
133
134	rtl8723cs: wifi@1 {
135		reg = <1>;
136	};
137};
138
139&mmc2 {
140	pinctrl-names = "default";
141	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
142	vmmc-supply = <&reg_dcdc1>;
143	vqmmc-supply = <&reg_eldo1>;
144	bus-width = <8>;
145	non-removable;
146	cap-mmc-hw-reset;
147	mmc-hs200-1_8v;
148	status = "okay";
149};
150
151&ohci0 {
152	phys = <&usbphy 0>;
153	status = "okay";
154};
155
156&ohci1 {
157	status = "okay";
158};
159
160&pwm {
161	status = "okay";
162};
163
164&r_rsb {
165	status = "okay";
166
167	axp803: pmic@3a3 {
168		compatible = "x-powers,axp803";
169		reg = <0x3a3>;
170		interrupt-parent = <&r_intc>;
171		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
172	};
173};
174
175/* The ANX6345 eDP-bridge is on r_i2c */
176&r_i2c {
177	clock-frequency = <100000>;
178	pinctrl-names = "default";
179	pinctrl-0 = <&r_i2c_pl89_pins>;
180	status = "okay";
181};
182
183#include "axp803.dtsi"
184
185&ac_power_supply {
186	status = "okay";
187};
188
189&battery_power_supply {
190	status = "okay";
191};
192
193&reg_aldo1 {
194	regulator-min-microvolt = <2800000>;
195	regulator-max-microvolt = <2800000>;
196	regulator-name = "vcc-csi";
197};
198
199&reg_aldo2 {
200	regulator-always-on;
201	regulator-min-microvolt = <1800000>;
202	regulator-max-microvolt = <3300000>;
203	regulator-name = "vcc-pl";
204};
205
206&reg_aldo3 {
207	regulator-always-on;
208	regulator-min-microvolt = <2700000>;
209	regulator-max-microvolt = <3300000>;
210	regulator-name = "vcc-pll-avcc";
211};
212
213&reg_dc1sw {
214	regulator-name = "vcc-lcd";
215};
216
217&reg_dcdc1 {
218	regulator-always-on;
219	regulator-min-microvolt = <3300000>;
220	regulator-max-microvolt = <3300000>;
221	regulator-name = "vcc-3v3";
222};
223
224&reg_dcdc2 {
225	regulator-always-on;
226	regulator-min-microvolt = <1000000>;
227	regulator-max-microvolt = <1300000>;
228	regulator-name = "vdd-cpux";
229};
230
231/* DCDC3 is polyphased with DCDC2 */
232
233&reg_dcdc5 {
234	regulator-always-on;
235	regulator-min-microvolt = <1200000>;
236	regulator-max-microvolt = <1200000>;
237	regulator-name = "vcc-dram";
238};
239
240&reg_dcdc6 {
241	regulator-always-on;
242	regulator-min-microvolt = <1100000>;
243	regulator-max-microvolt = <1100000>;
244	regulator-name = "vdd-sys";
245};
246
247&reg_dldo1 {
248	regulator-min-microvolt = <3300000>;
249	regulator-max-microvolt = <3300000>;
250	regulator-name = "vcc-hdmi";
251};
252
253&reg_dldo2 {
254	regulator-min-microvolt = <2500000>;
255	regulator-max-microvolt = <2500000>;
256	regulator-name = "vcc-edp";
257};
258
259&reg_dldo3 {
260	regulator-min-microvolt = <3300000>;
261	regulator-max-microvolt = <3300000>;
262	regulator-name = "avdd-csi";
263};
264
265&reg_dldo4 {
266	regulator-min-microvolt = <3300000>;
267	regulator-max-microvolt = <3300000>;
268	regulator-name = "vcc-wifi";
269};
270
271&reg_eldo1 {
272	regulator-always-on;
273	regulator-min-microvolt = <1800000>;
274	regulator-max-microvolt = <1800000>;
275	regulator-name = "cpvdd";
276};
277
278&reg_eldo3 {
279	regulator-min-microvolt = <1800000>;
280	regulator-max-microvolt = <1800000>;
281	regulator-name = "vdd-1v8-csi";
282};
283
284&reg_fldo1 {
285	regulator-min-microvolt = <1200000>;
286	regulator-max-microvolt = <1200000>;
287	regulator-name = "vcc-1v2-hsic";
288};
289
290&reg_fldo2 {
291	regulator-always-on;
292	regulator-min-microvolt = <1100000>;
293	regulator-max-microvolt = <1100000>;
294	regulator-name = "vdd-cpus";
295};
296
297&reg_ldo_io0 {
298	regulator-min-microvolt = <3300000>;
299	regulator-max-microvolt = <3300000>;
300	regulator-name = "vcc-usb";
301	status = "okay";
302};
303
304&reg_rtc_ldo {
305	regulator-name = "vcc-rtc";
306};
307
308&simplefb_hdmi {
309	vcc-hdmi-supply = <&reg_dldo1>;
310};
311
312&sound {
313	status = "okay";
314	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
315	simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
316				    "Microphone", "Internal Microphone Right",
317				    "Headphone", "Headphone Jack",
318				    "Speaker", "Internal Speaker";
319	simple-audio-card,routing =
320			"Left DAC", "AIF1 Slot 0 Left",
321			"Right DAC", "AIF1 Slot 0 Right",
322			"Speaker Amp INL", "LINEOUT",
323			"Speaker Amp INR", "LINEOUT",
324			"Internal Speaker", "Speaker Amp OUTL",
325			"Internal Speaker", "Speaker Amp OUTR",
326			"Headphone Jack", "HP",
327			"AIF1 Slot 0 Left ADC", "Left ADC",
328			"AIF1 Slot 0 Right ADC", "Right ADC",
329			"Internal Microphone Left", "MBIAS",
330			"MIC1", "Internal Microphone Left",
331			"Internal Microphone Right", "HBIAS",
332			"MIC2", "Internal Microphone Right";
333};
334
335&uart0 {
336	pinctrl-names = "default";
337	pinctrl-0 = <&uart0_pb_pins>;
338	status = "okay";
339};
340
341&usb_otg {
342	dr_mode = "host";
343};
344
345&usbphy {
346	usb0_vbus-supply = <&reg_ldo_io0>;
347	usb1_vbus-supply = <&reg_ldo_io0>;
348	status = "okay";
349};
350