mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 = <LED_COLOR_ID_BLUE>;
|
||||
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>,
|
||||
|
||||
@@ -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 = <LED_COLOR_ID_RED>;
|
||||
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>,
|
||||
|
||||
@@ -6,6 +6,7 @@ cat <<EOF >/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
|
||||
|
||||
@@ -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
|
||||
@@ -6,7 +6,9 @@ cat <<EOF >/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.
|
||||
|
||||
@@ -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
|
||||
@@ -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 <<CONF >/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
|
||||
|
||||
Reference in New Issue
Block a user