Hi Jean, On 10/28/22 19:03, Jean-Jacques Hiblot wrote:
By allowing to group multiple monochrome LED into multicolor LEDs, all involved LEDs can be controlled in-sync. This enables using effects using triggers, etc. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@xxxxxxxxxxxxxxx> --- drivers/leds/rgb/Kconfig | 10 ++ drivers/leds/rgb/Makefile | 1 + drivers/leds/rgb/leds-group-multicolor.c | 154 +++++++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 drivers/leds/rgb/leds-group-multicolor.c diff --git a/drivers/leds/rgb/Kconfig b/drivers/leds/rgb/Kconfig index 204cf470beae..1a87f53faa8a 100644 --- a/drivers/leds/rgb/Kconfig +++ b/drivers/leds/rgb/Kconfig @@ -2,6 +2,16 @@
[...]
+ + for (i = 0; i < count; i++) { + struct led_classdev *led_cdev = priv->monochromatics[i]; + + /* Make the sysfs of the monochromatic LED read-only */ + led_cdev->flags |= LED_SYSFS_DISABLE;
Clearing these on remove is needed as well.
+ } + + return 0; +} + +static const struct of_device_id of_led_mcg_match[] = { + { .compatible = "leds-group-multicolor" }, + {} +}; +MODULE_DEVICE_TABLE(of, of_led_mcg_match); + +static struct platform_driver led_mcg_driver = { + .probe = led_mcg_probe, + .driver = { + .name = "leds_group_multicolor", + .of_match_table = of_led_mcg_match, + } +}; +module_platform_driver(led_mcg_driver); + +MODULE_AUTHOR("Jean-Jacques Hiblot <jjhiblot@xxxxxxxxxxxxxxx>"); +MODULE_DESCRIPTION("multi-color LED group driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:leds-group-multicolor");
-- Best regards, Jacek Anaszewski