mbox series

[V3,0/4] Add Anbernic RG35XX-SP

Message ID 20240710231718.106894-1-macroalpha82@gmail.com
Headers show
Series Add Anbernic RG35XX-SP | expand

Message

Chris Morgan July 10, 2024, 11:17 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

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.

Please note that this series may have a soft pre-requisite on the patch
series here [1].

[1] https://lore.kernel.org/linux-sunxi/20240418000736.24338-1-andre.przywara@arm.com/

Changes from V2:
 - Corrected commit message for device tree bindings.
 - Added a fixes tag to i2c pinmux additions in sun50i-h616.dtsi file
   based on recommendation from Andre Przywara.

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

Comments

Andre Przywara July 11, 2024, 9:52 a.m. UTC | #1
On Wed, 10 Jul 2024 18:17:17 -0500
Chris Morgan <macroalpha82@gmail.com> wrote:

Hi,

> From: Chris Morgan <macromorgan@hotmail.com>
> 
> 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 3 devices (the RG35XX-SP, RG28XX, and RG40XX-H)
> that have an external RTC on the r_i2c bus.

The change itself looks alright, but I would like to see some Tested-by:s
from people with those Allwinner Anbernic devices, since the change affects
all of them.

> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  .../boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> index ee30584b6ad7..e2bbd22bd80a 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> @@ -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>;
Andre Przywara July 11, 2024, 10:10 a.m. UTC | #2
On Wed, 10 Jul 2024 18:17:18 -0500
Chris Morgan <macroalpha82@gmail.com> wrote:

Hi,

> From: Chris Morgan <macromorgan@hotmail.com>
> 
> 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.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  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
> 
> diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
> index 0db7b60b49a1..00bed412ee31 100644
> --- a/arch/arm64/boot/dts/allwinner/Makefile
> +++ b/arch/arm64/boot/dts/allwinner/Makefile
> @@ -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
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts
> new file mode 100644
> index 000000000000..0cf16dc903cd
> --- /dev/null
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-sp.dts
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +/*
> + * Copyright (C) 2024 Ryan Walklin <ryan@testtoast.com>.
> + * Copyright (C) 2024 Chris Morgan <macroalpha82@gmail.com>.
> + */
> +
> +#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>;
> +	};
> +};
Rob Herring July 11, 2024, 2:20 p.m. UTC | #3
On Wed, 10 Jul 2024 18:17:14 -0500, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> 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.
> 
> Please note that this series may have a soft pre-requisite on the patch
> series here [1].
> 
> [1] https://lore.kernel.org/linux-sunxi/20240418000736.24338-1-andre.przywara@arm.com/
> 
> Changes from V2:
>  - Corrected commit message for device tree bindings.
>  - Added a fixes tag to i2c pinmux additions in sun50i-h616.dtsi file
>    based on recommendation from Andre Przywara.
> 
> 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
> 
> --
> 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 20240710231718.106894-1-macroalpha82@gmail.com:

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#
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#
Andre Przywara July 11, 2024, 2:44 p.m. UTC | #4
On Thu, 11 Jul 2024 08:20:24 -0600
"Rob Herring (Arm)" <robh@kernel.org> wrote:

Hi,

> On Wed, 10 Jul 2024 18:17:14 -0500, Chris Morgan wrote:
> > From: Chris Morgan <macromorgan@hotmail.com>
> > 
> > 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.
> > 
> > Please note that this series may have a soft pre-requisite on the patch
> > series here [1].
> > 
> > [1] https://lore.kernel.org/linux-sunxi/20240418000736.24338-1-andre.przywara@arm.com/
> > 
> > Changes from V2:
> >  - Corrected commit message for device tree bindings.
> >  - Added a fixes tag to i2c pinmux additions in sun50i-h616.dtsi file
> >    based on recommendation from Andre Przywara.
> > 
> > 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
> > 
> > --
> > 2.34.1
> > 
> > 
> >   
> 
> 
> My bot found new DTB warnings on the .dts files added or changed in this
> series.

That is a problem of an existing .dts files in the tree, namely
sun50i-h700-anbernic-rg35xx-2024.dts. It describes the "boost" regulator,
but the three patches adding that didn't make it in this time.
So how do we deal with that? 
This small binding patch would solve this particular problem:
https://lore.kernel.org/linux-sunxi/20240418000736.24338-4-andre.przywara@arm.com/
It has an ACK from Lee and Krzysztof, but I guess it's too late now for
6.10? Do we just ignore it for now and push it as a fix after -rc1?

Cheers,
Andre

> 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
> 20240710231718.106894-1-macroalpha82@gmail.com:
> 
> 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#
> 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#
> 
> 
> 
> 
>
Ryan Walklin July 14, 2024, 8:48 a.m. UTC | #5
On Thu, 11 Jul 2024, at 9:52 PM, Andre Przywara wrote:
> On Wed, 10 Jul 2024 18:17:17 -0500
> Chris Morgan <macroalpha82@gmail.com> wrote:
>
> Hi,
>
>> From: Chris Morgan <macromorgan@hotmail.com>
>> 
>> 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 3 devices (the RG35XX-SP, RG28XX, and RG40XX-H)
>> that have an external RTC on the r_i2c bus.
>
> The change itself looks alright, but I would like to see some Tested-by:s
> from people with those Allwinner Anbernic devices, since the change affects
> all of them.
>
>> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
>

Tested on RG35XX-H and RG35XX-Plus devices, confirmed AXP717 detected and configured using I2C bus by both kernel and u-boot. 

Also note this change corrects reboot behaviour on battery-based devices, where the AXP717 is not reset (and so remains in RSB mode) and is unable to be addressed by the u-boot SPL driver (which is I2C-only) on restart. Using I2C for all accesses prevents this behaviour.

Tested-by: Ryan Walklin <ryan@testtoast.com>

Regards,

Ryan
Chen-Yu Tsai Aug. 1, 2024, 4:25 p.m. UTC | #6
On Wed, 10 Jul 2024 18:17:14 -0500, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> 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.
> 
> [...]

Applied to sunxi/for-next in sunxi/linux.git, thanks!

[1/4] dt-bindings: arm: sunxi: Add Anbernic RG35XXSP
      https://git.kernel.org/sunxi/linux/c/dbd52a3a0669
[2/4] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
      https://git.kernel.org/sunxi/linux/c/7c9ea4ab7617
[3/4] arm64: dts: allwinner: h616: Change RG35XX Series from r_rsb to r_i2c
      https://git.kernel.org/sunxi/linux/c/c712e5d09856
[4/4] arm64: dts: allwinner: h700: Add Anbernic RG35XX-SP
      https://git.kernel.org/sunxi/linux/c/2873085a8cd5

Best regards,