linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] leds: Add Virtual Color LED Group driver
@ 2025-09-16 11:02 Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-16 11:02 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

From: Jonathan Brophy <professor_jonny@hotmail.com>

This commit introduces a new driver that implements virtual LED groups
by aggregating multiple monochromatic LEDs. The driver provides
priority-based control to manage concurrent LED activation requests,
ensuring that only the highest-priority LED group's state is active at
any given time.

This driver is useful for systems that require coordinated control over
multiple LEDs, such as RGB indicators or status LEDs that reflect
complex system states.

Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
 drivers/leds/rgb/leds-group-virtualcolor.c | 441 +++++++++++++++++++++
 1 file changed, 441 insertions(+)
 create mode 100644 drivers/leds/rgb/leds-group-virtualcolor.c

diff --git a/drivers/leds/rgb/leds-group-virtualcolor.c b/drivers/leds/rgb/leds-group-virtualcolor.c
new file mode 100644
index 000000000000..248ac69d6515
--- /dev/null
+++ b/drivers/leds/rgb/leds-group-virtualcolor.c
@@ -0,0 +1,441 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Virtual LED Group Driver with Priority Control
+ *
+ * This driver implements virtual LED groups by aggregating multiple
+ * monochromatic LEDs. It provides priority-based control for managing
+ * concurrent LED activation requests, ensuring only the highest-priority
+ * LED state is active at any given time.
+ *
+ * Code create by Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+ * Copyright (C) 2024 Jonathan Brophy <professor_jonny@hotmail.com>
+ *
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+struct virtual_led {
+	struct led_classdev cdev;
+	struct led_classdev **monochromatics;
+	struct leds_virtualcolor *vc_data;
+	int num_monochromatics;
+	int priority;
+	unsigned long blink_delay_on;
+	unsigned long blink_delay_off;
+	struct list_head list;
+};
+
+struct leds_virtualcolor {
+	struct virtual_led *vleds;
+	int num_vleds;
+	struct list_head active_leds;
+	struct mutex lock; // Protects access to active LEDs
+};
+
+static void virtual_set_monochromatic_brightness(struct virtual_led *vled,
+						 enum led_brightness brightness)
+{
+	int i;
+
+	if (vled->blink_delay_on || vled->blink_delay_off) {
+		unsigned long blink_mask = (BIT(LED_BLINK_SW) | BIT(LED_BLINK_ONESHOT) |
+					    BIT(LED_SET_BLINK));
+
+		/*
+		 * Make sure the LED is not already blinking.
+		 * We don't want to call led_blink_set multiple times.
+		 */
+		if (!(vled->cdev.work_flags & blink_mask))
+			led_blink_set(&vled->cdev, &vled->blink_delay_on, &vled->blink_delay_off);
+
+		/* Update the blink delays if they have changed */
+		if (vled->blink_delay_on != vled->cdev.blink_delay_on ||
+		    vled->blink_delay_off != vled->cdev.blink_delay_off) {
+			vled->cdev.blink_delay_on = vled->blink_delay_on;
+			vled->cdev.blink_delay_off = vled->blink_delay_off;
+		}
+	}
+
+	for (i = 0; i < vled->num_monochromatics; i++)
+		led_set_brightness(vled->monochromatics[i], brightness);
+}
+
+static ssize_t priority_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%d\n", vled->priority);
+}
+
+static ssize_t priority_store(struct device *dev, struct device_attribute *attr, const char *buf,
+			      size_t count)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+	int new_priority;
+	int ret;
+
+	ret = kstrtoint(buf, 10, &new_priority);
+	if (ret < 0)
+		return ret;
+
+	vled->priority = new_priority;
+	return count;
+}
+
+static DEVICE_ATTR_RW(priority);
+
+static ssize_t blink_delay_on_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%lu\n", vled->blink_delay_on);
+}
+
+static ssize_t blink_delay_on_store(struct device *dev, struct device_attribute *attr,
+				    const char *buf, size_t count)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+	unsigned long new_delay;
+	int ret;
+
+	ret = kstrtoul(buf, 10, &new_delay);
+	if (ret < 0)
+		return ret;
+
+	/* Apply new delay immediately */
+	vled->blink_delay_on = new_delay;
+	virtual_set_monochromatic_brightness(vled, vled->cdev.brightness);
+
+	return count;
+}
+
+static ssize_t blink_delay_off_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%lu\n", vled->blink_delay_off);
+}
+
+static ssize_t blink_delay_off_store(struct device *dev, struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct virtual_led *vled = dev_get_drvdata(dev);
+	unsigned long new_delay;
+	int ret;
+
+	ret = kstrtoul(buf, 10, &new_delay);
+	if (ret < 0)
+		return ret;
+
+	/* Apply new delay immediately */
+	vled->blink_delay_off = new_delay;
+	virtual_set_monochromatic_brightness(vled, vled->cdev.brightness);
+
+	return count;
+}
+
+static DEVICE_ATTR_RW(blink_delay_on);
+static DEVICE_ATTR_RW(blink_delay_off);
+
+static void restore_sysfs_write_access(void *data)
+{
+	struct led_classdev *led_cdev = data;
+
+	mutex_lock(&led_cdev->led_access);
+	led_sysfs_enable(led_cdev);
+	mutex_unlock(&led_cdev->led_access);
+}
+
+static bool virtual_led_is_active(struct list_head *head, struct virtual_led *vled)
+{
+	struct virtual_led *entry;
+
+	list_for_each_entry(entry, head, list) {
+		if (entry == vled)
+			return true;
+	}
+
+	return false;
+}
+
+static int virtual_led_brightness_set(struct led_classdev *cdev, enum led_brightness brightness)
+{
+	struct virtual_led *vled = container_of(cdev, struct virtual_led, cdev);
+	struct leds_virtualcolor *vc_data = vled->vc_data;
+	struct virtual_led *active;
+
+	mutex_lock(&vc_data->lock);
+
+	active = list_first_entry_or_null(&vc_data->active_leds, struct virtual_led, list);
+	if (active) {
+		/*
+		 * If the currently active LED has a higher priority,
+		 * ignore the new request.
+		 */
+		if (active->priority > vled->priority)
+			goto out_unlock;
+
+		/*
+		 * The currently active LED is going to be replaced,
+		 * turn off it's monochromatic LEDs.
+		 */
+		virtual_set_monochromatic_brightness(active, LED_OFF);
+	}
+
+	if (brightness == LED_OFF) {
+		/*
+		 * If the LED is already active, remove it from the active list
+		 * and update the brightness of the next highest priority LED.
+		 */
+		if (virtual_led_is_active(&vc_data->active_leds, vled))
+			list_del(&vled->list);
+
+		active = list_first_entry_or_null(&vc_data->active_leds, struct virtual_led, list);
+		if (active)
+			virtual_set_monochromatic_brightness(active, active->cdev.brightness);
+	} else {
+		/* Add the LED to the active list and update the brightness */
+		if (!virtual_led_is_active(&vc_data->active_leds, vled))
+			list_add(&vled->list, &vc_data->active_leds);
+
+		active = list_first_entry_or_null(&vc_data->active_leds, struct virtual_led, list);
+		if (active)
+			virtual_set_monochromatic_brightness(active, brightness);
+	}
+
+out_unlock:
+	mutex_unlock(&vc_data->lock);
+
+	return 0;
+}
+
+static int leds_virtualcolor_init_vled(struct device *dev, struct device_node *child,
+				       struct virtual_led *vled, struct leds_virtualcolor *vc_data)
+{
+	struct fwnode_handle *child_fwnode = of_fwnode_handle(child);
+	struct led_init_data init_data = {};
+	u32 blink_interval;
+	u32 phandle_count;
+	u32 max_brightness;
+	int ret, i;
+
+	ret = of_property_read_u32(child, "priority", &vled->priority);
+	if (ret)
+		vled->priority = 0;
+
+	ret = of_property_read_u32(child, "blink", &blink_interval);
+	if (!ret) {
+		vled->blink_delay_on = blink_interval;
+		vled->blink_delay_off = blink_interval;
+	}
+
+	phandle_count = fwnode_property_count_u32(child_fwnode, "leds");
+	if (phandle_count <= 0) {
+		dev_err(dev, "No monochromatic LEDs specified for virtual LED %s\n",
+			vled->cdev.name);
+		return -EINVAL;
+	}
+
+	vled->num_monochromatics = phandle_count;
+	vled->monochromatics = devm_kcalloc(dev, vled->num_monochromatics,
+					    sizeof(*vled->monochromatics), GFP_KERNEL);
+	if (!vled->monochromatics)
+		return -ENOMEM;
+
+	for (i = 0; i < vled->num_monochromatics; i++) {
+		struct led_classdev *led_cdev;
+
+		led_cdev = of_led_get(child, i);
+		if (IS_ERR_OR_NULL(led_cdev)) {
+			/*
+			 * If the LED is not available yet, defer the probe.
+			 * The probe will be retried when the it becomes available.
+			 */
+			if (PTR_ERR(led_cdev) == -EPROBE_DEFER || !led_cdev) {
+				return -EPROBE_DEFER;
+			} else {
+				ret = PTR_ERR(led_cdev);
+				dev_err(dev, "Failed to get monochromatic LED for %s, error %d\n",
+					vled->cdev.name, ret);
+				return ret;
+			}
+		}
+
+		vled->monochromatics[i] = led_cdev;
+	}
+
+	ret = of_property_read_u32(child, "max-brightness", &max_brightness);
+	if (ret)
+		vled->cdev.max_brightness = LED_FULL;
+	else
+		vled->cdev.max_brightness = max_brightness;
+
+	vled->cdev.brightness_set_blocking = virtual_led_brightness_set;
+	vled->cdev.max_brightness = LED_FULL;
+	vled->cdev.flags = LED_CORE_SUSPENDRESUME;
+
+	init_data.fwnode = child_fwnode;
+	ret = devm_led_classdev_register_ext(dev, &vled->cdev, &init_data);
+	if (ret) {
+		dev_err(dev, "Failed to register virtual LED %s\n", vled->cdev.name);
+		return ret;
+	}
+
+	ret = device_create_file(vled->cdev.dev, &dev_attr_priority);
+	if (ret) {
+		dev_err(dev, "Failed to create sysfs attribute for priority\n");
+		return ret;
+	}
+
+	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_on);
+	if (ret) {
+		dev_err(dev, "Failed to create sysfs attribute for blink_delay_on\n");
+		return ret;
+	}
+
+	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_off);
+	if (ret) {
+		dev_err(dev, "Failed to create sysfs attribute for blink_delay_off\n");
+		return ret;
+	}
+
+	vled->vc_data = vc_data;
+
+	return 0;
+}
+
+static int leds_virtualcolor_disable_sysfs_access(struct device *dev, struct virtual_led *vled)
+{
+	int i;
+
+	for (i = 0; i < vled->num_monochromatics; i++) {
+		struct led_classdev *led_cdev = vled->monochromatics[i];
+
+		mutex_lock(&led_cdev->led_access);
+		led_sysfs_disable(led_cdev);
+		mutex_unlock(&led_cdev->led_access);
+
+		devm_add_action_or_reset(dev, restore_sysfs_write_access, led_cdev);
+	}
+
+	return 0;
+}
+
+static int leds_virtualcolor_probe(struct platform_device *pdev)
+{
+	struct leds_virtualcolor *vc_data;
+	struct device *dev = &pdev->dev;
+	struct device_node *child;
+	int count = 0;
+	int ret;
+
+	vc_data = devm_kzalloc(dev, sizeof(*vc_data), GFP_KERNEL);
+	if (!vc_data)
+		return -ENOMEM;
+
+	mutex_init(&vc_data->lock);
+	INIT_LIST_HEAD(&vc_data->active_leds);
+
+	vc_data->num_vleds = of_get_child_count(dev->of_node);
+	if (vc_data->num_vleds == 0) {
+		dev_err(dev, "No virtual LEDs defined in device tree\n");
+		ret = -EINVAL;
+		goto err_mutex_destroy;
+	}
+
+	vc_data->vleds = devm_kcalloc(dev, vc_data->num_vleds, sizeof(*vc_data->vleds), GFP_KERNEL);
+	if (!vc_data->vleds) {
+		ret = -ENOMEM;
+		goto err_mutex_destroy;
+	}
+
+	for_each_child_of_node(dev->of_node, child) {
+		struct virtual_led *vled = &vc_data->vleds[count];
+
+		ret = leds_virtualcolor_init_vled(dev, child, vled, vc_data);
+		if (ret) {
+			if (ret != -EPROBE_DEFER)
+				dev_err(dev, "Failed to initialize virtual LED %d\n", count);
+
+			of_node_put(child);
+			goto err_node_put;
+		}
+
+		count++;
+	}
+
+	platform_set_drvdata(pdev, vc_data);
+
+	if (of_property_read_bool(dev->of_node, "monochromatics-ro")) {
+		int i;
+
+		for (i = 0; i < count; i++) {
+			struct virtual_led *vled = &vc_data->vleds[i];
+
+			ret = leds_virtualcolor_disable_sysfs_access(dev, vled);
+			if (ret)
+				goto err_node_put;
+		}
+	}
+
+	return 0;
+
+err_node_put:
+	of_node_put(child);
+err_mutex_destroy:
+	mutex_destroy(&vc_data->lock);
+
+	return ret;
+}
+
+static void leds_virtualcolor_remove(struct platform_device *pdev)
+{
+	struct leds_virtualcolor *vc_data = platform_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < vc_data->num_vleds; i++) {
+		struct virtual_led *vled = &vc_data->vleds[i];
+		int j;
+
+		device_remove_file(vled->cdev.dev, &dev_attr_priority);
+		device_remove_file(vled->cdev.dev, &dev_attr_blink_delay_on);
+		device_remove_file(vled->cdev.dev, &dev_attr_blink_delay_off);
+
+		for (j = 0; j < vled->num_monochromatics; j++) {
+			if (vled->monochromatics[j]) {
+				led_put(vled->monochromatics[j]);
+				vled->monochromatics[j] = NULL;
+			}
+		}
+	}
+
+	mutex_destroy(&vc_data->lock);
+}
+
+static const struct of_device_id leds_virtualcolor_of_match[] = {
+	{ .compatible = "leds-group-virtualcolor" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, leds_virtualcolor_of_match);
+
+static struct platform_driver leds_virtualcolor_driver = {
+	.probe  = leds_virtualcolor_probe,
+	.remove = leds_virtualcolor_remove,
+	.driver = {
+		.name           = "leds_virtualcolor",
+		.of_match_table = leds_virtualcolor_of_match,
+	},
+};
+
+module_platform_driver(leds_virtualcolor_driver);
+
+MODULE_AUTHOR("Radoslav Tsvetkov <rtsvetkov@gradotech.eu>");
+MODULE_DESCRIPTION("LEDs Virtual Color Driver with Priority Handling");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:leds-group-virtualcolor");
--
2.43.0

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

* [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
  2025-09-16 11:02 [PATCH 1/5] leds: Add Virtual Color LED Group driver Jonathan Brophy
@ 2025-09-16 11:02 ` Jonathan Brophy
  2025-09-16 12:28   ` Lee Jones
                     ` (2 more replies)
  2025-09-16 11:02 ` [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver Jonathan Brophy
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-16 11:02 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

From: Jonathan Brophy <professor_jonny@hotmail.com>

This commit adds the Virtual Color driver to led/rgb Make and Kconfig.

Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
 drivers/leds/rgb/Kconfig  | 17 +++++++++++++++++
 drivers/leds/rgb/Makefile |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/leds/rgb/Kconfig b/drivers/leds/rgb/Kconfig
index 222d943d8..70a80fd46 100644
--- a/drivers/leds/rgb/Kconfig
+++ b/drivers/leds/rgb/Kconfig
@@ -75,4 +75,21 @@ config LEDS_MT6370_RGB
 	  This driver can also be built as a module. If so, the module
 	  will be called "leds-mt6370-rgb".
 
+config LEDS_GROUP_VIRTUALCOLOR
+	tristate "Virtual LED Group Driver with Priority Control"
+	depends on OF || COMPILE_TEST
+	help
+	  This option enables support for virtual LED groups that aggregate
+	  multiple monochromatic LEDs with priority-based control. It allows
+	  managing concurrent LED activation requests by ensuring only the
+	  highest-priority LED state is active at any given time.
+
+	  Multiple LEDs can be grouped together and controlled as a single
+	  virtual LED with priority levels and blinking support. This is
+	  useful for systems that need to manage multiple LED indicators
+	  with different priority levels.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called leds-group-virtualcolor.
+
 endif # LEDS_CLASS_MULTICOLOR
diff --git a/drivers/leds/rgb/Makefile b/drivers/leds/rgb/Makefile
index a501fd27f..693fd300b 100644
--- a/drivers/leds/rgb/Makefile
+++ b/drivers/leds/rgb/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_LEDS_NCP5623)		+= leds-ncp5623.o
 obj-$(CONFIG_LEDS_PWM_MULTICOLOR)	+= leds-pwm-multicolor.o
 obj-$(CONFIG_LEDS_QCOM_LPG)		+= leds-qcom-lpg.o
 obj-$(CONFIG_LEDS_MT6370_RGB)		+= leds-mt6370-rgb.o
+obj-$(CONFIG_LEDS_GROUP_VIRTUALCOLOR)	+= leds-group-virtualcolor.o
-- 
2.43.0


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

* [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver
  2025-09-16 11:02 [PATCH 1/5] leds: Add Virtual Color LED Group driver Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
@ 2025-09-16 11:02 ` Jonathan Brophy
  2025-09-16 13:25   ` Rob Herring (Arm)
  2025-09-22 16:45   ` Rob Herring
  2025-09-16 11:02 ` [PATCH 4/5] ABI: sysfs-class-leds-virtualcolor: Document sysfs entries for Virtual Color LEDs Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 5/5] dt-bindings: led: add virtual LED bindings Jonathan Brophy
  3 siblings, 2 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-16 11:02 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

From: Jonathan Brophy <professor_jonny@hotmail.com>

Document Virtual Color device tree bindings.

Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
 .../leds/leds-group-virtualcolor.yaml         | 79 +++++++++++++++++++
 1 file changed, 79 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 000000000..945058415
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
@@ -0,0 +1,79 @@
+# 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 with Priority Control
+
+maintainers:
+  - Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+
+description: |
+  Virtual LED group driver that combines multiple monochromatic LEDs into logical
+  groups with priority-based control. The driver ensures only the highest-priority
+  LED state is active at any given time.
+
+allOf:
+  - $ref: leds.yaml#
+
+properties:
+  compatible:
+    const: leds-group-virtualcolor
+
+required:
+  - compatible
+
+patternProperties:
+  "^led@[0-9a-f]$":
+    type: object
+    $ref: leds.yaml#
+    properties:
+      reg:
+        maxItems: 1
+      monochromatic-leds:
+        type: array
+        items:
+          maxItems: 1
+          $ref: /schemas/types.yaml#/definitions/phandle
+        minItems: 1
+        description: List of phandles to the monochromatic LEDs to group
+      priority:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Priority level for LED activation (higher value means higher priority)
+      blink-delay-on:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Time in milliseconds the LED is on during blink
+      blink-delay-off:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Time in milliseconds the LED is off during blink
+
+    required:
+      - reg
+      - monochromatic-leds
+
+additionalProperties: false
+
+examples:
+  - |
+    leds {
+        compatible = "leds-group-virtualcolor";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led@0 {
+            reg = <0>;
+            label = "status:red";
+            monochromatic-leds = <&led_red>;
+            priority = <2>;
+            blink-delay-on = <500>;
+            blink-delay-off = <500>;
+        };
+
+        led@1 {
+            reg = <1>;
+            label = "status:green";
+            monochromatic-leds = <&led_green>;
+            priority = <1>;
+        };
+    };
\ No newline at end of file
-- 
2.43.0


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

* [PATCH 4/5] ABI: sysfs-class-leds-virtualcolor: Document sysfs entries for Virtual Color LEDs
  2025-09-16 11:02 [PATCH 1/5] leds: Add Virtual Color LED Group driver Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver Jonathan Brophy
@ 2025-09-16 11:02 ` Jonathan Brophy
  2025-09-16 11:02 ` [PATCH 5/5] dt-bindings: led: add virtual LED bindings Jonathan Brophy
  3 siblings, 0 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-16 11:02 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

From: Jonathan Brophy <professor_jonny@hotmail.com>

Add sysfs-class-leds-virtualcolor to document Virtual Color drover sysfs
entries

Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
 .../ABI/sysfs-class-leds-virtualcolor         | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/ABI/sysfs-class-leds-virtualcolor

diff --git a/Documentation/ABI/sysfs-class-leds-virtualcolor b/Documentation/ABI/sysfs-class-leds-virtualcolor
new file mode 100644
index 000000000..60b878791
--- /dev/null
+++ b/Documentation/ABI/sysfs-class-leds-virtualcolor
@@ -0,0 +1,43 @@
+What:		/sys/class/leds/<led>/priority
+Date:		August 2025
+Contact:	Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+Description:	(RW) Priority level of the virtual LED group. Higher numbers
+        indicate higher priority. When multiple virtual LED groups are
+        active, only the highest priority group's state will be applied
+        to the physical LEDs.
+
+        Valid values: 0 to INT_MAX
+        Default: 0
+
+What:		/sys/class/leds/<led>/blink_delay_on
+Date:		August 2025
+Contact:	Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+Description:	(RW) The time in milliseconds that the LED should be on while
+        blinking. Setting both blink_delay_on and blink_delay_off to
+        zero disables blinking.
+
+        Valid values: 0 to ULONG_MAX
+        Default: 0
+
+What:		/sys/class/leds/<led>/blink_delay_off
+Date:		August 2025
+Contact:	Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+Description:	(RW) The time in milliseconds that the LED should be off while
+        blinking. Setting both blink_delay_on and blink_delay_off to
+        zero disables blinking.
+
+        Valid values: 0 to ULONG_MAX
+        Default: 0
+
+What:		/sys/class/leds/<led>/brightness
+Date:		August 2025
+Contact:	Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
+Description:	(RW) Brightness value for the virtual LED group. This value is
+        applied to all monochromatic LEDs in the group if this group
+        has the highest priority among active groups.
+
+        When read-only mode is enabled via device tree, writes to this
+        attribute will return -EPERM.
+
+        Valid values: 0 to LED_FULL (usually 255)
+        Default: LED_OFF (0)
\ No newline at end of file
-- 
2.43.0


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

* [PATCH 5/5] dt-bindings: led: add virtual LED bindings
  2025-09-16 11:02 [PATCH 1/5] leds: Add Virtual Color LED Group driver Jonathan Brophy
                   ` (2 preceding siblings ...)
  2025-09-16 11:02 ` [PATCH 4/5] ABI: sysfs-class-leds-virtualcolor: Document sysfs entries for Virtual Color LEDs Jonathan Brophy
@ 2025-09-16 11:02 ` Jonathan Brophy
  3 siblings, 0 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-16 11:02 UTC (permalink / raw)
  To: lee Jones, Pavel Machek, Jonathan Brophy, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: devicetree, linux-kernel, linux-leds

From: Jonathan Brophy <professor_jonny@hotmail.com>

Add device tree binding for virtual LED groups.

Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
---
 include/dt-bindings/leds/common.h | 4 ++++
 1 file changed, 4 insertions(+)

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

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

* Re: [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
@ 2025-09-16 12:28   ` Lee Jones
  2025-09-17  3:37   ` kernel test robot
  2025-09-17  5:04   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2025-09-16 12:28 UTC (permalink / raw)
  To: Jonathan Brophy
  Cc: Pavel Machek, Jonathan Brophy, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Radoslav Tsvetkov, devicetree, linux-kernel,
	linux-leds

On Tue, 16 Sep 2025, Jonathan Brophy wrote:

> From: Jonathan Brophy <professor_jonny@hotmail.com>
> 
> This commit adds the Virtual Color driver to led/rgb Make and Kconfig.
> 
> Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
> ---
>  drivers/leds/rgb/Kconfig  | 17 +++++++++++++++++
>  drivers/leds/rgb/Makefile |  1 +

This should be squashed into the patch that introduces the driver.

>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/leds/rgb/Kconfig b/drivers/leds/rgb/Kconfig
> index 222d943d8..70a80fd46 100644
> --- a/drivers/leds/rgb/Kconfig
> +++ b/drivers/leds/rgb/Kconfig
> @@ -75,4 +75,21 @@ config LEDS_MT6370_RGB
>  	  This driver can also be built as a module. If so, the module
>  	  will be called "leds-mt6370-rgb".
>  
> +config LEDS_GROUP_VIRTUALCOLOR
> +	tristate "Virtual LED Group Driver with Priority Control"
> +	depends on OF || COMPILE_TEST
> +	help
> +	  This option enables support for virtual LED groups that aggregate
> +	  multiple monochromatic LEDs with priority-based control. It allows
> +	  managing concurrent LED activation requests by ensuring only the
> +	  highest-priority LED state is active at any given time.
> +
> +	  Multiple LEDs can be grouped together and controlled as a single
> +	  virtual LED with priority levels and blinking support. This is
> +	  useful for systems that need to manage multiple LED indicators
> +	  with different priority levels.
> +
> +	  To compile this driver as a module, choose M here: the module
> +	  will be called leds-group-virtualcolor.
> +
>  endif # LEDS_CLASS_MULTICOLOR
> diff --git a/drivers/leds/rgb/Makefile b/drivers/leds/rgb/Makefile
> index a501fd27f..693fd300b 100644
> --- a/drivers/leds/rgb/Makefile
> +++ b/drivers/leds/rgb/Makefile
> @@ -6,3 +6,4 @@ obj-$(CONFIG_LEDS_NCP5623)		+= leds-ncp5623.o
>  obj-$(CONFIG_LEDS_PWM_MULTICOLOR)	+= leds-pwm-multicolor.o
>  obj-$(CONFIG_LEDS_QCOM_LPG)		+= leds-qcom-lpg.o
>  obj-$(CONFIG_LEDS_MT6370_RGB)		+= leds-mt6370-rgb.o
> +obj-$(CONFIG_LEDS_GROUP_VIRTUALCOLOR)	+= leds-group-virtualcolor.o
> -- 
> 2.43.0
> 

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver
  2025-09-16 11:02 ` [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver Jonathan Brophy
@ 2025-09-16 13:25   ` Rob Herring (Arm)
  2025-09-22 16:45   ` Rob Herring
  1 sibling, 0 replies; 11+ messages in thread
From: Rob Herring (Arm) @ 2025-09-16 13:25 UTC (permalink / raw)
  To: Jonathan Brophy
  Cc: linux-kernel, Radoslav Tsvetkov, devicetree, Jonathan Brophy,
	linux-leds, Pavel Machek, Conor Dooley, Krzysztof Kozlowski,
	lee Jones


On Tue, 16 Sep 2025 23:02:15 +1200, Jonathan Brophy wrote:
> From: Jonathan Brophy <professor_jonny@hotmail.com>
> 
> Document Virtual Color device tree bindings.
> 
> Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
> ---
>  .../leds/leds-group-virtualcolor.yaml         | 79 +++++++++++++++++++
>  1 file changed, 79 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml:5:6: [error] string value is redundantly quoted with any quotes (quoted-strings)
./Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml:6:10: [error] string value is redundantly quoted with any quotes (quoted-strings)
./Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml:79:7: [error] no new line character at the end of file (new-line-at-end-of-file)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml: monochromatic-leds: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml: patternProperties:^led@[0-9a-f]$:properties:monochromatic-leds:items:maxItems: False schema does not allow 1
	hint: Scalar properties should not have array keywords
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml: patternProperties:^led@[0-9a-f]$:properties:monochromatic-leds:type: 'array' is not one of ['boolean', 'object']
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml:
	Error in referenced schema matching $id: http://devicetree.org/schemas/leds/leds.yaml
	Tried these paths (check schema $id if path is wrong):
	/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds.yaml
	/usr/local/lib/python3.13/dist-packages/dtschema/schemas/leds/leds.yaml

/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): '#address-cells', '#size-cells' do not match any of the regexes: '^led@[0-9a-f]$', '^pinctrl-[0-9]+$'
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): {'compatible': ['leds-group-virtualcolor'], '#address-cells': 1, '#size-cells': 0, 'led@0': {'reg': [[0]], 'label': ['status:red'], 'monochromatic-leds': [4294967295], 'priority': 2, 'blink-delay-on': 500, 'blink-delay-off': 500}, 'led@1': {'reg': [[1]], 'label': ['status:green'], 'monochromatic-leds': [4294967295], 'priority': 1}, '$nodename': ['leds']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/leds/leds.yaml#"}
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): led@0: {'reg': [[0]], 'label': ['status:red'], 'monochromatic-leds': [4294967295], 'priority': 2, 'blink-delay-on': 500, 'blink-delay-off': 500} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/leds/leds.yaml#"}
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): led@0:monochromatic-leds:0: 4294967295 is not of type 'array'
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): led@1: {'reg': [[1]], 'label': ['status:green'], 'monochromatic-leds': [4294967295], 'priority': 1} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/leds/leds.yaml#"}
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.example.dtb: leds (leds-group-virtualcolor): led@1:monochromatic-leds:0: 4294967295 is not of type 'array'
	from schema $id: http://devicetree.org/schemas/leds/leds-group-virtualcolor.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250916110217.45894-3-professorjonny98@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

