Re: [PATCH v3 2/2] leds: Add support for Turris 1.x LEDs

From: Marek Behún

Date: Tue Sep 29 2026 - 10:46:06 EST


On Mon, Sep 28, 2026 at 01:19:07PM +0200, Josef Schlehofer wrote:

> The five LAN LEDs share one set of colour
> registers, so the colour and brightness set last on any of them apply
> to all five.

...

> +static int turris1x_led_register(struct device *dev, struct turris1x_leds *ddata,
> + struct fwnode_handle *fwnode, u8 val_sw_override,

...

> + cdev->max_brightness = 255;
> + cdev->brightness_set = turris1x_led_brightness_set;

As described in the commit message, LAN LEDs form a group for which
the colors of individual LEDs cannot be changed.

Setting color for LAN3 LED to green will change colors for all
LAN1..5 LEDs to green.

This proposal does not reflect that in sysfs in any way.

My proposal is to register the first LAN LED as a true multicolor LED,
and the rest of LAN LEDs as simple LEDs, and then create sysfs
symlinks for the multi_intensity and multi_index attribute files:

rgb:lan-1
multi_intensity (true attribute file)
multi_index (true attribute file)
rgb:lan-2
multi_intensity (symlink to ../rgb:lan-1/multi_intensity)
multi_index (symlink to ../rgb:lan-1/multi_index)
...

This way the sysfs will somehow reflect this topology.

Also, the max_brigthness will need to be set to 1 instead of 255,
since we can set each LAN LED on/off state individually, but color
globally.

Marek