[PATCH v3 0/4] leds: Add a virtual LED driver for groups of

Jonathan Brophy
2025-10-19T09:24:05Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4262 bytes --]

From: Jonathan Brophy <professor_jonny@hotmail.com>

Introduce a new driver that implements virtual LED groups,
aggregating multiple monochromatic LEDs into virtual groups and providing
priority-based control for concurrent state management.

Existing multi-LED drivers are primarily intended to group monochrome LEDs
into multicolor LEDs, allowing per-channel intensity control of hue and
brightness. However, they are not designed to manage grouped LEDs with
independent functional roles or shared behavior.

The leds-group-virtualcolor driver allows arbitrary LEDs to be grouped
and exposed as a single logical LED representing a fixed color, status, or
function. Properties such as triggers and brightness are applied to the group
as a whole, rather than to individual LED elements.

This is particularly useful in consumer devices (e.g., routers), where a
single status LED must reflect multiple device states via color or blink
patterns. In such cases, simple device tree bindings are insufficient,
as multiple triggers may activate simultaneously, resulting in color mixing
and ambiguous status indication.

To avoid this problem, the driver implements a priority mechanism that allows
higher-priority LEDs to assume control of the group. When multiple LEDs of the
same priority are active concurrently, the most recently activated LED takes
precedence over earlier ones. If a higher-priority LED is extinguished, a lower-
priority LED will become active.
If an LED is set to blink, or is controlled with an on or off delay, any time
the LED is inactive but still triggered, it will be the only LED in control and
will be extinguished during this time for best contrast.

leds-group-virtualcolor can also enable decomposition of multi-element multicolor
LEDs into individual virtual groups that can provide individual virtual color
LEDs, supporting flexible trigger assignments and precise status representation.

leds-group-virtualcolor can join PWM LEDs into the group with their own bindings
for each primary color this enables per channel dimming and fine tuning of color
of the grouped PWM LEDs.

PWM and monochromatic LEDs can be joined into the same groups sharing the same
grouped global brightness controls.

leds-group-virtualcolor can also expose a singular LED as multiple virtual LEDs,
each having individual triggers, timings, or other properties.

Additionally, traditional bindings can only control individual LED elements,
making it impossible to represent composite colors formed by combinations
of primary RGB components but this is also made possible.

Originally intended to be used with OpenWrt for controlling RGB status LEDs
so control of power, reboot and system upgrade cam mimic the manufactures status
LED mixed colors.
Often when a device ported to OpenWrt RGB status LEDs usually became a glorified
power-led instead of a status led because user scripts or binaries would have to
be implemented as additional packages to control logic.

leds-group-virtualcolor is designed to allow LED behavior to be
fully described and logically controlled in the device tree, enabling early
status indication during system initialization—without relying on user-space
scripts or custom binaries.

Jonathan Brophy (4):
dt: bindings: Add virtualcolor class dt bindings
dt-bindings: leds: Add virtualcolor group dt bindings documentation.
ABI: Add sysfs documentation for leds-group-virtualcolor
Subject: [PATCH v3 4/4] leds: Add virtualcolor LED group driver

.../ABI/testing/sysfs-class-leds-virtualcolor | 89 +++
.../leds/leds-class-virtualcolor.yaml | 90 +++
.../leds/leds-group-virtualcolor.yaml | 110 ++++
drivers/leds/rgb/Kconfig | 17 +
drivers/leds/rgb/Makefile | 1 +
drivers/leds/rgb/leds-group-virtualcolor.c | 513 ++++++++++++++++++
include/dt-bindings/leds/common.h | 4 +
7 files changed, 824 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-class-leds-virtualcolor
create mode 100644 Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml
create mode 100644 Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
create mode 100644 drivers/leds/rgb/leds-group-virtualcolor.c

--
2.43.0