All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org
Subject: Re: [PATCH] led: core: RfC - add RGB LED handling to the core
Date: Wed, 13 Jan 2016 20:54:19 +0100	[thread overview]
Message-ID: <5696AB6B.8040905@gmail.com> (raw)
In-Reply-To: <56961C10.7090009@samsung.com>

Am 13.01.2016 um 10:42 schrieb Jacek Anaszewski:
> Hi Heiner,
> 
> Thank you for the patch. We have to ask a question here - what benefits
> these modifications bring about. Isn't all of this achievable in the
> user space? And I think that RGB LED problem can be boiled down to even
> more generic one, namely: how to make all the sub-LEDs controllable with
> a single LED class device. This subject pops out from time to time and
> it'd be good to have it tackled finally. Please refer to [1] and follow
> the links.
> 
> [1] http://www.spinics.net/lists/linux-leds/msg04508.html
> 
> Best Regards,
> Jacek Anaszewski
> 

Thanks for the prompt feedback, Jacek.
Regarding RGB support I also think of eventually making setting the color
available via triggers. This would allow kernel events to use colors.
I think of use cases like:
- add RGB support to heartbeat trigger: Then, with increasing load,
  the color can change from green to red.
- combine temperature monitoring with a RGB LED trigger.
- in general visualizing parameters in the kernel with >2 states or a range
  of possible values

Therefore I think having RGB LED support in the kernel makes sense.
And we have it anyway also as of today, just in different forms in different
corners of the kernel code.
Prerequiste for RGB-based triggers is one central API for controlling RGB LEDs.

When we come to sub-LEDs:
I'd define sub-LEDs as LEDs which are somehow grouped but basically independent.
I don't think this definition applies to a RGB LED as the three LEDs are not
independent.
I had a look at the referenced mail thread, however the usecase wasn't clear
to me. I understand that it's about making LEDs blink synchronously but
there was no example what it could be good for. Can you list some usecases?
Maybe once I see some usecases for sub-LEDs it becomes clearer what they have
in common with RGB LEDs.

The primary question with sub-LEDs most likely is:
Which properties can be controlled on a per-LED basis and which ones only
on a LED group basis?
(Or should it be supported that I can fiddle with properties on a per-LED
and on a group basis in parallel?)
I'd assume that the following idea is not brand-new: I could imagine to
have sysfs nodes for LED groups under /sys/class/leds including:
- attributes for the LED properties delegated to the group
- links to the led_classdev nodes of the respective LEDs in the group

Kind Regards, Heiner

> On 01/10/2016 09:27 PM, Heiner Kallweit wrote:
>> When playing with a ThingM Blink(1) USB RGB LED device I found that there
>> are few drivers for RGB LED's spread across the kernel and each one
>> implements the RGB functionality in its own way.
>> Some examples:
>> - drivers/hid/hid-thingm.c
>> - drivers/usb/misc/usbled.c
>> - drivers/leds/leds-bd2802.c
>> - drivers/leds/leds-blinkm.c
>> ...
>> IMHO it would make sense to add generic RGB functionality to the LED core.
>>
>> Things I didn't like too much in other driver implementations:
>> - one led_classdev per color or at least
>> - one sysfs attribute per color
>> Colors are not really independent therefore I'd prefer one led_classdev
>> per RGB LED. Also userspace should be able to change the color with one
>> call -> therefore only one sysfs attribute for the RGB values.
>>
>> Also the current brightness-related functionality should not be effected
>> by the RGB extension.
>>
>> This patch is intended to demonstrate the idea of the extension. Most likely
>> it's not ready yet for submission.
>>
>> Main idea is to base the effective RGB value on a combination of brightness
>> and a scaled-to-max RGB value.
>> The RGB-related callbacks are basically the same as for brightness.
>> RGB functionally can be switched on with a new flag in the led_classdev.flags
>> bitmap.
>>
>> Experimentally I changed the thingm driver to use this extension and it works
>> quite well. As one result the driver could be very much simplified.
>>
>> Any feedback is appreciated.
>> [...]
> 
> 
> 

  reply	other threads:[~2016-01-13 19:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-10 20:27 [PATCH] led: core: RfC - add RGB LED handling to the core Heiner Kallweit
2016-01-13  9:42 ` Jacek Anaszewski
2016-01-13 19:54   ` Heiner Kallweit [this message]
2016-01-14 11:14     ` Jacek Anaszewski
2016-01-14 12:05       ` Jacek Anaszewski
2016-01-14 12:08 ` Jacek Anaszewski
2016-01-15 20:16   ` Heiner Kallweit
2016-01-17 22:31     ` Jacek Anaszewski
2016-01-24 13:38       ` Heiner Kallweit
2016-01-25  8:41         ` Jacek Anaszewski
2016-01-25  9:51           ` Heiner Kallweit
2016-01-25 10:52             ` Jacek Anaszewski
2016-01-25 19:09               ` Heiner Kallweit
2016-01-26  9:37                 ` Jacek Anaszewski
2016-01-26 20:08                   ` Heiner Kallweit
2016-01-27  8:27                     ` Jacek Anaszewski
2016-01-29  7:00                       ` Heiner Kallweit
2016-01-29  8:24                         ` Jacek Anaszewski
2016-02-01  6:43                           ` Heiner Kallweit
2016-02-01  8:26                             ` Jacek Anaszewski
2016-02-01 21:41                               ` Heiner Kallweit
2016-02-02  8:58                                 ` Jacek Anaszewski
2016-02-03  6:42                                   ` Heiner Kallweit
2016-02-03  8:28                                     ` Jacek Anaszewski
2016-02-03 22:08                                       ` Heiner Kallweit
2016-02-04  8:30                                         ` Jacek Anaszewski
2016-02-07  0:18                                           ` Heiner Kallweit

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=5696AB6B.8040905@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.