RK3326: add the Gusgu H7 subdevice - #3253
Conversation
The Gusgu H7 is an unbranded Rockchip RK3326 handheld shipping a vendor
EmuELEC 4.7 build. Verified on hardware: display, audio, all 17 buttons, volume
keys, the analog stick and the RGB ring.
rk3326-gusgu-h7.dts includes the eeclone base and overrides it. eeclone is the
only RK3326 tree here defining every node the H7 needs (internal_display,
joypad, adc_keys, btn_pins), and its serial2 = &uart5 alias puts the H7's UART5
debug port on ttyS2, so the stock console= works unchanged. Everything else was
taken from the device's own stock vendor DTB, with the GPIO assignments
verified against physical button presses.
Three device-specific findings are encoded in the DTS:
- adc_keys is disabled. eeclone samples SARADC ch2 for volume; on the H7 that
line is the stick's Y axis, so a centred stick reads as KEY_VOLUMEDOWN held
and ROCKNIX init drops into USB-MSC recovery on every boot. The H7's real
volume buttons are GPIOs, moved to a gpio-keys node.
- joypad switches to rocknix-joypad with abs-left-first. The H7 has one stick
wired direct to SARADC ch1/ch2 with no analog mux, which
rocknix-singleadc-joypad cannot read. rocknix-joypad maps channels
positionally and defaults to right-stick-first, so abs-left-first is needed
for the stick to report as ABS_X/ABS_Y.
- btn_pins gains pull-ups for the five H7 button lines eeclone does not
configure.
The H7's vendor U-Boot is a 2017.09 fork that predates FDTOVERLAYS and never
reaches boot.scr (it scans extlinux before scripts), so it needs an explicit FDT
and literal LABEL= values rather than ${partition_boot} placeholders. Rather
than change the shared extlinux.conf, mkimage_extlinux() now prefers
extlinux/extlinux.conf.sub-<subdevice> when one is present. No existing
subdevice ships such a file, so the -a and -b images are byte-identical.
h7-rgb-leds drives the three WS2812s in the ring around the stick, which hang
off spi1 MOSI with no kernel driver in 7.1. The wire format was recovered from
the stock firmware's own SPI traffic and is documented at the top of the script.
The service is gated on /dev/spidev1.0, which only the H7 DTS enables, so it
does not start on any other RK3326 device.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01985tp15STZZvPFMfnVBGnm
|
Nice to see Claude being used to add new devices. It’s fairly decent for this. A few questions, which other reviewers will probably also raise:
These are just my suggestions, but you will get your PR merged more easily if everything is clear, concise, and organized. I did use Claude for the Pixel 2, but I was in touch with two ROCKNIX devs throughout the process. |
| <!-- Gusgu H7: unbranded RK3326 clone, 1024x768 ST7703 DSI panel. | ||
| No ADC autodetect (see h7_boot.ini); DTB is pinned to the eeclone | ||
| base and the H7 panel comes from /overlays/mipi-panel.dtbo. --> | ||
| <h7 mkimage_options="dtb,bootscr,extlinux,uboot" fdt_type="fdtdir" fdt="/"> |
There was a problem hiding this comment.
Don't do this.
An image needs over 1 GB of artifacts and some compute power to compress.
We definitely don't want any bloat for such a dead platform as RK3326.
Also I added a note about this recently
| @@ -0,0 +1,25 @@ | |||
| # SPDX-License-Identifier: GPL-2.0-or-later | |||
There was a problem hiding this comment.
This ad-hoc script+package is useless for other devices.
Integration with existing infrastructure would be much better.
Maybe this driver will work (or something similar) to expose leds as leds https://github.com/Sakura-Pi/ws2812-vleds
Emulationstation has menu items to configure led color and has an option to display battery level.
Summary
rk3326-gusgu-h7.dtsincludes the eeclone base and overrides it. eeclone is the only RK3326 tree here that defines every node the H7 needs (internal_display,joypad,adc_keys,btn_pins), and itsserial2 = &uart5alias puts the H7's UART5 debug port onttyS2, so the stockconsole=works unchanged. Everything else came from the device's own stock vendor DTB, with the GPIO assignments verified one at a time against physical button presses.Three device-specific findings are encoded in the DTS:
adc_keysis disabled. eeclone samples SARADC ch2 for volume; on the H7 that line is the analog stick's Y axis. A centred stick therefore reads asKEY_VOLUMEDOWNheld, and ROCKNIX init drops into USB-MSC recovery on every boot. The H7's real volume buttons are GPIOs, moved to agpio-keysnode.joypadswitches torocknix-joypadwithabs-left-first. The H7 has one stick wired direct to SARADC ch1/ch2 with no analog mux, whichrocknix-singleadc-joypadcannot read.rocknix-joypadmaps channels positionally and defaults to right-stick-first, soabs-left-firstis what makes the stick report asABS_X/ABS_Y.btn_pinsgains pull-ups for the five H7 button lines eeclone does not configure.The one shared-code change is in
mkimage. The H7's vendor U-Boot is a 2017.09 fork that predatesFDTOVERLAYSand never reachesboot.scr(it scans extlinux before scripts), so it needs an explicitFDTand literalLABEL=values rather than${partition_boot}placeholders. Rather than change the sharedextlinux.conf,mkimage_extlinux()now prefersextlinux/extlinux.conf.sub-<subdevice>when one is present. No existing subdevice ships such a file, so the-aand-bimages are byte-identical.h7-rgb-ledsdrives the three WS2812s in the ring around the stick, which hang off spi1 MOSI with no kernel driver in 7.1 (the stock firmware drives them from userspace too). The wire format was recovered by capturing the stock firmware's ownioctl(SPI_IOC_MESSAGE)buffers and is documented at the top of the script. The service is gated onConditionPathExists=/dev/spidev1.0, which only the H7 DTS enables, so it does not start on any other RK3326 device.Testing
console=ttyS2,1500000and no cmdline change. The-aand-bimages were rebuilt to confirm themkimagechange leaves them unaffected.Additional Context
rockchip,rk915SDIO card node, but it simply binds nothing without that driver — the device boots and works fine on this PR alone, just without wireless.config/stock/is copied wholesale into/usr/share/bootloader/in every RK3326 image, and its README says users drop their own stock DTB there — shipping one device's 108KB vendor blob to the whole family seemed wrong on both size and licensing grounds. Everything needed was already extracted into the DTS.panel_descriptionread out of the stock DTB, not supplied as an overlay, because this device's u-boot cannot apply overlays.AI Usage
Did you use AI tools to help write this code? YES — Claude Code was used extensively: reverse-engineering the stock DTB and the RGB LED SPI protocol, working out the
adc_keys/stick channel collision from the boot-into-recovery symptom, writing the DTS and the LED tool, and drafting this description. Every claim in the Testing section was checked on the physical device.