On Sat, 20 Apr 2024 22:43:58 +1200 Ryan Walklin <ryan@xxxxxxxxxxxxx> wrote: Hi, > The RG35XX-H adds thumbsticks, a stereo speaker, and a second USB port to the RG35XX-Plus, and has a horizontal form factor. > > Enabled in this DTS: > - Thumbsticks > - Second USB port > > Changelog v1..v2: > - Update copyright > - Spaces -> Tabs > - Add GP ADC joystick axes and mux [1] > - Add EHCI/OHCI1 for second USB port and add vbus supply > > Signed-off-by: Ryan Walklin <ryan@xxxxxxxxxxxxx> > > [1]: https://lore.kernel.org/linux-sunxi/20240417170423.20640-1-macroalpha82@xxxxxxxxx/T/#t As mention on patch 2/5, this might be better an optional dependency, so the GPADC part might be a separate patch. > > Signed-off-by: Ryan Walklin <ryan@xxxxxxxxxxxxx> > --- > .../sun50i-h700-anbernic-rg35xx-h.dts | 126 ++++++++++++++++++ > 1 file changed, 126 insertions(+) > create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts > new file mode 100644 > index 000000000000..d62cf5cd9d9b > --- /dev/null > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts > @@ -0,0 +1,126 @@ > +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +/* > + * Copyright (C) 2024 Ryan Walklin <ryan@xxxxxxxxxxxxx>. > + * Copyright (C) 2024 Chris Morgan <macroalpha82@xxxxxxxxx>. > + */ > + > +#include "sun50i-h700-anbernic-rg35xx-plus.dts" > + > +/ { > + model = "Anbernic RG35XX H"; > + compatible = "anbernic,rg35xx-h", "allwinner,sun50i-h700"; > + > + adc-joystick { > + compatible = "adc-joystick"; > + io-channels = <&adc_mux 0>, > + <&adc_mux 1>, > + <&adc_mux 2>, > + <&adc_mux 3>; > + pinctrl-0 = <&joy_mux_pin>; > + pinctrl-names = "default"; > + poll-interval = <60>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + axis@0 { > + reg = <0>; > + abs-flat = <32>; > + abs-fuzz = <32>; > + abs-range = <4096 0>; > + linux,code = <ABS_X>; > + }; > + > + axis@1 { > + reg = <1>; > + abs-flat = <32>; > + abs-fuzz = <32>; > + abs-range = <0 4096>; > + linux,code = <ABS_Y>; > + }; > + > + axis@2 { > + reg = <2>; > + abs-flat = <32>; > + abs-fuzz = <32>; > + abs-range = <0 4096>; > + linux,code = <ABS_RX>; > + }; > + > + axis@3 { > + reg = <3>; > + abs-flat = <32>; > + abs-fuzz = <32>; > + abs-range = <4096 0>; > + linux,code = <ABS_RY>; > + }; > + }; > + > + adc_mux: adc-mux { > + compatible = "io-channel-mux"; > + channels = "left_x", "left_y", "right_x", "right_y"; > + #io-channel-cells = <1>; > + io-channels = <&gpadc 0>; > + io-channel-names = "parent"; > + mux-controls = <&gpio_mux>; > + settle-time-us = <100>; > + }; > + > + gpio_keys: gpio-keys-thumb { Is there any reason to not just use the existing gpio-keys node? Either put a label on it in patch 2/5, and reference that below, outside of the root node, or use an absolute path reference. > + compatible = "gpio-keys"; > + > + button-thumbl { > + label = "GPIO Thumb Left"; > + gpios = <&pio 4 8 GPIO_ACTIVE_LOW>; /* PE8 */ > + linux,input-type = <EV_KEY>; > + linux,code = <BTN_THUMBL>; > + }; > + > + button-thumbr { > + label = "GPIO Thumb Right"; > + gpios = <&pio 4 9 GPIO_ACTIVE_LOW>; /* PE9 */ > + linux,input-type = <EV_KEY>; > + linux,code = <BTN_THUMBR>; > + }; > + }; > + > + gpio_mux: mux-controller { > + compatible = "gpio-mux"; > + mux-gpios = <&pio 8 1 GPIO_ACTIVE_LOW>, > + <&pio 8 2 GPIO_ACTIVE_LOW>; /* PI1, PI2 */ > + #mux-control-cells = <0>; > + }; > +}; > + > +&gpadc { > + #address-cells = <1>; > + #size-cells = <0>; > + status = "okay"; > + > + channel@0 { > + reg = <0>; > + }; > +}; > + > +&pio { > + joy_mux_pin: joy-mux-pin { > + pins = "PI0"; > + function = "gpio_out"; > + }; > +}; > + > +&ehci1 { > + status = "okay"; > +}; > + > +&ohci1 { > + status = "okay"; > +}; > + > +&usbotg { > + dr_mode = "peripheral"; > + status = "okay"; > +}; > + > +&usbphy { > + usb1_vbus-supply = <®_vcc_usb>; This is the dodgy USB supply chain. Any chance we can narrow this down, to maybe one GPIO controlled regulator? Also, where does the boost controller come into play here? Cheers, Andre > +};