From 413b62304b3a9ee83fd1e410047f43168eb7ab31 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Thu, 2 Jul 2026 23:58:41 -0300 Subject: [PATCH] RK3326: describe the R36S/R33S power LED so the ES menu can drive it The power LED menu never worked on the R36S Original and Clone because nothing consumes the old JELOS quirk vars on mainline: 002-disable-led and battery_led_status poke BSP gpio numbers (gpio77) through the legacy /sys/class/gpio interface that no longer exists, and the R36S DTB did not describe the LED at all. Describe the hardware in the DTS instead. The R36S Original has a bicolor power LED behind a single line (GPIO2_B5, BSP gpio77): high is red, low is the green side, high impedance lights both halves orange, so there is no hardware off; exposed as red:status. The R33S has a mono blue active-low LED on the same pin (the old quirk wrote 1 to disable it), exposed as blue:status with true off. The Clone already had proper LED nodes; its sysfs name is blue:power (color:function, no label). Point DEVICE_POWER_LED at the right sysfs name per device so batocera-gameforce (POWER LED COLOR and DISABLE POWER LED paths) finds the LED, and drop the dead 002-disable-led quirks. On the Original, "off" shows the stock steady green and "on" shows red; heartbeat pulses between the two colors. Co-Authored-By: Claude Fable 5 --- .../dts/rockchip/rk3326-gameconsole-r33s.dts | 22 ++++++++++++++++++ .../dts/rockchip/rk3326-gameconsole-r36s.dts | 23 +++++++++++++++++++ .../Game Console R33S/001-device_config | 3 ++- .../devices/Game Console R33S/002-disable-led | 13 ----------- .../Game Console R36S/001-device_config | 4 +++- .../devices/Game Console R36S/002-disable-led | 13 ----------- .../devices/R36S Clone/001-device_config | 2 ++ 7 files changed, 52 insertions(+), 28 deletions(-) delete mode 100755 projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/002-disable-led delete mode 100755 projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/002-disable-led diff --git a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts index 21dbab6d19..1d443b3e92 100644 --- a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts +++ b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts @@ -15,6 +15,22 @@ this = "r33s"; }; + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&power_led_pin>; + + led-0 { + /* Mono blue power LED on GPIO2_B5 (BSP gpio77), active + * low: the old JELOS quirk wrote 1 through the legacy + * gpio sysfs to turn it off. sysfs name is blue:status. */ + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + builtin_gamepad: r33s_joypad { compatible = "archr-singleadc-joypad"; pinctrl-names = "default"; @@ -107,6 +123,12 @@ }; &pinctrl { + leds { + power_led_pin: power-led-pin { + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + btns { btn_pins: btn-pins { rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, diff --git a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts index 72aff5fb19..44c6400ec0 100644 --- a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts +++ b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts @@ -15,6 +15,23 @@ this = "r36s"; }; + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&power_led_pin>; + + led-0 { + /* Bicolor power LED behind a single line (BSP gpio77 = + * GPIO2_B5): driving it high lights red, low shows the + * green side, so there is no hardware "off". Exposed as + * the red half; sysfs name is red:status. */ + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + joypad: odroidgo3-joypad { compatible = "odroidgo3-joypad"; pwms = <&pwm0 0 200000000 0>; @@ -202,6 +219,12 @@ }; &pinctrl { + leds { + power_led_pin: power-led-pin { + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + btns { btn_pins: btn-pins { rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, diff --git a/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/001-device_config b/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/001-device_config index 243906cf13..574439fc1a 100755 --- a/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/001-device_config +++ b/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/001-device_config @@ -6,6 +6,7 @@ cat </storage/.config/profile.d/001-device_config # Device Features DEVICE_PLAYBACK_PATH_SPK="HP" DEVICE_PLAYBACK_PATH_HP="SPK" -DEVICE_PWR_LED_GPIO="77" +# Mono blue power LED (GPIO2_B5, BSP gpio77, active low): sysfs blue:status. +DEVICE_POWER_LED="blue:status" DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" EOF diff --git a/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/002-disable-led b/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/002-disable-led deleted file mode 100755 index 7e5ed7a899..0000000000 --- a/projects/ArchR/packages/hardware/quirks/devices/Game Console R33S/002-disable-led +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) - -# Set export GPIO for Power LED -if [ ! -d "/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}" ]; then - echo ${DEVICE_PWR_LED_GPIO} > /sys/class/gpio/export -fi - -#Disable blue led on R33S -echo out >/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}/direction -echo 1 >/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}/value diff --git a/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/001-device_config b/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/001-device_config index 21855399ad..86b6e3bb4d 100755 --- a/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/001-device_config +++ b/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/001-device_config @@ -6,7 +6,9 @@ cat </storage/.config/profile.d/001-device_config # Device Features DEVICE_PLAYBACK_PATH_SPK="HP" DEVICE_PLAYBACK_PATH_HP="SPK" -DEVICE_PWR_LED_GPIO="77" +# Bicolor power LED on one line (GPIO2_B5, BSP gpio77): sysfs red:status; +# brightness 1 = red, 0 = the green side. There is no hardware off. +DEVICE_POWER_LED="red:status" DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" # thermal_zone1 is the gpu-thermal IP — System Information shows the # GPU temperature alongside the CPU one when this is set. diff --git a/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/002-disable-led b/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/002-disable-led deleted file mode 100755 index 7e5ed7a899..0000000000 --- a/projects/ArchR/packages/hardware/quirks/devices/Game Console R36S/002-disable-led +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) - -# Set export GPIO for Power LED -if [ ! -d "/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}" ]; then - echo ${DEVICE_PWR_LED_GPIO} > /sys/class/gpio/export -fi - -#Disable blue led on R33S -echo out >/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}/direction -echo 1 >/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}/value diff --git a/projects/ArchR/packages/hardware/quirks/devices/R36S Clone/001-device_config b/projects/ArchR/packages/hardware/quirks/devices/R36S Clone/001-device_config index ef6fbfc575..8efdb742c8 100755 --- a/projects/ArchR/packages/hardware/quirks/devices/R36S Clone/001-device_config +++ b/projects/ArchR/packages/hardware/quirks/devices/R36S Clone/001-device_config @@ -8,6 +8,8 @@ # exactly, so this folder name MUST equal the DTS `model` string. Audio # routing and LED config are intentionally left to the working defaults. cat </storage/.config/profile.d/001-device_config +# LED nodes use color+function (no label), so sysfs is blue:power. +DEVICE_POWER_LED="blue:power" DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" DEVICE_GPU_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone1/temp" CONF