xref: /freebsd/sys/contrib/device-tree/src/arm64/rockchip/rk3566-anbernic-rg-arc.dtsi (revision 01950c46b8155250f64374fb72fc11faa44bf099)
1*01950c46SEmmanuel Vadot// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2*01950c46SEmmanuel Vadot
3*01950c46SEmmanuel Vadot/dts-v1/;
4*01950c46SEmmanuel Vadot
5*01950c46SEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
6*01950c46SEmmanuel Vadot#include <dt-bindings/input/linux-event-codes.h>
7*01950c46SEmmanuel Vadot#include <dt-bindings/pinctrl/rockchip.h>
8*01950c46SEmmanuel Vadot#include "rk3566-anbernic-rgxx3.dtsi"
9*01950c46SEmmanuel Vadot
10*01950c46SEmmanuel Vadot/ {
11*01950c46SEmmanuel Vadot	backlight: backlight {
12*01950c46SEmmanuel Vadot		compatible = "pwm-backlight";
13*01950c46SEmmanuel Vadot		power-supply = <&vcc_sys>;
14*01950c46SEmmanuel Vadot		pwms = <&pwm4 0 25000 0>;
15*01950c46SEmmanuel Vadot	};
16*01950c46SEmmanuel Vadot
17*01950c46SEmmanuel Vadot	battery: battery {
18*01950c46SEmmanuel Vadot		compatible = "simple-battery";
19*01950c46SEmmanuel Vadot		charge-full-design-microamp-hours = <3472000>;
20*01950c46SEmmanuel Vadot		charge-term-current-microamp = <300000>;
21*01950c46SEmmanuel Vadot		constant-charge-current-max-microamp = <2000000>;
22*01950c46SEmmanuel Vadot		constant-charge-voltage-max-microvolt = <4200000>;
23*01950c46SEmmanuel Vadot		factory-internal-resistance-micro-ohms = <117000>;
24*01950c46SEmmanuel Vadot		voltage-max-design-microvolt = <4172000>;
25*01950c46SEmmanuel Vadot		voltage-min-design-microvolt = <3400000>;
26*01950c46SEmmanuel Vadot
27*01950c46SEmmanuel Vadot		ocv-capacity-celsius = <20>;
28*01950c46SEmmanuel Vadot		ocv-capacity-table-0 =	<4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
29*01950c46SEmmanuel Vadot					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
30*01950c46SEmmanuel Vadot					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
31*01950c46SEmmanuel Vadot					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
32*01950c46SEmmanuel Vadot					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
33*01950c46SEmmanuel Vadot					<3400000 0>;
34*01950c46SEmmanuel Vadot	};
35*01950c46SEmmanuel Vadot
36*01950c46SEmmanuel Vadot	/* Channels reversed for both headphones and speakers. */
37*01950c46SEmmanuel Vadot	sound {
38*01950c46SEmmanuel Vadot		compatible = "simple-audio-card";
39*01950c46SEmmanuel Vadot		pinctrl-0 = <&hp_det>;
40*01950c46SEmmanuel Vadot		pinctrl-names = "default";
41*01950c46SEmmanuel Vadot		simple-audio-card,name = "rk817_ext";
42*01950c46SEmmanuel Vadot		simple-audio-card,aux-devs = <&spk_amp>;
43*01950c46SEmmanuel Vadot		simple-audio-card,format = "i2s";
44*01950c46SEmmanuel Vadot		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
45*01950c46SEmmanuel Vadot		simple-audio-card,mclk-fs = <256>;
46*01950c46SEmmanuel Vadot		simple-audio-card,widgets =
47*01950c46SEmmanuel Vadot			"Microphone", "Mic Jack",
48*01950c46SEmmanuel Vadot			"Headphone", "Headphones",
49*01950c46SEmmanuel Vadot			"Speaker", "Internal Speakers";
50*01950c46SEmmanuel Vadot		simple-audio-card,routing =
51*01950c46SEmmanuel Vadot			"MICL", "Mic Jack",
52*01950c46SEmmanuel Vadot			"Headphones", "HPOL",
53*01950c46SEmmanuel Vadot			"Headphones", "HPOR",
54*01950c46SEmmanuel Vadot			"Internal Speakers", "Speaker Amp OUTL",
55*01950c46SEmmanuel Vadot			"Internal Speakers", "Speaker Amp OUTR",
56*01950c46SEmmanuel Vadot			"Speaker Amp INL", "HPOL",
57*01950c46SEmmanuel Vadot			"Speaker Amp INR", "HPOR";
58*01950c46SEmmanuel Vadot		simple-audio-card,pin-switches = "Internal Speakers";
59*01950c46SEmmanuel Vadot
60*01950c46SEmmanuel Vadot		simple-audio-card,codec {
61*01950c46SEmmanuel Vadot			sound-dai = <&rk817>;
62*01950c46SEmmanuel Vadot		};
63*01950c46SEmmanuel Vadot
64*01950c46SEmmanuel Vadot		simple-audio-card,cpu {
65*01950c46SEmmanuel Vadot			sound-dai = <&i2s1_8ch>;
66*01950c46SEmmanuel Vadot		};
67*01950c46SEmmanuel Vadot	};
68*01950c46SEmmanuel Vadot
69*01950c46SEmmanuel Vadot	spk_amp: audio-amplifier {
70*01950c46SEmmanuel Vadot		compatible = "simple-audio-amplifier";
71*01950c46SEmmanuel Vadot		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
72*01950c46SEmmanuel Vadot		pinctrl-0 = <&spk_amp_enable_h>;
73*01950c46SEmmanuel Vadot		pinctrl-names = "default";
74*01950c46SEmmanuel Vadot		sound-name-prefix = "Speaker Amp";
75*01950c46SEmmanuel Vadot	};
76*01950c46SEmmanuel Vadot};
77*01950c46SEmmanuel Vadot
78*01950c46SEmmanuel Vadot&cru {
79*01950c46SEmmanuel Vadot	assigned-clocks = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>,
80*01950c46SEmmanuel Vadot			  <&pmucru PLL_PPLL>, <&cru PLL_VPLL>;
81*01950c46SEmmanuel Vadot	assigned-clock-rates = <32768>, <1200000000>,
82*01950c46SEmmanuel Vadot			       <200000000>, <128000000>;
83*01950c46SEmmanuel Vadot};
84*01950c46SEmmanuel Vadot
85*01950c46SEmmanuel Vadot&dsi_dphy0 {
86*01950c46SEmmanuel Vadot	status = "okay";
87*01950c46SEmmanuel Vadot};
88*01950c46SEmmanuel Vadot
89*01950c46SEmmanuel Vadot&dsi0 {
90*01950c46SEmmanuel Vadot	status = "okay";
91*01950c46SEmmanuel Vadot	#address-cells = <1>;
92*01950c46SEmmanuel Vadot	#size-cells = <0>;
93*01950c46SEmmanuel Vadot
94*01950c46SEmmanuel Vadot	ports {
95*01950c46SEmmanuel Vadot		dsi0_in: port@0 {
96*01950c46SEmmanuel Vadot			reg = <0>;
97*01950c46SEmmanuel Vadot			dsi0_in_vp1: endpoint {
98*01950c46SEmmanuel Vadot				remote-endpoint = <&vp1_out_dsi0>;
99*01950c46SEmmanuel Vadot			};
100*01950c46SEmmanuel Vadot		};
101*01950c46SEmmanuel Vadot
102*01950c46SEmmanuel Vadot		dsi0_out: port@1 {
103*01950c46SEmmanuel Vadot			reg = <1>;
104*01950c46SEmmanuel Vadot			mipi_out_panel: endpoint {
105*01950c46SEmmanuel Vadot				remote-endpoint = <&mipi_in_panel>;
106*01950c46SEmmanuel Vadot			};
107*01950c46SEmmanuel Vadot		};
108*01950c46SEmmanuel Vadot	};
109*01950c46SEmmanuel Vadot
110*01950c46SEmmanuel Vadot	panel: panel@0 {
111*01950c46SEmmanuel Vadot		compatible = "anbernic,rg-arc-panel", "sitronix,st7701";
112*01950c46SEmmanuel Vadot		reg = <0>;
113*01950c46SEmmanuel Vadot		backlight = <&backlight>;
114*01950c46SEmmanuel Vadot		IOVCC-supply = <&vcc3v3_lcd0_n>;
115*01950c46SEmmanuel Vadot		pinctrl-names = "default";
116*01950c46SEmmanuel Vadot		pinctrl-0 = <&lcd_rst>;
117*01950c46SEmmanuel Vadot		reset-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>;
118*01950c46SEmmanuel Vadot		rotation = <90>;
119*01950c46SEmmanuel Vadot		VCC-supply = <&vcc3v3_lcd0_n>;
120*01950c46SEmmanuel Vadot
121*01950c46SEmmanuel Vadot		port {
122*01950c46SEmmanuel Vadot			mipi_in_panel: endpoint {
123*01950c46SEmmanuel Vadot				remote-endpoint = <&mipi_out_panel>;
124*01950c46SEmmanuel Vadot			};
125*01950c46SEmmanuel Vadot		};
126*01950c46SEmmanuel Vadot	};
127*01950c46SEmmanuel Vadot};
128*01950c46SEmmanuel Vadot
129*01950c46SEmmanuel Vadot/*
130*01950c46SEmmanuel Vadot * Device uses a non-standard six button layout for a gamepad with X,
131*01950c46SEmmanuel Vadot * Y, and Z on the top row of buttons and A, B, and C under the bottom
132*01950c46SEmmanuel Vadot * row.
133*01950c46SEmmanuel Vadot */
134*01950c46SEmmanuel Vadot&gpio_keys_control {
135*01950c46SEmmanuel Vadot	button-a {
136*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>;
137*01950c46SEmmanuel Vadot		label = "A";
138*01950c46SEmmanuel Vadot		linux,code = <BTN_A>;
139*01950c46SEmmanuel Vadot	};
140*01950c46SEmmanuel Vadot
141*01950c46SEmmanuel Vadot	button-b {
142*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
143*01950c46SEmmanuel Vadot		label = "B";
144*01950c46SEmmanuel Vadot		linux,code = <BTN_B>;
145*01950c46SEmmanuel Vadot	};
146*01950c46SEmmanuel Vadot
147*01950c46SEmmanuel Vadot	button-c {
148*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
149*01950c46SEmmanuel Vadot		label = "C";
150*01950c46SEmmanuel Vadot		linux,code = <BTN_C>;
151*01950c46SEmmanuel Vadot	};
152*01950c46SEmmanuel Vadot
153*01950c46SEmmanuel Vadot	button-left {
154*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
155*01950c46SEmmanuel Vadot		label = "DPAD-LEFT";
156*01950c46SEmmanuel Vadot		linux,code = <BTN_DPAD_LEFT>;
157*01950c46SEmmanuel Vadot	};
158*01950c46SEmmanuel Vadot
159*01950c46SEmmanuel Vadot	button-r1 {
160*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
161*01950c46SEmmanuel Vadot		label = "TR";
162*01950c46SEmmanuel Vadot		linux,code = <BTN_TR>;
163*01950c46SEmmanuel Vadot	};
164*01950c46SEmmanuel Vadot
165*01950c46SEmmanuel Vadot	button-r2 {
166*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
167*01950c46SEmmanuel Vadot		label = "TR2";
168*01950c46SEmmanuel Vadot		linux,code = <BTN_TR2>;
169*01950c46SEmmanuel Vadot	};
170*01950c46SEmmanuel Vadot
171*01950c46SEmmanuel Vadot	button-right {
172*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
173*01950c46SEmmanuel Vadot		label = "DPAD-RIGHT";
174*01950c46SEmmanuel Vadot		linux,code = <BTN_DPAD_RIGHT>;
175*01950c46SEmmanuel Vadot	};
176*01950c46SEmmanuel Vadot
177*01950c46SEmmanuel Vadot	button-x {
178*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
179*01950c46SEmmanuel Vadot		label = "X";
180*01950c46SEmmanuel Vadot		linux,code = <BTN_X>;
181*01950c46SEmmanuel Vadot	};
182*01950c46SEmmanuel Vadot
183*01950c46SEmmanuel Vadot	button-y {
184*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
185*01950c46SEmmanuel Vadot		label = "Y";
186*01950c46SEmmanuel Vadot		linux,code = <BTN_Y>;
187*01950c46SEmmanuel Vadot	};
188*01950c46SEmmanuel Vadot
189*01950c46SEmmanuel Vadot	button-z {
190*01950c46SEmmanuel Vadot		gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
191*01950c46SEmmanuel Vadot		label = "Z";
192*01950c46SEmmanuel Vadot		linux,code = <BTN_Z>;
193*01950c46SEmmanuel Vadot	};
194*01950c46SEmmanuel Vadot};
195*01950c46SEmmanuel Vadot
196*01950c46SEmmanuel Vadot&pinctrl {
197*01950c46SEmmanuel Vadot	audio-amplifier {
198*01950c46SEmmanuel Vadot		spk_amp_enable_h: spk-amp-enable-h {
199*01950c46SEmmanuel Vadot			rockchip,pins =
200*01950c46SEmmanuel Vadot				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
201*01950c46SEmmanuel Vadot		};
202*01950c46SEmmanuel Vadot	};
203*01950c46SEmmanuel Vadot
204*01950c46SEmmanuel Vadot	gpio-lcd {
205*01950c46SEmmanuel Vadot		lcd_rst: lcd-rst {
206*01950c46SEmmanuel Vadot			rockchip,pins =
207*01950c46SEmmanuel Vadot				<4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
208*01950c46SEmmanuel Vadot		};
209*01950c46SEmmanuel Vadot	};
210*01950c46SEmmanuel Vadot
211*01950c46SEmmanuel Vadot	headphone {
212*01950c46SEmmanuel Vadot		hp_det: hp-det {
213*01950c46SEmmanuel Vadot			rockchip,pins =
214*01950c46SEmmanuel Vadot				<4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
215*01950c46SEmmanuel Vadot		};
216*01950c46SEmmanuel Vadot	};
217*01950c46SEmmanuel Vadot};
218*01950c46SEmmanuel Vadot
219*01950c46SEmmanuel Vadot&pwm4 {
220*01950c46SEmmanuel Vadot	status = "okay";
221*01950c46SEmmanuel Vadot};
222*01950c46SEmmanuel Vadot
223*01950c46SEmmanuel Vadot&rk817 {
224*01950c46SEmmanuel Vadot	rk817_charger: charger {
225*01950c46SEmmanuel Vadot		monitored-battery = <&battery>;
226*01950c46SEmmanuel Vadot		rockchip,resistor-sense-micro-ohms = <10000>;
227*01950c46SEmmanuel Vadot		rockchip,sleep-enter-current-microamp = <300000>;
228*01950c46SEmmanuel Vadot		rockchip,sleep-filter-current-microamp = <100000>;
229*01950c46SEmmanuel Vadot	};
230*01950c46SEmmanuel Vadot};
231*01950c46SEmmanuel Vadot
232*01950c46SEmmanuel Vadot&vp1 {
233*01950c46SEmmanuel Vadot	vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 {
234*01950c46SEmmanuel Vadot		reg = <ROCKCHIP_VOP2_EP_MIPI0>;
235*01950c46SEmmanuel Vadot		remote-endpoint = <&dsi0_in_vp1>;
236*01950c46SEmmanuel Vadot	};
237*01950c46SEmmanuel Vadot};
238