Skip to contentSkip to conversation

Add Anbernic RG353V and RG353VS

PATCH Applied Chris Morgan 3 participants 7 messages Oct 28, 2022 – Oct 30, 2022

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

cover Add Anbernic RG353V and RG353VS

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG353V and RG353VS handheld gaming consoles. These devices are extremely similar to the existing Anbernic RG353P.

Add support for the battery of the existing RG353P and RG503 too as part of this change, as to keep things compact we must first split the 353p devicetree into attributes common to all 353 devices and attributes that only exist for the 353P, 353V, and 353VS devices (which includes a different battery in the V and VS).

Lastly, add poll-interval to the parent tree so that it affects all existing Anbernic RGxx3 devices.

Chris Morgan (4):
dt-bindings: arm: rockchip: Add Anbernic RG353V and RG353VS
arm64: dts: rockchip: add Anbernic RG353V and RG353VS
arm64: dts: rockchip: add rk817 chg to RG353P and RG503
arm64: dts: rockchip: add poll-interval to RGxx3 devices

 .../devicetree/bindings/arm/rockchip.yaml     |  10 ++
 arch/arm64/boot/dts/rockchip/Makefile         |   2 +
 .../dts/rockchip/rk3566-anbernic-rg353p.dts   | 109 +++++++++++------
 .../dts/rockchip/rk3566-anbernic-rg353v.dts   | 114 ++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg353vs.dts  |  87 +++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg353x.dtsi  |  60 +++++++++
 .../dts/rockchip/rk3566-anbernic-rg503.dts    |  79 ++++++++++++
 .../dts/rockchip/rk3566-anbernic-rgxx3.dtsi   |  47 +-------
 8 files changed, 424 insertions(+), 84 deletions(-)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353x.dtsi
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 dt-bindings: arm: rockchip: Add Anbernic RG353V and RG353VS

From: Chris Morgan <[email protected]>

Add entry for the Anbernic RG353V and RG353VS handheld devices.

---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +10 -0
index c6c69a4e3777..29a1a30e0606 100644
@@ -35,6 +35,16 @@ properties:
           - const: anbernic,rg353p
           - 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
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/4 arm64: dts: rockchip: add Anbernic RG353V and RG353VS

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Anbernic RG353V and RG353VS are both RK3566 based handheld gaming devices from Anbernic.

They are functionally very similar to the RG353P with the following distinct differences:
- The battery size of the RG353V and RG353VS is 3200mAh instead of 3500mAh.
- The audio uses the PMIC's internal amplifier for a mono speaker instead of an external amplifier with stereo speakers.
- The GPIOs for the R1 and R2 buttons are switched.

As for the differences between the RG353V and RG353VS, they are as follows:
- The RG353VS has no touchscreen on i2c2.
- The RG353VS has no eMMC.
- The RG353VS has 1GB of RAM instead of 2GB.

---
 arch/arm64/boot/dts/rockchip/Makefile         |   2 +
 .../dts/rockchip/rk3566-anbernic-rg353p.dts   |  83 +++++++------
 .../dts/rockchip/rk3566-anbernic-rg353v.dts   | 114 ++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg353vs.dts  |  87 +++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg353x.dtsi  |  60 +++++++++
 .../dts/rockchip/rk3566-anbernic-rg503.dts    |  51 ++++++++
 .../dts/rockchip/rk3566-anbernic-rgxx3.dtsi   |  46 -------
 7 files changed, 358 insertions(+), 85 deletions(-)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353x.dtsi
arch/arm64/boot/dts/rockchip/Makefile +2 -0
index 8c15593c0ca4..a1f38acb8dfa 100644
@@ -62,6 +62,8 @@ 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-rg353p.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353v.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353vs.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg503.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pinenote-v1.1.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pinenote-v1.2.dtb
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts +44 -39

112 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts new file +114 -0

114 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts new file +87 -0

87 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353x.dtsi new file +60 -0

60 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts +51 -0

63 lines not on this page · raw message

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

64 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

PATCH 3/4 arm64: dts: rockchip: add rk817 chg to RG353P and RG503

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the internal battery and charger for the Anbernic RG353P and RG503. Battery values are taken from the BSP Kernel device tree.

---
 .../dts/rockchip/rk3566-anbernic-rg353p.dts   | 28 +++++++++++++++++++
 .../dts/rockchip/rk3566-anbernic-rg503.dts    | 28 +++++++++++++++++++
 2 files changed, 56 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts +28 -0
index 80716b2ebd29..63cff402f3a8 100644
@@ -18,6 +18,25 @@ aliases {
 		mmc3 = &sdmmc2;
 	};
 
