devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] leds: Add a virtual LED driver for groups of
@ 2025-10-19  9:23 Jonathan Brophy
  2025-10-19  9:23 ` [PATCH v3 1/4] dt: bindings: Add virtualcolor class dt bindings documentation Jonathan Brophy
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jonathan Brophy @ 2025-10-19  9:23 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

[-- 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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-10-22 16:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-19  9:23 [PATCH v3 0/4] leds: Add a virtual LED driver for groups of Jonathan Brophy
2025-10-19  9:23 ` [PATCH v3 1/4] dt: bindings: Add virtualcolor class dt bindings documentation Jonathan Brophy
2025-10-19 10:39   ` Krzysztof Kozlowski
2025-10-19  9:23 ` [PATCH v3 2/4] dt-bindings: leds: Add virtualcolor group " Jonathan Brophy
2025-10-19 10:43   ` Krzysztof Kozlowski
2025-10-20 11:35   ` Rob Herring (Arm)
2025-10-20 18:00     ` jonathan brophy
2025-10-19  9:23 ` [PATCH v3 3/4] ABI: Add sysfs documentation for leds-group-virtualcolor Jonathan Brophy
2025-10-19  9:23 ` [PATCH v3 4/4] leds: Add virtualcolor LED group driver Jonathan Brophy
2025-10-20  3:29   ` kernel test robot
2025-10-22 16:19     ` Nathan Chancellor
2025-10-20  7:13   ` Dan Carpenter
2025-10-20 17:40     ` Jonathan Brophy
2025-10-19 14:24 ` [PATCH v3 0/4] leds: Add a virtual LED driver for groups of Jacek Anaszewski
2025-10-20  8:40   ` Alexander Dahl
2025-10-20 18:56     ` jonathan brophy
     [not found]   ` <DS0PR84MB37465DFAA8E8994B503A69829FF4A@DS0PR84MB3746.NAMPRD84.PROD.OUTLOOK.COM>
2025-10-20 18:57     ` Jacek Anaszewski
2025-10-20 21:45       ` professorjonny98

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).