Skip to contentSkip to conversation

Add Support for RK3566 Anbernic RG-ARC

PATCH Applied Chris Morgan 3 participants 7 messages Jan 23, 2024 – Jan 25, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add Support for RK3566 Anbernic RG-ARC

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG-ARC S and RG-ARC D handheld gaming console.

Chris Morgan (4):
arm64: dts: rockchip: Move device specific properties
dt-bindings: arm: rockchip: Add Anbernic RG-Arc
clk: rockchip: rk3568: Add PLL rate for 128MHz
arm64: dts: rockchip: add Anbernic RG-ARC S and RG-ARC D

 .../devicetree/bindings/arm/rockchip.yaml     |  31 +--
 arch/arm64/boot/dts/rockchip/Makefile         |   2 +
 .../dts/rockchip/rk3566-anbernic-rg-arc-d.dts |  42 ++++
 .../dts/rockchip/rk3566-anbernic-rg-arc-s.dts |  19 ++
 .../dts/rockchip/rk3566-anbernic-rg-arc.dtsi  | 237 ++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg353x.dtsi  |  74 ++++++
 .../dts/rockchip/rk3566-anbernic-rg503.dts    |  74 ++++++
 .../dts/rockchip/rk3566-anbernic-rgxx3.dtsi   |  74 ------
 drivers/clk/rockchip/clk-rk3568.c             |   1 +
 9 files changed, 458 insertions(+), 96 deletions(-)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-d.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-s.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc.dtsi
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 arm64: dts: rockchip: Move device specific properties

From: Chris Morgan <[email protected]>

Move device specific properties related to the ADC Joystick to different board specific device trees. This is in preparation for adding the Anbernic RG-Arc series of devices.