* Re: [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
  2025-09-16 12:28   ` Lee Jones
@ 2025-09-17  3:37   ` kernel test robot
  2025-09-17  5:04   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-09-17  3:37 UTC (permalink / raw)
  To: Jonathan Brophy, lee Jones, Pavel Machek, Jonathan Brophy,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: oe-kbuild-all, devicetree, linux-kernel, linux-leds

Hi Jonathan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-leds/for-leds-next]
[also build test WARNING on robh/for-next linus/master v6.17-rc6 next-20250916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jonathan-Brophy/leds-rgb-Add-Virtual-Color-LED-Group-driver-to-Make/20250916-190606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link:    https://lore.kernel.org/r/20250916110217.45894-2-professorjonny98%40gmail.com
patch subject: [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
config: i386-randconfig-012-20250917 (https://download.01.org/0day-ci/archive/20250917/202509171109.7rJrwT7i-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250917/202509171109.7rJrwT7i-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509171109.7rJrwT7i-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/leds/rgb/leds-group-virtualcolor.c: In function 'leds_virtualcolor_init_vled':
   drivers/leds/rgb/leds-group-virtualcolor.c:254:28: error: implicit declaration of function 'of_led_get'; did you mean 'of_node_get'? [-Werror=implicit-function-declaration]
     254 |                 led_cdev = of_led_get(child, i);
         |                            ^~~~~~~~~~
         |                            of_node_get
>> drivers/leds/rgb/leds-group-virtualcolor.c:254:26: warning: assignment to 'struct led_classdev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     254 |                 led_cdev = of_led_get(child, i);
         |                          ^
   cc1: some warnings being treated as errors


vim +254 drivers/leds/rgb/leds-group-virtualcolor.c

8ce5fa26ed391cb Jonathan Brophy 2025-09-16  217  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  218  static int leds_virtualcolor_init_vled(struct device *dev, struct device_node *child,
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  219  				       struct virtual_led *vled, struct leds_virtualcolor *vc_data)
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  220  {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  221  	struct fwnode_handle *child_fwnode = of_fwnode_handle(child);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  222  	struct led_init_data init_data = {};
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  223  	u32 blink_interval;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  224  	u32 phandle_count;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  225  	u32 max_brightness;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  226  	int ret, i;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  227  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  228  	ret = of_property_read_u32(child, "priority", &vled->priority);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  229  	if (ret)
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  230  		vled->priority = 0;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  231  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  232  	ret = of_property_read_u32(child, "blink", &blink_interval);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  233  	if (!ret) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  234  		vled->blink_delay_on = blink_interval;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  235  		vled->blink_delay_off = blink_interval;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  236  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  237  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  238  	phandle_count = fwnode_property_count_u32(child_fwnode, "leds");
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  239  	if (phandle_count <= 0) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  240  		dev_err(dev, "No monochromatic LEDs specified for virtual LED %s\n",
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  241  			vled->cdev.name);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  242  		return -EINVAL;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  243  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  244  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  245  	vled->num_monochromatics = phandle_count;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  246  	vled->monochromatics = devm_kcalloc(dev, vled->num_monochromatics,
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  247  					    sizeof(*vled->monochromatics), GFP_KERNEL);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  248  	if (!vled->monochromatics)
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  249  		return -ENOMEM;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  250  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  251  	for (i = 0; i < vled->num_monochromatics; i++) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  252  		struct led_classdev *led_cdev;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  253  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16 @254  		led_cdev = of_led_get(child, i);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  255  		if (IS_ERR_OR_NULL(led_cdev)) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  256  			/*
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  257  			 * If the LED is not available yet, defer the probe.
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  258  			 * The probe will be retried when the it becomes available.
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  259  			 */
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  260  			if (PTR_ERR(led_cdev) == -EPROBE_DEFER || !led_cdev) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  261  				return -EPROBE_DEFER;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  262  			} else {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  263  				ret = PTR_ERR(led_cdev);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  264  				dev_err(dev, "Failed to get monochromatic LED for %s, error %d\n",
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  265  					vled->cdev.name, ret);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  266  				return ret;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  267  			}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  268  		}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  269  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  270  		vled->monochromatics[i] = led_cdev;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  271  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  272  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  273  	ret = of_property_read_u32(child, "max-brightness", &max_brightness);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  274  	if (ret)
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  275  		vled->cdev.max_brightness = LED_FULL;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  276  	else
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  277  		vled->cdev.max_brightness = max_brightness;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  278  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  279  	vled->cdev.brightness_set_blocking = virtual_led_brightness_set;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  280  	vled->cdev.max_brightness = LED_FULL;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  281  	vled->cdev.flags = LED_CORE_SUSPENDRESUME;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  282  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  283  	init_data.fwnode = child_fwnode;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  284  	ret = devm_led_classdev_register_ext(dev, &vled->cdev, &init_data);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  285  	if (ret) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  286  		dev_err(dev, "Failed to register virtual LED %s\n", vled->cdev.name);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  287  		return ret;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  288  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  289  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  290  	ret = device_create_file(vled->cdev.dev, &dev_attr_priority);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  291  	if (ret) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  292  		dev_err(dev, "Failed to create sysfs attribute for priority\n");
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  293  		return ret;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  294  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  295  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  296  	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_on);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  297  	if (ret) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  298  		dev_err(dev, "Failed to create sysfs attribute for blink_delay_on\n");
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  299  		return ret;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  300  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  301  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  302  	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_off);
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  303  	if (ret) {
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  304  		dev_err(dev, "Failed to create sysfs attribute for blink_delay_off\n");
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  305  		return ret;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  306  	}
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  307  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  308  	vled->vc_data = vc_data;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  309  
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  310  	return 0;
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  311  }
8ce5fa26ed391cb Jonathan Brophy 2025-09-16  312  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
  2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
  2025-09-16 12:28   ` Lee Jones
  2025-09-17  3:37   ` kernel test robot
