[PATCH v3 1/4] dt: bindings: Add virtualcolor class dt bindings documentation.

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

From: Jonathan Brophy <professor_jonny@hotmail.com>

Add DT bindings for the LEDs virtualcolor class framework. Add
LED-FUNCTION-VIRTUAL-STATUS ID to the FUNCTION ID list for device tree
bindings.

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-class-virtualcolor.yaml | 90 +++++++++++++++++++
include/dt-bindings/leds/common.h | 4 +
2 files changed, 94 insertions(+)
create mode 100644 Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml
new file mode 100644
index 000000000000..8cbbbf0d746c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-class-virtualcolor.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: virtualcolor LED class
+
+maintainers:
+ - Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+
+description: |
+ Validates individual virtual LED nodes that aggregate multiple monochromatic
+ or PWM LEDs.
+
+properties:
+ $nodename:
+ pattern: "^virtual-led(@[0-9a-f])?$"
+
+ reg:
+ maxItems: 1
+ description: Virtual LED index/number
+
+ function:
+ description: |
+ LED function. It is recommended to use LED_FUNCTION_VIRTUAL_STATUS
+ for virtual LEDs to distinguish them from physical LEDs.
+ See: include/dt-bindings/leds/common.h
+
+ color:
+ description: |
+ LED color identifier from the LED_COLOR_ID_* namespace.
+ See: include/dt-bindings/leds/common.h
+
+ leds:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ minItems: 1
+ maxItems: 15
+ description: |
+ Array of phandles to monochromatic LEDs that compose this virtual LED.
+
+ pwm-leds-red:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ minItems: 1
+ maxItems: 15
+ description: |
+ Array of phandles to PWM-controlled red LEDs that compose this virtual
+ LED.
+
+ pwm-leds-green:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ minItems: 1
+ maxItems: 15
+ description: |
+ Array of phandles to PWM-controlled green LEDs that compose this virtual
+ LED.
+
+ pwm-leds-blue:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ minItems: 1
+ maxItems: 15
+ description: |
+ Array of phandles to PWM-controlled blue LEDs that compose this virtual
+ LED.
+
+ priority:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 0
+ description: |
+ Priority level for this virtual LED. Higher values take precedence
+ when multiple virtual LEDs are active simultaneously.
+
+required:
+ - reg
+
+anyOf:
+ - required:
+ - leds
+ - required:
+ - pwm-leds-red
+ - required:
+ - pwm-leds-green
+ - required:
+ - pwm-leds-blue
+
+allOf:
+ - $ref: common.yaml#
+
+additionalProperties: true
+...
diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h
index 4f017bea0123..39c34d585a47 100644
--- a/include/dt-bindings/leds/common.h
+++ b/include/dt-bindings/leds/common.h
@@ -63,6 +63,10 @@
"lp5523:{r,g,b}" (Nokia N900) */
#define LED_FUNCTION_STATUS "status"

+/* Virtual system LEDs Used for virtual LED groups, multifunction RGB
+ indicators or status LEDs that reflect complex system states */
+#define LED_FUNCTION_VIRTUAL_STATUS "virtual-status"
+
#define LED_FUNCTION_MICMUTE "micmute"
#define LED_FUNCTION_MUTE "mute"

--
2.43.0