public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Jonathan Brophy <professor_jonny@hotmail.com>
Cc: Pavel Machek <pavel@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Radoslav Tsvetkov <rtsvetkov@gradotech.eu>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] leds: Add Virtual Color LED Group driver
Date: Fri, 10 Oct 2025 08:59:43 +0100	[thread overview]
Message-ID: <20251010075943.GB2988639@google.com> (raw)
In-Reply-To: <DS0PR84MB3746BE2BCCCC3BB0185D3F6B9FEFA@DS0PR84MB3746.NAMPRD84.PROD.OUTLOOK.COM>

On Fri, 10 Oct 2025, Jonathan Brophy wrote:

> 
> 
> -----Original Message-----
> From: Lee Jones <lee@kernel.org> 
> Sent: Friday, 10 October 2025 4:19 AM
> To: Jonathan Brophy <professorjonny98@gmail.com>
> Cc: Pavel Machek <pavel@kernel.org>; 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>; devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-leds@vger.kernel.org
> Subject: Re: [PATCH 1/4] leds: Add Virtual Color LED Group driver
> 
> On Thu, 09 Oct 2025, Jonathan Brophy wrote:
> 
> > 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/Kconfig                   |  17 +
> >  drivers/leds/rgb/Makefile                  |   1 +
> >  drivers/leds/rgb/leds-group-virtualcolor.c | 440 
> > +++++++++++++++++++++
> >  3 files changed, 458 insertions(+)
> >  create mode 100644 drivers/leds/rgb/leds-group-virtualcolor.c
> > 
> > diff --git a/drivers/leds/rgb/Kconfig b/drivers/leds/rgb/Kconfig index 
> > 222d943d826a..70a80fd46b9c 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.
> 
> Grep for:
> 
>   "This driver groups several monochromatic LED devices in a single multicolor LED device."
> 
> Does this scratch your itch?  Is this something worth building on?
> 
> > +
> > +	  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.
> 
> --
> Lee Jones [李琼斯]

It's better to set your mailer up to quote properly, then place your
replies directly under the text you're replying to.

> I'm not entirely sure what you mean about grep for but I can update the message more friendly, if that is what you mean?

And line-wrap too please.

> As for is this worth something building on....  there Are possibly more features that can be added, but it serves the purpose I intended to use it for currently, I did think it may be a security issue if one could create virtual led instances form userspace but it is a potential feature.
> 
> Other features such a cycling, diming sequences, on delay and off delay or more complex logic could be configured in the DTS I guess?.
> 
> Originally the driver was intended for OpenWrt so standard triggers and aliases can be attached to virtual LEDs,  the intention was to be able to closely match functions of OEM products status LEDs that often indicate multiple states.
> The intention was to eliminate userspace scripting controlling the logic, so these statuses could be realised by just simple bindings.
> 
> There is a similar basic driver function in the Qualcomm SDK based on OpenWrt but it does not feature properties such as timing and priority.
> 
> One thing is that the led dt bindings property's function and colour are quite restrictive in naming as you can't stack the functions when you are trying to describe properties of a complex led, or if you have multiple virtual LEDs of the same color, it can get confusing as it prioritises this as opposed to the node name or label.
> The label property makes it easy to describe it but this format is deprecated.
> 
> EG:
> 
> function = LED_FUNCTION_STATUS;
> color = < LED_COLOR_ID_YELLOW>;
> 
> label =<YELLOW_SYSTEM_FLASHING_VIRTUAL_STAUS_LED> ;
> 
> could we stack the property function in an array to make it more descriptive:
> 
> function = < LED_FUNCTION_STATUS >, < LED_FUNCTION_FLASH>, < LED_FUNCTION_VIRTUAL_STATUS> ;
> 
> One thing I did also notice the Colour Magenta is not an available option in the DT bindings which is technically correct for an RGB LED  but violet and purple is there as a close option but I don't know where he best place is to comment on this.
> 
> Jonathan Brophy

Whoa, that was too much text for a reply to a message you didn't understand!

By "Grep for", I really did mean to "physically grep for this line in the kernel".

Doing so would have brought you to here:

https://github.com/torvalds/linux/blob/master/drivers/leds/rgb/leds-group-multicolor.c#L5

This looks similar to what you're trying to achieve.  At least the
documentation line appears to describe something related.

Please read leds-group-multicolor.c and see if it helps you at all.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2025-10-10  7:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09  8:43 [PATCH 1/4] leds: Add Virtual Color LED Group driver Jonathan Brophy
2025-10-09  8:43 ` [PATCH 2/4] dt-bindings: leds: Add YAML bindings for " Jonathan Brophy
2025-10-09 14:18   ` Krzysztof Kozlowski
2025-10-09  8:43 ` [PATCH 3/4] ABI: sysfs-class-leds-virtualcolor: Document sysfs entries for Virtual Color LEDs Jonathan Brophy
2025-10-09  8:43 ` [PATCH 4/4] dt-bindings: led: add virtual LED bindings Jonathan Brophy
2025-10-09 14:19   ` Krzysztof Kozlowski
2025-10-09 14:25 ` [PATCH 1/4] leds: Add Virtual Color LED Group driver Krzysztof Kozlowski
2025-10-13  0:24   ` Jonathan Brophy
2025-10-13  0:44     ` Krzysztof Kozlowski
2025-10-09 15:18 ` Lee Jones
2025-10-10  0:10   ` Jonathan Brophy
2025-10-10  7:59     ` Lee Jones [this message]
2025-10-10 18:12 ` Rob Herring

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=20251010075943.GB2988639@google.com \
    --to=lee@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@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