@ 2025-09-17  5:04   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-09-17  5:04 UTC (permalink / raw)
  To: Jonathan Brophy, lee Jones, Pavel Machek, Jonathan Brophy,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Radoslav Tsvetkov
  Cc: llvm, oe-kbuild-all, devicetree, linux-kernel, linux-leds

Hi Jonathan,

kernel test robot noticed the following build errors:

[auto build test ERROR on lee-leds/for-leds-next]
[also build test ERROR on robh/for-next linus/master v6.17-rc6 next-20250916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jonathan-Brophy/leds-rgb-Add-Virtual-Color-LED-Group-driver-to-Make/20250916-190606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link:    https://lore.kernel.org/r/20250916110217.45894-2-professorjonny98%40gmail.com
patch subject: [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make
config: x86_64-randconfig-001-20250917 (https://download.01.org/0day-ci/archive/20250917/202509171255.NYgyfQOg-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250917/202509171255.NYgyfQOg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509171255.NYgyfQOg-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/leds/rgb/leds-group-virtualcolor.c:254:14: error: call to undeclared function 'of_led_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     254 |                 led_cdev = of_led_get(child, i);
         |                            ^
>> drivers/leds/rgb/leds-group-virtualcolor.c:254:12: error: incompatible integer to pointer conversion assigning to 'struct led_classdev *' from 'int' [-Wint-conversion]
     254 |                 led_cdev = of_led_get(child, i);
         |                          ^ ~~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +/of_led_get +254 drivers/leds/rgb/leds-group-virtualcolor.c

8ce5fa26ed391c Jonathan Brophy 2025-09-16  217  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  218  static int leds_virtualcolor_init_vled(struct device *dev, struct device_node *child,
8ce5fa26ed391c Jonathan Brophy 2025-09-16  219  				       struct virtual_led *vled, struct leds_virtualcolor *vc_data)
8ce5fa26ed391c Jonathan Brophy 2025-09-16  220  {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  221  	struct fwnode_handle *child_fwnode = of_fwnode_handle(child);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  222  	struct led_init_data init_data = {};
8ce5fa26ed391c Jonathan Brophy 2025-09-16  223  	u32 blink_interval;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  224  	u32 phandle_count;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  225  	u32 max_brightness;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  226  	int ret, i;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  227  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  228  	ret = of_property_read_u32(child, "priority", &vled->priority);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  229  	if (ret)
8ce5fa26ed391c Jonathan Brophy 2025-09-16  230  		vled->priority = 0;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  231  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  232  	ret = of_property_read_u32(child, "blink", &blink_interval);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  233  	if (!ret) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  234  		vled->blink_delay_on = blink_interval;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  235  		vled->blink_delay_off = blink_interval;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  236  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  237  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  238  	phandle_count = fwnode_property_count_u32(child_fwnode, "leds");
8ce5fa26ed391c Jonathan Brophy 2025-09-16  239  	if (phandle_count <= 0) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  240  		dev_err(dev, "No monochromatic LEDs specified for virtual LED %s\n",
8ce5fa26ed391c Jonathan Brophy 2025-09-16  241  			vled->cdev.name);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  242  		return -EINVAL;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  243  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  244  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  245  	vled->num_monochromatics = phandle_count;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  246  	vled->monochromatics = devm_kcalloc(dev, vled->num_monochromatics,
8ce5fa26ed391c Jonathan Brophy 2025-09-16  247  					    sizeof(*vled->monochromatics), GFP_KERNEL);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  248  	if (!vled->monochromatics)
8ce5fa26ed391c Jonathan Brophy 2025-09-16  249  		return -ENOMEM;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  250  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  251  	for (i = 0; i < vled->num_monochromatics; i++) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  252  		struct led_classdev *led_cdev;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  253  
8ce5fa26ed391c Jonathan Brophy 2025-09-16 @254  		led_cdev = of_led_get(child, i);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  255  		if (IS_ERR_OR_NULL(led_cdev)) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  256  			/*
8ce5fa26ed391c Jonathan Brophy 2025-09-16  257  			 * If the LED is not available yet, defer the probe.
8ce5fa26ed391c Jonathan Brophy 2025-09-16  258  			 * The probe will be retried when the it becomes available.
8ce5fa26ed391c Jonathan Brophy 2025-09-16  259  			 */
8ce5fa26ed391c Jonathan Brophy 2025-09-16  260  			if (PTR_ERR(led_cdev) == -EPROBE_DEFER || !led_cdev) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  261  				return -EPROBE_DEFER;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  262  			} else {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  263  				ret = PTR_ERR(led_cdev);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  264  				dev_err(dev, "Failed to get monochromatic LED for %s, error %d\n",
8ce5fa26ed391c Jonathan Brophy 2025-09-16  265  					vled->cdev.name, ret);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  266  				return ret;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  267  			}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  268  		}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  269  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  270  		vled->monochromatics[i] = led_cdev;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  271  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  272  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  273  	ret = of_property_read_u32(child, "max-brightness", &max_brightness);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  274  	if (ret)
8ce5fa26ed391c Jonathan Brophy 2025-09-16  275  		vled->cdev.max_brightness = LED_FULL;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  276  	else
8ce5fa26ed391c Jonathan Brophy 2025-09-16  277  		vled->cdev.max_brightness = max_brightness;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  278  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  279  	vled->cdev.brightness_set_blocking = virtual_led_brightness_set;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  280  	vled->cdev.max_brightness = LED_FULL;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  281  	vled->cdev.flags = LED_CORE_SUSPENDRESUME;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  282  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  283  	init_data.fwnode = child_fwnode;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  284  	ret = devm_led_classdev_register_ext(dev, &vled->cdev, &init_data);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  285  	if (ret) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  286  		dev_err(dev, "Failed to register virtual LED %s\n", vled->cdev.name);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  287  		return ret;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  288  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  289  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  290  	ret = device_create_file(vled->cdev.dev, &dev_attr_priority);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  291  	if (ret) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  292  		dev_err(dev, "Failed to create sysfs attribute for priority\n");
8ce5fa26ed391c Jonathan Brophy 2025-09-16  293  		return ret;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  294  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  295  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  296  	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_on);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  297  	if (ret) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  298  		dev_err(dev, "Failed to create sysfs attribute for blink_delay_on\n");
8ce5fa26ed391c Jonathan Brophy 2025-09-16  299  		return ret;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  300  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  301  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  302  	ret = device_create_file(vled->cdev.dev, &dev_attr_blink_delay_off);
8ce5fa26ed391c Jonathan Brophy 2025-09-16  303  	if (ret) {
8ce5fa26ed391c Jonathan Brophy 2025-09-16  304  		dev_err(dev, "Failed to create sysfs attribute for blink_delay_off\n");
8ce5fa26ed391c Jonathan Brophy 2025-09-16  305  		return ret;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  306  	}
8ce5fa26ed391c Jonathan Brophy 2025-09-16  307  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  308  	vled->vc_data = vc_data;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  309  
8ce5fa26ed391c Jonathan Brophy 2025-09-16  310  	return 0;
8ce5fa26ed391c Jonathan Brophy 2025-09-16  311  }
8ce5fa26ed391c Jonathan Brophy 2025-09-16  312  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver
  2025-09-16 11:02 ` [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver Jonathan Brophy
  2025-09-16 13:25   ` Rob Herring (Arm)
