1523adb55SChris Morgan// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2523adb55SChris Morgan
3523adb55SChris Morgan/dts-v1/;
4523adb55SChris Morgan
5523adb55SChris Morgan#include <dt-bindings/gpio/gpio.h>
6523adb55SChris Morgan#include <dt-bindings/input/linux-event-codes.h>
7523adb55SChris Morgan#include <dt-bindings/pinctrl/rockchip.h>
8523adb55SChris Morgan#include "rk3566-anbernic-rgxx3.dtsi"
9523adb55SChris Morgan
10523adb55SChris Morgan/ {
11523adb55SChris Morgan	model = "RG503";
12523adb55SChris Morgan	compatible = "anbernic,rg503", "rockchip,rk3566";
13523adb55SChris Morgan
14523adb55SChris Morgan	aliases {
15523adb55SChris Morgan		mmc0 = &sdmmc0;
16523adb55SChris Morgan		mmc1 = &sdmmc1;
17523adb55SChris Morgan		mmc2 = &sdmmc2;
18523adb55SChris Morgan	};
19523adb55SChris Morgan
2022a91b76SChris Morgan	battery: battery {
2122a91b76SChris Morgan		compatible = "simple-battery";
2222a91b76SChris Morgan		charge-full-design-microamp-hours = <3472000>;
2322a91b76SChris Morgan		charge-term-current-microamp = <300000>;
2422a91b76SChris Morgan		constant-charge-current-max-microamp = <2000000>;
2522a91b76SChris Morgan		constant-charge-voltage-max-microvolt = <4200000>;
2622a91b76SChris Morgan		factory-internal-resistance-micro-ohms = <117000>;
2722a91b76SChris Morgan		voltage-max-design-microvolt = <4172000>;
2822a91b76SChris Morgan		voltage-min-design-microvolt = <3400000>;
2922a91b76SChris Morgan
3022a91b76SChris Morgan		ocv-capacity-celsius = <20>;
3122a91b76SChris Morgan		ocv-capacity-table-0 =	<4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
3222a91b76SChris Morgan					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
3322a91b76SChris Morgan					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
3422a91b76SChris Morgan					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
3522a91b76SChris Morgan					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
3622a91b76SChris Morgan					<3400000 0>;
3722a91b76SChris Morgan	};
3822a91b76SChris Morgan
39523adb55SChris Morgan	gpio_spi: spi {
40523adb55SChris Morgan		compatible = "spi-gpio";
41523adb55SChris Morgan		pinctrl-names = "default";
42523adb55SChris Morgan		pinctrl-0 = <&spi_pins>;
43523adb55SChris Morgan		#address-cells = <1>;
44523adb55SChris Morgan		#size-cells = <0>;
45523adb55SChris Morgan
46523adb55SChris Morgan		sck-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
47523adb55SChris Morgan		mosi-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
48523adb55SChris Morgan		cs-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;
49523adb55SChris Morgan		num-chipselects = <0>;
50*97ce9f36SChris Morgan
51*97ce9f36SChris Morgan		panel@0 {
52*97ce9f36SChris Morgan			compatible = "samsung,ams495qa01";
53*97ce9f36SChris Morgan			reg = <0>;
54*97ce9f36SChris Morgan			pinctrl-names = "default";
55*97ce9f36SChris Morgan			pinctrl-0 = <&lcd_reset>;
56*97ce9f36SChris Morgan			reset-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_LOW>;
57*97ce9f36SChris Morgan			vdd-supply = <&vcc_3v3>;
58*97ce9f36SChris Morgan
59*97ce9f36SChris Morgan			port {
60*97ce9f36SChris Morgan				mipi_in_panel: endpoint {
61*97ce9f36SChris Morgan					remote-endpoint = <&mipi_out_panel>;
62*97ce9f36SChris Morgan				};
63*97ce9f36SChris Morgan			};
64*97ce9f36SChris Morgan		};
65523adb55SChris Morgan	};
661e141cf1SChris Morgan
671e141cf1SChris Morgan	/* Channels reversed for both headphones and speakers. */
681e141cf1SChris Morgan	sound {
691e141cf1SChris Morgan		compatible = "simple-audio-card";
701e141cf1SChris Morgan		simple-audio-card,name = "rk817_ext";
711e141cf1SChris Morgan		simple-audio-card,aux-devs = <&spk_amp>;
721e141cf1SChris Morgan		simple-audio-card,format = "i2s";
731e141cf1SChris Morgan		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
741e141cf1SChris Morgan		simple-audio-card,mclk-fs = <256>;
751e141cf1SChris Morgan		simple-audio-card,widgets =
761e141cf1SChris Morgan			"Microphone", "Mic Jack",
771e141cf1SChris Morgan			"Headphone", "Headphones",
781e141cf1SChris Morgan			"Speaker", "Internal Speakers";
791e141cf1SChris Morgan		simple-audio-card,routing =
801e141cf1SChris Morgan			"MICL", "Mic Jack",
811e141cf1SChris Morgan			"Headphones", "HPOL",
821e141cf1SChris Morgan			"Headphones", "HPOR",
831e141cf1SChris Morgan			"Internal Speakers", "Speaker Amp OUTL",
841e141cf1SChris Morgan			"Internal Speakers", "Speaker Amp OUTR",
851e141cf1SChris Morgan			"Speaker Amp INL", "HPOL",
861e141cf1SChris Morgan			"Speaker Amp INR", "HPOR";
871e141cf1SChris Morgan		simple-audio-card,pin-switches = "Internal Speakers";
881e141cf1SChris Morgan
891e141cf1SChris Morgan		simple-audio-card,codec {
901e141cf1SChris Morgan			sound-dai = <&rk817>;
911e141cf1SChris Morgan		};
921e141cf1SChris Morgan
931e141cf1SChris Morgan		simple-audio-card,cpu {
941e141cf1SChris Morgan			sound-dai = <&i2s1_8ch>;
951e141cf1SChris Morgan		};
961e141cf1SChris Morgan	};
971e141cf1SChris Morgan
981e141cf1SChris Morgan	spk_amp: audio-amplifier {
991e141cf1SChris Morgan		compatible = "simple-audio-amplifier";
1001e141cf1SChris Morgan		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
1011e141cf1SChris Morgan		pinctrl-0 = <&spk_amp_enable_h>;
1021e141cf1SChris Morgan		pinctrl-names = "default";
1031e141cf1SChris Morgan		sound-name-prefix = "Speaker Amp";
1041e141cf1SChris Morgan	};
1051e141cf1SChris Morgan};
1061e141cf1SChris Morgan
1071e141cf1SChris Morgan&cru {
1081e141cf1SChris Morgan	assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>, <&cru PLL_VPLL>;
1091e141cf1SChris Morgan	assigned-clock-rates = <1200000000>, <200000000>, <500000000>;
110523adb55SChris Morgan};
111523adb55SChris Morgan
112*97ce9f36SChris Morgan&dsi_dphy0 {
113*97ce9f36SChris Morgan	status = "okay";
114*97ce9f36SChris Morgan};
115*97ce9f36SChris Morgan
116*97ce9f36SChris Morgan&dsi0 {
117*97ce9f36SChris Morgan	status = "okay";
118*97ce9f36SChris Morgan
119*97ce9f36SChris Morgan	ports {
120*97ce9f36SChris Morgan		dsi0_in: port@0 {
121*97ce9f36SChris Morgan			reg = <0>;
122*97ce9f36SChris Morgan
123*97ce9f36SChris Morgan			dsi0_in_vp1: endpoint {
124*97ce9f36SChris Morgan				remote-endpoint = <&vp1_out_dsi0>;
125*97ce9f36SChris Morgan			};
126*97ce9f36SChris Morgan		};
127*97ce9f36SChris Morgan
128*97ce9f36SChris Morgan		dsi0_out: port@1 {
129*97ce9f36SChris Morgan			reg = <1>;
130*97ce9f36SChris Morgan
131*97ce9f36SChris Morgan			mipi_out_panel: endpoint {
132*97ce9f36SChris Morgan				remote-endpoint = <&mipi_in_panel>;
133*97ce9f36SChris Morgan			};
134*97ce9f36SChris Morgan		};
135*97ce9f36SChris Morgan	};
136*97ce9f36SChris Morgan};
137*97ce9f36SChris Morgan
138523adb55SChris Morgan&gpio_keys_control {
139523adb55SChris Morgan	button-a {
140523adb55SChris Morgan		gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
141523adb55SChris Morgan		label = "EAST";
142523adb55SChris Morgan		linux,code = <BTN_EAST>;
143523adb55SChris Morgan	};
144523adb55SChris Morgan
145523adb55SChris Morgan	button-left {
146523adb55SChris Morgan		gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
147523adb55SChris Morgan		label = "DPAD-LEFT";
148523adb55SChris Morgan		linux,code = <BTN_DPAD_LEFT>;
149523adb55SChris Morgan	};
150523adb55SChris Morgan
151523adb55SChris Morgan	button-right {
152523adb55SChris Morgan		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
153523adb55SChris Morgan		label = "DPAD-RIGHT";
154523adb55SChris Morgan		linux,code = <BTN_DPAD_RIGHT>;
155523adb55SChris Morgan	};
156523adb55SChris Morgan
157523adb55SChris Morgan	button-r1 {
158523adb55SChris Morgan		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
159523adb55SChris Morgan		label = "TR";
160523adb55SChris Morgan		linux,code = <BTN_TR>;
161523adb55SChris Morgan	};
162523adb55SChris Morgan
163523adb55SChris Morgan	button-r2 {
164523adb55SChris Morgan		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
165523adb55SChris Morgan		label = "TR2";
166523adb55SChris Morgan		linux,code = <BTN_TR2>;
167523adb55SChris Morgan	};
168523adb55SChris Morgan
169523adb55SChris Morgan	button-right {
170523adb55SChris Morgan		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
171523adb55SChris Morgan		label = "DPAD-RIGHT";
172523adb55SChris Morgan		linux,code = <BTN_DPAD_RIGHT>;
173523adb55SChris Morgan	};
174523adb55SChris Morgan
175523adb55SChris Morgan	button-y {
176523adb55SChris Morgan		gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
177523adb55SChris Morgan		label = "WEST";
178523adb55SChris Morgan		linux,code = <BTN_WEST>;
179523adb55SChris Morgan	};
180523adb55SChris Morgan};
181523adb55SChris Morgan
182523adb55SChris Morgan&pinctrl {
1831e141cf1SChris Morgan	audio-amplifier {
1841e141cf1SChris Morgan		spk_amp_enable_h: spk-amp-enable-h {
1851e141cf1SChris Morgan			rockchip,pins =
1861e141cf1SChris Morgan				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
1871e141cf1SChris Morgan		};
1881e141cf1SChris Morgan	};
1891e141cf1SChris Morgan
190*97ce9f36SChris Morgan	gpio-lcd {
191*97ce9f36SChris Morgan		lcd_reset: lcd-reset {
192*97ce9f36SChris Morgan			rockchip,pins =
193*97ce9f36SChris Morgan				<4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
194*97ce9f36SChris Morgan		};
195*97ce9f36SChris Morgan	};
196*97ce9f36SChris Morgan
197523adb55SChris Morgan	gpio-spi {
198523adb55SChris Morgan		spi_pins: spi-pins {
199523adb55SChris Morgan			rockchip,pins =
200523adb55SChris Morgan				<4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>,
201523adb55SChris Morgan				<4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
202523adb55SChris Morgan				<4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
203523adb55SChris Morgan		};
204523adb55SChris Morgan	};
205523adb55SChris Morgan};
20622a91b76SChris Morgan
20722a91b76SChris Morgan&rk817 {
20822a91b76SChris Morgan	rk817_charger: charger {
20922a91b76SChris Morgan		monitored-battery = <&battery>;
21022a91b76SChris Morgan		rockchip,resistor-sense-micro-ohms = <10000>;
21122a91b76SChris Morgan		rockchip,sleep-enter-current-microamp = <300000>;
21222a91b76SChris Morgan		rockchip,sleep-filter-current-microamp = <100000>;
21322a91b76SChris Morgan	};
21422a91b76SChris Morgan};
215*97ce9f36SChris Morgan
216*97ce9f36SChris Morgan&vp1 {
217*97ce9f36SChris Morgan	vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 {
218*97ce9f36SChris Morgan		reg = <ROCKCHIP_VOP2_EP_MIPI0>;
219*97ce9f36SChris Morgan		remote-endpoint = <&dsi0_in_vp1>;
220*97ce9f36SChris Morgan	};
221*97ce9f36SChris Morgan};
222