+	battery: battery {
+		compatible = "simple-battery";
+		charge-full-design-microamp-hours = <3472000>;
+		charge-term-current-microamp = <300000>;
+		constant-charge-current-max-microamp = <2000000>;
+		constant-charge-voltage-max-microvolt = <4200000>;
+		factory-internal-resistance-micro-ohms = <117000>;
+		voltage-max-design-microvolt = <4172000>;
+		voltage-min-design-microvolt = <3400000>;
+
+		ocv-capacity-celsius = <20>;
+		ocv-capacity-table-0 =  <4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
+					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
+					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
+					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
+					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
+					<3400000 0>;
+	};
+
 	/* Channels reversed for both headphones and speakers. */
 	sound {
 		compatible = "simple-audio-card";
@@ -87,6 +106,15 @@ spk_amp_enable_h: spk-amp-enable-h {
 	};
 };
 
+&rk817 {
+	rk817_charger: charger {
+		monitored-battery = <&battery>;
+		rockchip,resistor-sense-micro-ohms = <10000>;
+		rockchip,sleep-enter-current-microamp = <300000>;
+		rockchip,sleep-filter-current-microamp = <100000>;
+	};
+};
+
 &sdhci {
 	pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, <&emmc_datastrobe>, <&emmc_rstnout>;
 	pinctrl-names = "default";
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts +28 -0
index c56c290f0d87..5dafcc86296b 100644
@@ -17,6 +17,25 @@ aliases {
 		mmc2 = &sdmmc2;
 	};
 
+	battery: battery {
+		compatible = "simple-battery";
+		charge-full-design-microamp-hours = <3472000>;
+		charge-term-current-microamp = <300000>;
+		constant-charge-current-max-microamp = <2000000>;
+		constant-charge-voltage-max-microvolt = <4200000>;
+		factory-internal-resistance-micro-ohms = <117000>;
+		voltage-max-design-microvolt = <4172000>;
+		voltage-min-design-microvolt = <3400000>;
+
+		ocv-capacity-celsius = <20>;
+		ocv-capacity-table-0 =	<4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
+					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
+					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
+					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
+					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
+					<3400000 0>;
+	};
+
 	gpio_spi: spi {
 		compatible = "spi-gpio";
 		pinctrl-names = "default";
@@ -136,3 +155,12 @@ spi_pins: spi-pins {
 		};
 	};
 };
+
+&rk817 {
+	rk817_charger: charger {
+		monitored-battery = <&battery>;
+		rockchip,resistor-sense-micro-ohms = <10000>;
+		rockchip,sleep-enter-current-microamp = <300000>;
+		rockchip,sleep-filter-current-microamp = <100000>;
+	};
+};
Signature · 1 line
2.25.1
#5 lore raw

PATCH 4/4 arm64: dts: rockchip: add poll-interval to RGxx3 devices

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add adc-joystick polling for all Anbernic RGxx3 based devices. They are all functionally identical in how they work.

---
 arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi +1 -0
index 010c6a77a9da..41262a69d33e 100644
@@ -22,6 +22,7 @@ adc-joystick {
 			      <&adc_mux 3>;
 		pinctrl-0 = <&joy_mux_en>;
 		pinctrl-names = "default";
+		poll-interval = <60>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 
Signature · 1 line
2.25.1
maintainer Applied
#6 lore raw
In reply to Chris Morgan
Quoted 6 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG353V and RG353VS handheld gaming consoles. These devices are extremely similar to the existing Anbernic RG353P.

Quoted 7 lines

Add support for the battery of the existing RG353P and RG503 too as part of this change, as to keep things compact we must first split the 353p devicetree into attributes common to all 353 devices and attributes that only exist for the 353P, 353V, and 353VS devices (which includes a different battery in the V and VS).

[...]

Applied, thanks!

[1/4] dt-bindings: arm: rockchip: Add Anbernic RG353V and RG353VS

      commit: e1cc1e712d85c10ad47a083186c222210dab5b23
[2/4] arm64: dts: rockchip: add Anbernic RG353V and RG353VS
      commit: 1e141cf127262150d053ed3f80d0d3c42de11c43
[3/4] arm64: dts: rockchip: add rk817 chg to RG353P and RG503
      commit: 22a91b7614132ce0651d0ddd6e0bcee119370840
[4/4] arm64: dts: rockchip: add poll-interval to RGxx3 devices
      commit: 60bd5ee7c8a855a7917fe41771b0e297912a7626

Best regards,

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