[openwrt/openwrt] kernel: ar8327: fix active-low LED initialization
LEDE Commits
lede-commits at lists.infradead.org
Mon Mar 17 08:42:07 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5a4f8b26f0185f392bfb0e5f31acdebcf4a10334
commit 5a4f8b26f0185f392bfb0e5f31acdebcf4a10334
Author: Lech Perczak <lech.perczak at gmail.com>
AuthorDate: Tue Feb 4 21:14:45 2025 +0100
kernel: ar8327: fix active-low LED initialization
Switch LEDs configured as active-low remain low instead of high upon
initialization, because in ar8327_leds_init, no distinction is made with
regards to LED pattern based on active_low property - only whether HW
mode is active. Select the proper initial pattern based also on
active_low to fix that.
While at that, simplify the equation ruling pattern selection for
setting brightness, avoiding unnecessary binary XOR operation, not
really valid for 'bool' type.
Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/12487
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
target/linux/generic/files/drivers/net/phy/ar8327.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c
index 3313149559..83191cd591 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.c
@@ -326,8 +326,7 @@ ar8327_led_set_brightness(struct led_classdev *led_cdev,
u8 pattern;
bool active;
- active = (brightness != LED_OFF);
- active ^= aled->active_low;
+ active = (brightness != LED_OFF) != aled->active_low;
pattern = (active) ? AR8327_LED_PATTERN_ON :
AR8327_LED_PATTERN_OFF;
@@ -501,7 +500,8 @@ ar8327_leds_init(struct ar8xxx_priv *priv)
if (aled->enable_hw_mode)
aled->pattern = AR8327_LED_PATTERN_RULE;
else
- aled->pattern = AR8327_LED_PATTERN_OFF;
+ aled->pattern = aled->active_low ?
+ AR8327_LED_PATTERN_ON : AR8327_LED_PATTERN_OFF;
ar8327_set_led_pattern(priv, aled->led_num, aled->pattern);
}
More information about the lede-commits
mailing list