@ 2025-09-22 16:45   ` Rob Herring
  2025-09-22 23:38     ` Jonathan Brophy
  1 sibling, 1 reply; 11+ messages in thread
From: Rob Herring @ 2025-09-22 16:45 UTC (permalink / raw)
  To: Jonathan Brophy
  Cc: lee Jones, Pavel Machek, Jonathan Brophy, Krzysztof Kozlowski,
	Conor Dooley, Radoslav Tsvetkov, devicetree, linux-kernel,
	linux-leds

On Tue, Sep 16, 2025 at 11:02:15PM +1200, Jonathan Brophy wrote:
> From: Jonathan Brophy <professor_jonny@hotmail.com>
> 
> Document Virtual Color device tree bindings.
> 
> Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
> ---
>  .../leds/leds-group-virtualcolor.yaml         | 79 +++++++++++++++++++
>  1 file changed, 79 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 000000000..945058415
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
> @@ -0,0 +1,79 @@
> +# 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 with Priority Control
> +
> +maintainers:
> +  - Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> +
> +description: |
> +  Virtual LED group driver that combines multiple monochromatic LEDs into logical
> +  groups with priority-based control. The driver ensures only the highest-priority
> +  LED state is active at any given time.

Isn't this what the multi-led binding already does?

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

* RE: [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver
  2025-09-22 16:45   ` Rob Herring
@ 2025-09-22 23:38     ` Jonathan Brophy
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Brophy @ 2025-09-22 23:38 UTC (permalink / raw)
  To: Rob Herring
  Cc: lee Jones, Pavel Machek, Jonathan Brophy, Krzysztof Kozlowski,
	Conor Dooley, Radoslav Tsvetkov, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org



-----Original Message-----
From: Rob Herring <robh@kernel.org> 
Sent: Tuesday, 23 September 2025 4:45 AM
To: Jonathan Brophy <professorjonny98@gmail.com>
Cc: lee Jones <lee@kernel.org>; Pavel Machek <pavel@kernel.org>; Jonathan Brophy <professor_jonny@hotmail.com>; Krzysztof Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Radoslav Tsvetkov <rtsvetkov@gradotech.eu>; devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-leds@vger.kernel.org
Subject: Re: [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver

On Tue, Sep 16, 2025 at 11:02:15PM +1200, Jonathan Brophy wrote:
> From: Jonathan Brophy <professor_jonny@hotmail.com>
> 
> Document Virtual Color device tree bindings.
> 
> Co-developed-by: Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> Signed-off-by: Jonathan Brophy <professor_jonny@hotmail.com>
> ---
>  .../leds/leds-group-virtualcolor.yaml         | 79 +++++++++++++++++++
>  1 file changed, 79 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 000000000..945058415
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml
> @@ -0,0 +1,79 @@
> +# 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 with Priority Control
> +
> +maintainers:
> +  - Radoslav Tsvetkov <rtsvetkov@gradotech.eu>
> +
> +description: |
> +  Virtual LED group driver that combines multiple monochromatic LEDs into logical
> +  groups with priority-based control. The driver ensures only the highest-priority
> +  LED state is active at any given time.

> Isn't this what the multi-led binding already does?

Yes, but I think the virtual colour driver needs its own unique bindings to distinguish it from other multi color (RGB) LEDs as it is not a multicolor or RGB  LED, it can be thought of an array of LEDs exposed as a virtual single LED.

The multi-led from my understanding is more about combining control to modify and control the colour from SYSFS.

In this driver the colour is set from the device tree by combing LEDs of different colours if they are combined into a single element but it is not its sole purpose, it could be used to drive every single LED on power up for example.

If you think it is unnecessary I can remove it, but I think it would be better to differentiate it from a multi-led as I don't think they are the same.



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

end of thread, other threads:[~2025-09-22 23:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 11:02 [PATCH 1/5] leds: Add Virtual Color LED Group driver Jonathan Brophy
2025-09-16 11:02 ` [PATCH 2/5] leds: rgb: Add Virtual Color LED Group driver to Make Jonathan Brophy
2025-09-16 12:28   ` Lee Jones
2025-09-17  3:37   ` kernel test robot
2025-09-17  5:04   ` kernel test robot
2025-09-16 11:02 ` [PATCH 3/5] dt-bindings: leds: Add YAML bindings for Virtual Color LED Group driver Jonathan Brophy
2025-09-16 13:25   ` Rob Herring (Arm)
2025-09-22 16:45   ` Rob Herring
2025-09-22 23:38     ` Jonathan Brophy
2025-09-16 11:02 ` [PATCH 4/5] ABI: sysfs-class-leds-virtualcolor: Document sysfs entries for Virtual Color LEDs Jonathan Brophy
2025-09-16 11:02 ` [PATCH 5/5] dt-bindings: led: add virtual LED bindings Jonathan Brophy

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).