Skip to contentSkip to conversation

Add Anbernic RG35XX-SP

PATCH Superseded Chris Morgan 5 participants 10 messages Jul 2, 2024 – Jul 5, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Anbernic RG35XX-SP

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG35XX-SP handheld gaming device. The Anbernic RG35XX-SP is a clamshell device, but hardware wise is very similar to the RG35XX-Plus. The RG35XX-SP has a lid-switch and an external RTC that necessitate a distinct device tree.

Changes from V1:
- Switched all RG35XX devices from the r_rsb bus to the r_i2c bus for the PMIC to keep it consistent.
- Added missing pinctrl nodes in sun50i-h616.dtsi file for the r_i2c bus.
- Modified devicetree documentation to keep definition of the RG35XX series consistent with other Allwinner devices.

Chris Morgan (4):
dt-bindings: arm: sunxi: Add Anbernic RG35XXSP
arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
arm64: dts: allwinner: h616: Change RG35XX Series from r_rsb to r_i2c
arm64: dts: allwinner: h700: Add Anbernic RG35XX-SP

 .../devicetree/bindings/arm/sunxi.yaml        |  9 +++--
 arch/arm64/boot/dts/allwinner/Makefile        |  3 +-
 .../arm64/boot/dts/allwinner/sun50i-h616.dtsi |  2 ++
 .../sun50i-h700-anbernic-rg35xx-2024.dts      |  6 ++--
 .../sun50i-h700-anbernic-rg35xx-sp.dts        | 34 +++++++++++++++++++
 5 files changed, 48 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/4 dt-bindings: arm: sunxi: Add Anbernic RG35XXSP

From: Chris Morgan <[email protected]>

Add the Anbernic RG35XXSP variant device and consolidate the Anbernic H700 devices.

The Anbernic RG35XXSP is almost identical to the RG35XX-Plus, but in a clamshell form-factor with an external RTC and a lid switch.

---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/sunxi.yaml +7 -2
index c2a158b75e49..60b11b289535 100644
@@ -61,14 +61,19 @@ properties:
           - const: anbernic,rg35xx-2024
           - const: allwinner,sun50i-h700
 
+      - description: Anbernic RG35XX H
+        items:
+          - const: anbernic,rg35xx-h
+          - const: allwinner,sun50i-h700
+
       - description: Anbernic RG35XX Plus
         items:
           - const: anbernic,rg35xx-plus
           - const: allwinner,sun50i-h700
 
-      - description: Anbernic RG35XX H
+      - description: Anbernic RG35XX SP
         items:
-          - const: anbernic,rg35xx-h
+          - const: anbernic,rg35xx-sp
           - const: allwinner,sun50i-h700
 
       - description: Amarula A64 Relic
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH V2 1/4] dt-bindings: arm: sunxi: Add Anbernic RG35XXSP

Quoted 26 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add the Anbernic RG35XXSP variant device and consolidate the Anbernic H700 devices.

The Anbernic RG35XXSP is almost identical to the RG35XX-Plus, but in a clamshell form-factor with an external RTC and a lid switch.

---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/sunxi.yaml +5 -0
index c2a158b75e49..60b11b289535 100644
@@ -61,14 +61,19 @@ properties:
           - const: anbernic,rg35xx-2024
           - const: allwinner,sun50i-h700
 
+      - description: Anbernic RG35XX H
+        items:
+          - const: anbernic,rg35xx-h
+          - const: allwinner,sun50i-h700
+

Documentation/devicetree/bindings/arm/sunxi.yaml properties: · line 76

Quoted 10 lines
Documentation/devicetree/bindings/arm/sunxi.yaml +2 -2
       - description: Anbernic RG35XX Plus
         items:
           - const: anbernic,rg35xx-plus
           - const: allwinner,sun50i-h700
 
-      - description: Anbernic RG35XX H
+      - description: Anbernic RG35XX SP
         items:
-          - const: anbernic,rg35xx-h
+          - const: anbernic,rg35xx-sp

Where is the consolidation? All this is supposed to be in an enum...

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH V2 1/4] dt-bindings: arm: sunxi: Add Anbernic RG35XXSP

Quoted 32 lines · Krzysztof Kozlowski
Quoted 31 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add the Anbernic RG35XXSP variant device and consolidate the Anbernic H700 devices.

The Anbernic RG35XXSP is almost identical to the RG35XX-Plus, but in a clamshell form-factor with an external RTC and a lid switch.

---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/sunxi.yaml +5 -0
index c2a158b75e49..60b11b289535 100644
@@ -61,14 +61,19 @@ properties:
           - const: anbernic,rg35xx-2024
           - const: allwinner,sun50i-h700
 
