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