xref: /linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts (revision 7f71507851fc7764b36a3221839607d3a45c2025)
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	model = "Anbernic RG503";
12	compatible = "anbernic,rg503", "rockchip,rk3566";
13
14	aliases {
15		mmc0 = &sdmmc0;
16		mmc1 = &sdmmc1;
17		mmc2 = &sdmmc2;
18	};
19
20	adc-joystick {
21		compatible = "adc-joystick";
22		io-channels = <&adc_mux 0>,
23			      <&adc_mux 1>,
24			      <&adc_mux 2>,
25			      <&adc_mux 3>;
26		pinctrl-0 = <&joy_mux_en>;
27		pinctrl-names = "default";
28		poll-interval = <60>;
29		#address-cells = <1>;
30		#size-cells = <0>;
31
32		axis@0 {
33			reg = <0>;
34			abs-flat = <32>;
35			abs-fuzz = <32>;
36			abs-range = <1023 15>;
37			linux,code = <ABS_X>;
38		};
39
40		axis@1 {
41			reg = <1>;
42			abs-flat = <32>;
43			abs-fuzz = <32>;
44			abs-range = <15 1023>;
45			linux,code = <ABS_RX>;
46		};
47
48		axis@2 {
49			reg = <2>;
50			abs-flat = <32>;
51			abs-fuzz = <32>;
52			abs-range = <15 1023>;
53			linux,code = <ABS_Y>;
54		};
55
56		axis@3 {
57			reg = <3>;
58			abs-flat = <32>;
59			abs-fuzz = <32>;
60			abs-range = <1023 15>;
61			linux,code = <ABS_RY>;
62		};
63	};
64
65	adc_mux: adc-mux {
66		compatible = "io-channel-mux";
67		channels = "left_x", "right_x", "left_y", "right_y";
68		#io-channel-cells = <1>;
69		io-channels = <&saradc 3>;
70		io-channel-names = "parent";
71		mux-controls = <&gpio_mux>;
72		settle-time-us = <100>;
73	};
74
75	battery: battery {
76		compatible = "simple-battery";
77		charge-full-design-microamp-hours = <3472000>;
78		charge-term-current-microamp = <300000>;
79		constant-charge-current-max-microamp = <2000000>;
80		constant-charge-voltage-max-microvolt = <4200000>;
81		factory-internal-resistance-micro-ohms = <117000>;
82		voltage-max-design-microvolt = <4172000>;
83		voltage-min-design-microvolt = <3400000>;
84
85		ocv-capacity-celsius = <20>;
86		ocv-capacity-table-0 =	<4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
87					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
88					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
89					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
90					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
91					<3400000 0>;
92	};
93
94	gpio_mux: mux-controller {
95		compatible = "gpio-mux";
96		mux-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>,
97			    <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>;
98		#mux-control-cells = <0>;
99	};
100
101	gpio_spi: spi {
102		compatible = "spi-gpio";
103		pinctrl-names = "default";
104		pinctrl-0 = <&spi_pins>;
105		#address-cells = <1>;
106		#size-cells = <0>;
107
108		sck-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
109		mosi-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
110		cs-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;
111		num-chipselects = <0>;
112
113		panel@0 {
114			compatible = "samsung,ams495qa01";
115			reg = <0>;
116			pinctrl-names = "default";
117			pinctrl-0 = <&lcd_reset>;
118			reset-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_LOW>;
119			vdd-supply = <&vcc_3v3>;
120
121			port {
122				mipi_in_panel: endpoint {
123					remote-endpoint = <&mipi_out_panel>;
124				};
125			};
126		};
127	};
128
129	/* Channels reversed for both headphones and speakers. */
130	sound {
131		compatible = "simple-audio-card";
132		simple-audio-card,name = "rk817_ext";
133		simple-audio-card,aux-devs = <&spk_amp>;
134		simple-audio-card,format = "i2s";
135		simple-audio-card,hp-det-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
136		simple-audio-card,mclk-fs = <256>;
137		simple-audio-card,widgets =
138			"Microphone", "Mic Jack",
139			"Headphone", "Headphones",
140			"Speaker", "Internal Speakers";
141		simple-audio-card,routing =
142			"MICL", "Mic Jack",
143			"Headphones", "HPOL",
144			"Headphones", "HPOR",
145			"Internal Speakers", "Speaker Amp OUTL",
146			"Internal Speakers", "Speaker Amp OUTR",
147			"Speaker Amp INL", "HPOL",
148			"Speaker Amp INR", "HPOR";
149		simple-audio-card,pin-switches = "Internal Speakers";
150
151		simple-audio-card,codec {
152			sound-dai = <&rk817>;
153		};
154
155		simple-audio-card,cpu {
156			sound-dai = <&i2s1_8ch>;
157		};
158	};
159
160	spk_amp: audio-amplifier {
161		compatible = "simple-audio-amplifier";
162		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
163		pinctrl-0 = <&spk_amp_enable_h>;
164		pinctrl-names = "default";
165		sound-name-prefix = "Speaker Amp";
166	};
167};
168
169&cru {
170	assigned-clocks = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>,
171			  <&pmucru PLL_PPLL>, <&cru PLL_VPLL>;
172	assigned-clock-rates = <32768>, <1200000000>,
173			       <200000000>, <500000000>;
174};
175
176&dsi_dphy0 {
177	status = "okay";
178};
179
180&dsi0 {
181	status = "okay";
182
183	ports {
184		dsi0_in: port@0 {
185			reg = <0>;
186
187			dsi0_in_vp1: endpoint {
188				remote-endpoint = <&vp1_out_dsi0>;
189			};
190		};
191
192		dsi0_out: port@1 {
193			reg = <1>;
194
195			mipi_out_panel: endpoint {
196				remote-endpoint = <&mipi_in_panel>;
197			};
198		};
199	};
200};
201
202&gpio_keys_control {
203	button-a {
204		gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
205		label = "EAST";
206		linux,code = <BTN_EAST>;
207	};
208
209	button-left {
210		gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
211		label = "DPAD-LEFT";
212		linux,code = <BTN_DPAD_LEFT>;
213	};
214
215	button-right {
216		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
217		label = "DPAD-RIGHT";
218		linux,code = <BTN_DPAD_RIGHT>;
219	};
220
221	button-r1 {
222		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
223		label = "TR";
224		linux,code = <BTN_TR>;
225	};
226
227	button-r2 {
228		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
229		label = "TR2";
230		linux,code = <BTN_TR2>;
231	};
232
233	button-right {
234		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
235		label = "DPAD-RIGHT";
236		linux,code = <BTN_DPAD_RIGHT>;
237	};
238
239	button-thumbl {
240		gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
241		label = "THUMBL";
242		linux,code = <BTN_THUMBL>;
243	};
244
245	button-thumbr {
246		gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
247		label = "THUMBR";
248		linux,code = <BTN_THUMBR>;
249	};
250
251	button-y {
252		gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
253		label = "WEST";
254		linux,code = <BTN_WEST>;
255	};
256};
257
258&pinctrl {
259	audio-amplifier {
260		spk_amp_enable_h: spk-amp-enable-h {
261			rockchip,pins =
262				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
263		};
264	};
265
266	gpio-lcd {
267		lcd_reset: lcd-reset {
268			rockchip,pins =
269				<4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
270		};
271	};
272
273	gpio-spi {
274		spi_pins: spi-pins {
275			rockchip,pins =
276				<4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>,
277				<4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
278				<4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
279		};
280	};
281};
282
283&rk817 {
284	rk817_charger: charger {
285		monitored-battery = <&battery>;
286		rockchip,resistor-sense-micro-ohms = <10000>;
287		rockchip,sleep-enter-current-microamp = <300000>;
288		rockchip,sleep-filter-current-microamp = <100000>;
289	};
290};
291
292&vp1 {
293	vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 {
294		reg = <ROCKCHIP_VOP2_EP_MIPI0>;
295		remote-endpoint = <&dsi0_in_vp1>;
296	};
297};
298