+      - description: Anbernic RG35XX H
+        items:
+          - const: anbernic,rg35xx-h
+          - const: allwinner,sun50i-h700
+
       - description: Anbernic RG35XX Plus
         items:
           - const: anbernic,rg35xx-plus
           - const: allwinner,sun50i-h700
 
Quoted 8 lines

Documentation/devicetree/bindings/arm/sunxi.yaml properties: · line 76

Quoted 5 lines
Documentation/devicetree/bindings/arm/sunxi.yaml +2 -2
-      - description: Anbernic RG35XX H
+      - description: Anbernic RG35XX SP
         items:
-          - const: anbernic,rg35xx-h
+          - const: anbernic,rg35xx-sp

Where is the consolidation? All this is supposed to be in an enum...

I didn't properly edit the notes when I posted the v2 sadly. I forgot to remove the text about consolidating the devices, since that's how the rest of the Allwinner devices are done today. I'll resubmit once I have a few more views on the other patches in this series.

Thank you,
Chris

Quoted 5 lines

Best regards,
Krzysztof

#4 lore raw

PATCH v2 2/4 arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add pinctrl nodes for the r_i2c node. Without the pinmux defined the r_i2c bus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.

---
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2 -0
index 921d5f61d8d6..e31945c3895e 100644
@@ -837,6 +837,8 @@ r_i2c: i2c@7081400 {
 			dmas = <&dma 48>, <&dma 48>;
 			dma-names = "rx", "tx";
 			resets = <&r_ccu RST_R_APB2_I2C>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_i2c_pins>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.34.1
Reviewed-by on v2 2/4
#5 lore raw

Re: [PATCH V2 2/4] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes

Quoted 5 lines · On Tue, 2 Jul 2024 14:34:12 -0500 Chris Morgan <[email protected]> wrote:

From: Chris Morgan <[email protected]>

Add pinctrl nodes for the r_i2c node. Without the pinmux defined the r_i2c bus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.

Yes, those are the only pins available, checked against the manual.

Quoted 1 line

Cheers,
Andre

Quoted 17 lines
---
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2 -0
index 921d5f61d8d6..e31945c3895e 100644
@@ -837,6 +837,8 @@ r_i2c: i2c@7081400 {
 			dmas = <&dma 48>, <&dma 48>;
 			dma-names = "rx", "tx";
 			resets = <&r_ccu RST_R_APB2_I2C>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_i2c_pins>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
#6 lore raw

Re: [PATCH V2 2/4] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes

Quoted 10 lines · On Wed, 3 Jul 2024 14:14:39 +0100 Andre Przywara <[email protected]> wrote:
Quoted 5 lines · On Tue, 2 Jul 2024 14:34:12 -0500 Chris Morgan <[email protected]> wrote:

From: Chris Morgan <[email protected]>

Add pinctrl nodes for the r_i2c node. Without the pinmux defined the r_i2c bus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.

Yes, those are the only pins available, checked against the manual.

Looking closer, this is actually a proper bug: none of the five H616 devices using R_I2C set the pinmux (not even in the board .dts files), so nothing sets this up in the kernel. We are just lucky that U-Boot's SPL programs the pinmux, and nothing changes it afterwards. So this should be taken as a fix ASAP, potentially with:

Fixes 0d17c8651188 ("arm64: dts: allwinner: Add Allwinner H616 .dtsi file")

(though I am a bit doubtful about the useful of DT backports in general)

Cheers,
Andre

Quoted 27 lines
Quoted 2 lines

Cheers,
Andre

Quoted 17 lines
---
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2 -0
index 921d5f61d8d6..e31945c3895e 100644
@@ -837,6 +837,8 @@ r_i2c: i2c@7081400 {
 			dmas = <&dma 48>, <&dma 48>;
 			dma-names = "rx", "tx";
 			resets = <&r_ccu RST_R_APB2_I2C>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_i2c_pins>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;  
#7 lore raw

PATCH v2 3/4 arm64: dts: allwinner: h616: Change RG35XX Series from r_rsb to r_i2c

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Change the Anbernic RG35XX series to use the r_i2c bus for the PMIC instead of the r_rsb bus. This is to keep the device tree consistent as there are at least 2 devices (the RG35XX-SP and RG28XX) that have an external RTC on the r_i2c bus.

---
 .../boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +3 -3
index ee30584b6ad7..e2bbd22bd80a 100644
@@ -201,12 +201,12 @@ &pio {
 	vcc-pi-supply = <&reg_cldo3>;
 };
 
-&r_rsb {
+&r_i2c {
 	status = "okay";
 
-	axp717: pmic@3a3 {
+	axp717: pmic@34 {
 		compatible = "x-powers,axp717";
-		reg = <0x3a3>;
+		reg = <0x34>;
 		interrupt-controller;
 		#interrupt-cells = <1>;
 		interrupt-parent = <&nmi_intc>;
Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 4/4 arm64: dts: allwinner: h700: Add Anbernic RG35XX-SP

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

The Anbernic RG35XXSP is almost identical to the RG35XX-Plus, but in a clamshell form-factor. The key differences between the SP and the Plus is a lid switch and an RTC on the same i2c bus as the PMIC.

---
 arch/arm64/boot/dts/allwinner/Makefile        |  3 +-
 .../sun50i-h700-anbernic-rg35xx-sp.dts        | 34 +++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts
arch/arm64/boot/dts/allwinner/Makefile +2 -1
index 0db7b60b49a1..00bed412ee31 100644
@@ -49,5 +49,6 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero2w.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero3.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-transpeed-8k618-t.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h700-anbernic-rg35xx-2024.dtb
-dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h700-anbernic-rg35xx-plus.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h700-anbernic-rg35xx-h.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h700-anbernic-rg35xx-plus.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h700-anbernic-rg35xx-sp.dtb
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts new file +34 -0
new file mode 100644
index 000000000000..0cf16dc903cd
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (C) 2024 Ryan Walklin <[email protected]>.
+ * Copyright (C) 2024 Chris Morgan <[email protected]>.
+ */
+
+#include <dt-bindings/input/gpio-keys.h>
+#include "sun50i-h700-anbernic-rg35xx-plus.dts"
+
+/ {
+	model = "Anbernic RG35XX SP";
+	compatible = "anbernic,rg35xx-sp", "allwinner,sun50i-h700";
+
+	gpio-keys-lid {
+		compatible = "gpio-keys";
+
+		lid-switch {
+			label = "Lid Switch";
+			gpios = <&pio 4 7 GPIO_ACTIVE_LOW>; /* PE7 */
+			linux,can-disable;
+			linux,code = <SW_LID>;
+			linux,input-type = <EV_SW>;
+			wakeup-event-action = <EV_ACT_DEASSERTED>;
+			wakeup-source;
+		};
+	};
+};
+
+&r_i2c {
+	rtc_ext: rtc@51 {
+		compatible = "nxp,pcf8563";
+		reg = <0x51>;
+	};
+};
Signature · 1 line
2.34.1
#9 lore raw
In reply to Chris Morgan
Quoted 29 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG35XX-SP handheld gaming device. The Anbernic RG35XX-SP is a clamshell device, but hardware wise is very similar to the RG35XX-Plus. The RG35XX-SP has a lid-switch and an external RTC that necessitate a distinct device tree.

Changes from V1:
- Switched all RG35XX devices from the r_rsb bus to the r_i2c bus for the PMIC to keep it consistent.
- Added missing pinctrl nodes in sun50i-h616.dtsi file for the r_i2c bus.
- Modified devicetree documentation to keep definition of the RG35XX series consistent with other Allwinner devices.

Chris Morgan (4):
dt-bindings: arm: sunxi: Add Anbernic RG35XXSP
arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
arm64: dts: allwinner: h616: Change RG35XX Series from r_rsb to r_i2c
arm64: dts: allwinner: h700: Add Anbernic RG35XX-SP

 .../devicetree/bindings/arm/sunxi.yaml        |  9 +++--
 arch/arm64/boot/dts/allwinner/Makefile        |  3 +-
 .../arm64/boot/dts/allwinner/sun50i-h616.dtsi |  2 ++
 .../sun50i-h700-anbernic-rg35xx-2024.dts      |  6 ++--
 .../sun50i-h700-anbernic-rg35xx-sp.dts        | 34 +++++++++++++++++++
 5 files changed, 48 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts
Quoted 5 lines

--
2.34.1

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y allwinner/sun50i-h700-anbernic-rg35xx-2024.dtb allwinner/sun50i-h700-anbernic-rg35xx-sp.dtb' for [email protected]:

arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dtb: pmic@34: regulators: 'boost' does not match any of the regexes: '^(([a-f])?ldo[0-9]|dcdc[0-7a-e]|ldo(_|-)io(0|1)|(dc1)?sw|rtc(_|-)ldo|cpusldo|drivevbus|dc5ldo)$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/x-powers,axp152.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dtb: pmic@34: regulators: 'boost' does not match any of the regexes: '^(([a-f])?ldo[0-9]|dcdc[0-7a-e]|ldo(_|-)io(0|1)|(dc1)?sw|rtc(_|-)ldo|cpusldo|drivevbus|dc5ldo)$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/x-powers,axp152.yaml#