---
 .../dts/rockchip/rk3566-anbernic-rg353x.dtsi  | 74 +++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg503.dts    | 74 +++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rgxx3.dtsi   | 74 -------------------
 3 files changed, 148 insertions(+), 74 deletions(-)
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353x.dtsi +74 -0
index 2a2821f4c580..63a18ff36cea 100644
@@ -8,11 +8,73 @@
 #include "rk3566-anbernic-rgxx3.dtsi"
 
 / {
+	adc-joystick {
+		compatible = "adc-joystick";
+		io-channels = <&adc_mux 0>,
+			      <&adc_mux 1>,
+			      <&adc_mux 2>,
+			      <&adc_mux 3>;
+		pinctrl-0 = <&joy_mux_en>;
+		pinctrl-names = "default";
+		poll-interval = <60>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		axis@0 {
+			reg = <0>;
+			abs-flat = <32>;
+			abs-fuzz = <32>;
+			abs-range = <1023 15>;
+			linux,code = <ABS_X>;
+		};
+
+		axis@1 {
+			reg = <1>;
+			abs-flat = <32>;
+			abs-fuzz = <32>;
+			abs-range = <15 1023>;
+			linux,code = <ABS_RX>;
+		};
+
+		axis@2 {
+			reg = <2>;
+			abs-flat = <32>;
+			abs-fuzz = <32>;
+			abs-range = <15 1023>;
+			linux,code = <ABS_Y>;
+		};
+
+		axis@3 {
+			reg = <3>;
+			abs-flat = <32>;
+			abs-fuzz = <32>;
+			abs-range = <1023 15>;
+			linux,code = <ABS_RY>;
+		};
+	};
+
+	adc_mux: adc-mux {
+		compatible = "io-channel-mux";
+		channels = "left_x", "right_x", "left_y", "right_y";
+		#io-channel-cells = <1>;
+		io-channels = <&saradc 3>;
+		io-channel-names = "parent";
+		mux-controls = <&gpio_mux>;
+		settle-time-us = <100>;
+	};
+
 	backlight: backlight {
 		compatible = "pwm-backlight";
 		power-supply = <&vcc_sys>;
 		pwms = <&pwm4 0 25000 0>;
 	};
+
+	gpio_mux: mux-controller {
+		compatible = "gpio-mux";
+		mux-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>,
+			    <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>;
+		#mux-control-cells = <0>;
+	};
 };
 
 &cru {
@@ -83,6 +145,18 @@ button-right {
 		linux,code = <BTN_DPAD_RIGHT>;
 	};
 
+	button-thumbl {
+		gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
+		label = "THUMBL";
+		linux,code = <BTN_THUMBL>;
+	};
+
+	button-thumbr {
+		gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
+		label = "THUMBR";
+		linux,code = <BTN_THUMBR>;
+	};
+
 	button-y {
 		gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
 		label = "WEST";
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts +74 -0

92 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi +0 -74

98 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/4 dt-bindings: arm: rockchip: Add Anbernic RG-Arc

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add the Anbernic RG-Arc S and RG-Arc D devices, and consolidate all Anbernic RK3566 based devices under a single description.

---
 .../devicetree/bindings/arm/rockchip.yaml     | 31 ++++++-------------
 1 file changed, 9 insertions(+), 22 deletions(-)
Documentation/devicetree/bindings/arm/rockchip.yaml +9 -22
index 5cf5cbef2cf5..5592fdc85b9e 100644
@@ -37,29 +37,16 @@ properties:
               - anbernic,rg351v
           - const: rockchip,rk3326
 
-      - description: Anbernic RG353P
+      - description: Anbernic RK3566 Handheld Gaming Console
         items:
-          - const: anbernic,rg353p
-          - const: rockchip,rk3566
-
-      - description: Anbernic RG353PS
-        items:
-          - const: anbernic,rg353ps
-          - const: rockchip,rk3566
-
-      - description: Anbernic RG353V
-        items:
-          - const: anbernic,rg353v
-          - const: rockchip,rk3566
-
-      - description: Anbernic RG353VS
-        items:
-          - const: anbernic,rg353vs
-          - const: rockchip,rk3566
-
-      - description: Anbernic RG503
-        items:
-          - const: anbernic,rg503
+          - enum:
+              - anbernic,rg353p
+              - anbernic,rg353ps
+              - anbernic,rg353v
+              - anbernic,rg353vs
+              - anbernic,rg503
+              - anbernic,rg-arc-d
+              - anbernic,rg-arc-s
           - const: rockchip,rk3566
 
       - description: Asus Tinker board
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#3 lore raw

Re: [PATCH 2/4] dt-bindings: arm: rockchip: Add Anbernic RG-Arc

Quoted 10 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add the Anbernic RG-Arc S and RG-Arc D devices, and consolidate all Anbernic RK3566 based devices under a single description.

---
 .../devicetree/bindings/arm/rockchip.yaml     | 31 ++++++-------------
 1 file changed, 9 insertions(+), 22 deletions(-)

Best regards,
Krzysztof

#4 lore raw

PATCH 3/4 clk: rockchip: rk3568: Add PLL rate for 128MHz

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add PLL rate for 128MHz to allow the panel for the Anbernic RG-ARC series to run at 60hz.

---
 drivers/clk/rockchip/clk-rk3568.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-rk3568.c +1 -0
index b786ddc9af2a..8cb21d10beca 100644
@@ -78,6 +78,7 @@ static struct rockchip_pll_rate_table rk3568_pll_rates[] = {
 	RK3036_PLL_RATE(200000000, 1, 100, 3, 4, 1, 0),
 	RK3036_PLL_RATE(148500000, 1, 99, 4, 4, 1, 0),
 	RK3036_PLL_RATE(135000000, 2, 45, 4, 1, 1, 0),
+	RK3036_PLL_RATE(128000000, 1, 16, 3, 1, 1, 0),
 	RK3036_PLL_RATE(126400000, 1, 79, 5, 3, 1, 0),
 	RK3036_PLL_RATE(119000000, 3, 119, 4, 2, 1, 0),
 	RK3036_PLL_RATE(115200000, 1, 24, 5, 1, 1, 0),
Signature · 1 line
2.34.1
#5 lore raw

PATCH 4/4 arm64: dts: rockchip: add Anbernic RG-ARC S and RG-ARC D

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG-ARC S and RG-ARC D devices. These devices feature the following:
- Rockchip RK3566 SoC
- 4 inch 480x640 display (rotated)
- Goodix multi-touch (ARC D only, untested as I lack the device)
- 1GB (ARC S) or 2GB (ARC D) of RAM
- 2 SDMMC slots
- eMMC (ARC D only)
- Realtek 8821CS WiFi/Bluetooth
- External stereo speakers
- 6 face buttons (A, B, C, X, Y, Z) along with a D-Pad and start and select buttons.
- A PWM vibrator.

Note that the Goodix touchscreen on I2C2 is not defined, as I lack the necessary hardware to confirm it works correctly with the mainline driver.

---
 arch/arm64/boot/dts/rockchip/Makefile         |   2 +
 .../dts/rockchip/rk3566-anbernic-rg-arc-d.dts |  42 ++++
 .../dts/rockchip/rk3566-anbernic-rg-arc-s.dts |  19 ++
 .../dts/rockchip/rk3566-anbernic-rg-arc.dtsi  | 237 ++++++++++++++++++
 4 files changed, 300 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-d.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-s.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc.dtsi
arch/arm64/boot/dts/rockchip/Makefile +2 -0
index a7b30e11beaf..647be86ea8a6 100644
@@ -71,6 +71,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399pro-rock-pi-n10.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg-arc-d.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg-arc-s.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353p.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353ps.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353v.dtb
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-d.dts new file +42 -0

42 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc-s.dts new file +19 -0
new file mode 100644
index 000000000000..6264a8c78d0b
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/pinctrl/rockchip.h>
+#include "rk3566-anbernic-rg-arc.dtsi"
+
+/ {
+	model = "Anbernic RG ARC-S";
+	compatible = "anbernic,rg-arc-s", "rockchip,rk3566";
+
+	aliases {
+		mmc1 = &sdmmc0;
+		mmc2 = &sdmmc1;
+		mmc3 = &sdmmc2;
+	};
+};
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg-arc.dtsi new file +237 -0

237 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Applied
#6 lore raw
In reply to Chris Morgan
Quoted 5 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG-ARC S and RG-ARC D handheld gaming console.

Quoted 7 lines

Chris Morgan (4):
arm64: dts: rockchip: Move device specific properties
dt-bindings: arm: rockchip: Add Anbernic RG-Arc
clk: rockchip: rk3568: Add PLL rate for 128MHz
arm64: dts: rockchip: add Anbernic RG-ARC S and RG-ARC D

[...]

Applied, thanks!

[1/4] arm64: dts: rockchip: Move device specific properties

      commit: 46943b333d60b8f4998df359fe697254eb2f90ad
[2/4] dt-bindings: arm: rockchip: Add Anbernic RG-Arc
      commit: e441dd472eb23329de738f365a5429fe7e6f844b
[3/4] clk: rockchip: rk3568: Add PLL rate for 128MHz
      commit: b3244351e2b39bd49aba780ea204f0f2a45a4725
[4/4] arm64: dts: rockchip: add Anbernic RG-ARC S and RG-ARC D
      commit: 05a708c6ebcadfb6c506f649375ccfc56b572652

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>