From: Jonathan Brophy <professorjonny98@gmail.com>
To: lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
Andriy Shevencho <andriy.shevchenko@linux.intel.com>,
Jonathan Brophy <professor_jonny@hotmail.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-leds@vger.kernel.org
Subject: [PATCH v5 3/7] dt-bindings: leds: Add virtual LED group controller bindings
Date: Tue, 30 Dec 2025 21:23:16 +1300 [thread overview]
Message-ID: <20251230082336.3308403-4-professorjonny98@gmail.com> (raw)
In-Reply-To: <20251230082336.3308403-1-professorjonny98@gmail.com>
From: Jonathan Brophy <professor_jonny@hotmail.com>
Add device tree bindings for the virtual LED group controller that
provides priority-based arbitration for shared physical LEDs across
multiple virtual LED instances.
Bindings for the virtual driver are not describing hardware LEDs they
describe virtual devices made from groups of hardware LEDs created from an array
of LED phandles.
Normally the device tree is used to describe hardware not virtual hardware
but it is particularly useful in situations where you require an LED to be a
specific color by mixing primary colors, such as multi element multi color LEDs
to be operated from a device tree binding or a single trigger.
It also becomes useful with multiple LEDs operating the same indicator such as
ring of light indicators, led rope where the LEDs are driven From different GPIO
outputs unifying the control that can give basic indication during system startup,
shutdown upgrade etc...
The controller implements winner-takes-all arbitration where only the
highest-priority active virtual LED controls the hardware at any given
time. This enables multiple subsystems (boot, error, status indicators)
to request LED control without explicit coordination.
Binding supports:
- Multiple virtual LED children with independent priorities
- GPIO, PWM, I2C, and SPI physical LED devices
- Multicolor and standard (fixed-color) operating modes
- Global ownership tracking to prevent conflicts
Example configurations include:
- High-priority emergency/error RGB indicator
- Medium-priority system state RGBW indicator
- Low-priority warm white fixed-color indicator
Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
.../leds/leds-group-virtualcolor.yaml | 170 ++++++++++++++++++
1 file changed, 170 insertions(+)
create mode 100644 Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
diff --git a/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml b/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
new file mode 100644
index 000000000000..88c044f42879
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Virtual LED Group Controller with Multicolor Support
+
+maintainers:
+ - Jonathan Brophy <professor_jonny@hotmail.com>
+
+description: |
+ The virtual LED group controller provides priority-based arbitration for
+ shared physical LEDs across multiple virtual LED instances. Each virtual LED
+ combines physical monochromatic LEDs into logical units with:
+
+ - Priority-based arbitration: Higher priority virtual LEDs take precedence
+ when multiple virtual LEDs compete for the same physical LEDs
+ - Sequence-based tie-breaking: Among equal priorities, most recent update wins
+ - Winner-takes-all: Only ONE virtual LED controls ALL physical LEDs at any time
+ - Color channel grouping: Organize LEDs by color for multicolor control
+ - Full multicolor ABI support: multi_intensity, multi_index, multi_multipliers
+ - Two operating modes:
+ * Multicolor mode: Dynamic per-channel intensity control (default)
+ * Standard mode: Fixed color ratios via multipliers (brightness only)
+ - Brightness scaling: Master brightness control with per-channel intensity
+ - Global ownership: Physical LEDs claimed exclusively per controller instance
+ - Update batching: Optional coalescing of rapid brightness changes
+
+ Key features:
+ - Supports GPIO, PWM, I2C, and SPI LED devices
+ - Automatic physical LED discovery and claiming
+ - Lock-free arbitration with atomic sequence numbers
+ - Suspend/resume with state preservation
+ - Comprehensive debugfs telemetry (when CONFIG_DEBUG_FS enabled)
+
+ Typical use cases:
+ - System status indicators with boot/update/error priority levels
+ - RGB lighting with priority-based overrides
+ - Multi-element LED arrays unified into single logical controls
+ - LED rings or strips with coordinated color control
+
+properties:
+ compatible:
+ const: leds-group-virtualcolor
+
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+patternProperties:
+ "^virtual-led@[0-9a-f]+$":
+ type: object
+ $ref: leds-class-virtualcolor.yaml#
+
+required:
+ - compatible
+ - '#address-cells'
+ - '#size-cells'
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/leds/common.h>
+ #include <dt-bindings/gpio/gpio.h>
+
+ /* Physical LED definitions */
+ led-controller {
+ compatible = "gpio-leds";
+
+ led_red: led-red {
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ led_green: led-green {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ led_blue: led-blue {
+ color = <LED_COLOR_ID_BLUE>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ led_white: led-white {
+ color = <LED_COLOR_ID_WHITE>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+ };
+
+ pwm-led-controller {
+ compatible = "pwm-leds";
+
+ pwm_red: led-1 {
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_STATUS;
+ pwms = <&pwm 0 7812500>;
+ max-brightness = <255>;
+ };
+
+ pwm_green: led-2 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ pwms = <&pwm 1 7812500>;
+ max-brightness = <255>;
+ };
+
+ pwm_blue: led-3 {
+ color = <LED_COLOR_ID_BLUE>;
+ function = LED_FUNCTION_STATUS;
+ pwms = <&pwm 2 7812500>;
+ max-brightness = <255>;
+ };
+ };
+
+ /* virtual LED definitions */
+ virtual-led-controller {
+ compatible = "leds-group-virtualcolor";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* High-priority RGB virtual LED (emergency/error indicator) */
+ virtual-led@0 {
+ reg = <0>;
+ color = <LED_COLOR_ID_MULTI>;
+ function = LED_FUNCTION_STATUS;
+ priority = <1000>;
+ led-mode = "multicolor";
+ leds = <&led_red>, <&led_green>, <&led_blue>;
+ /* Channels ordered by color ID: [0]=red, [1]=green, [2]=blue */
+ };
+
+ /* Medium-priority RGBW indicator (system state) */
+ virtual-led@1 {
+ reg = <1>;
+ color = <LED_COLOR_ID_MULTI>;
+ function = LED_FUNCTION_STATUS;
+ priority = <500>;
+ led-mode = "multicolor";
+ leds = <&pwm_red>, <&pwm_green>, <&pwm_blue>, <&led_white>;
+ /* Channels: [0]=white (ID=0), [1]=red, [2]=green, [3]=blue */
+ };
+
+ /* Low-priority warm white (fixed color ratios, standard mode) */
+ virtual-led@2 {
+ reg = <2>;
+ color = <LED_COLOR_ID_MULTI>;
+ function = LED_FUNCTION_STATUS;
+ priority = <10>;
+ led-mode = "standard";
+ leds = <&led_red>, <&led_green>, <&led_blue>;
+ /* Channels: [0]=red, [1]=green, [2]=blue */
+ mc-channel-multipliers = <255 180 100>;
+ /* Creates warm white: full red, 70% green, 40% blue */
+ };
+ };
+
+...
--
2.43.0
next prev parent reply other threads:[~2025-12-30 8:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 8:23 [PATCH v5 0/7] leds: Add virtual LED group driver with priority arbitration Jonathan Brophy
2025-12-30 8:23 ` [PATCH v5 1/7] dt-bindings: leds: add function virtual_status to led common properties Jonathan Brophy
2025-12-30 8:23 ` [PATCH v5 2/7] dt-bindings: leds: Add virtual LED class bindings Jonathan Brophy
2025-12-30 8:23 ` Jonathan Brophy [this message]
2025-12-30 8:23 ` [PATCH v5 4/7] ABI: Add sysfs documentation for leds-group-virtualcolor Jonathan Brophy
2025-12-30 11:52 ` Andriy Shevencho
2025-12-30 8:23 ` [PATCH v5 5/7] leds: Add driver " Jonathan Brophy
2025-12-30 8:23 ` [PATCH v5 6/7] leds: Add fwnode_led_get() for firmware-agnostic LED resolution Jonathan Brophy
2025-12-30 12:00 ` Andriy Shevencho
2025-12-31 2:30 ` kernel test robot
2025-12-31 23:37 ` kernel test robot
2025-12-31 23:45 ` kernel test robot
2026-01-02 12:20 ` kernel test robot
2026-01-02 15:07 ` kernel test robot
2026-01-02 16:29 ` kernel test robot
2025-12-30 8:23 ` [PATCH v5 7/7] leds: Add virtual LED group driver with priority arbitration Jonathan Brophy
2025-12-30 12:19 ` Andriy Shevencho
2026-01-03 8:22 ` [PATCH v5 7/7] leds: Add virtual LED group driver Jonathan Brophy
2026-01-03 12:56 ` Andriy Shevencho
2026-01-06 16:59 ` [PATCH v5 0/7] leds: Add virtual LED group driver with priority arbitration Rob Herring
2026-01-13 11:52 ` Lee Jones
2026-01-13 11:57 ` Lee Jones
2026-01-13 20:35 ` Jonathan Brophy
2026-01-15 15:07 ` Lee Jones
2026-01-15 16:58 ` Andriy Shevencho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251230082336.3308403-4-professorjonny98@gmail.com \
--to=professorjonny98@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=professor_jonny@hotmail.com \
--cc=robh@kernel.org \
--cc=rtsvetkov@gradotech.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®