realtek: rtl931x: set the LED interface mode from realtek,led-mode

The rtl931x LED setup always selects serial mode. Boards whose port LEDs
are wired for scan mode stay dark with it. The rtl930x driver already
reads the interface mode from "realtek,led-mode"; read it on rtl931x
too.

Without the property the driver selects serial mode, as before. A value
outside 1-3 is reported and also falls back to serial mode. No rtl931x
DTS sets the property yet, so other boards are unchanged.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25576
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit is contained in:
Kaloyan Naumov authored and Jonas Jelonek committed 2026-10-16 08:50:01 +02:00
1 parent 6821c4af6a
commit 89381af998
1 file changed
+8 -2
@@ -267,6 +267,7 @@ static void rtldsa_931x_led_init(struct otto_dsa_priv *priv)
struct device *dev = priv->dev;
struct device_node *node;
u8 leds_in_set[4] = {};
u32 led_mode = 1;
u32 clk_freq;
int ret;
@@ -372,8 +373,13 @@ static void rtldsa_931x_led_init(struct otto_dsa_priv *priv)
sw_w32_mask(0, set << pos, RTL931X_LED_PORT_FIB_SET_SEL_CTRL(i));
}
/* Set LED mode to serial (0x1) */
sw_w32_mask(0x3, 0x1, RTL931X_LED_GLB_CTRL);
/* LED interface: 1 = serial (default), 2 = single-colour scan, 3 = bi-colour scan */
of_property_read_u32(node, "realtek,led-mode", &led_mode);
if (led_mode < 1 || led_mode > 3) {
dev_warn(dev, "invalid realtek,led-mode %u, using serial\n", led_mode);
led_mode = 1;
}
sw_w32_mask(0x3, led_mode, RTL931X_LED_GLB_CTRL);
if (of_property_read_bool(node, "active-low"))
sw_w32_mask(RTL931X_LED_GLB_ACTIVE_LOW, 0, RTL931X_LED_GLB_CTRL);