diff mbox

RGB LED control (was Re: "advanced" LED controllers)

Message ID 20150308205732.GA385@amd (mailing list archive)
State New, archived
Headers show

Commit Message

Pavel Machek March 8, 2015, 8:57 p.m. UTC
Ok, so I played with RGB LED a bit, and we have quite a gap in
documentation: what 50% brightness means is non-trivial and very
important in case we want to do smooth blinking and color transitions.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

Comments

Geert Uytterhoeven March 9, 2015, 8:08 a.m. UTC | #1
Hi Pavel,

On Sun, Mar 8, 2015 at 9:57 PM, Pavel Machek <pavel@ucw.cz> wrote:
> Ok, so I played with RGB LED a bit, and we have quite a gap in
> documentation: what 50% brightness means is non-trivial and very
> important in case we want to do smooth blinking and color transitions.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
> index 3646ec8..649d7a6 100644
> --- a/Documentation/ABI/testing/sysfs-class-led
> +++ b/Documentation/ABI/testing/sysfs-class-led
> @@ -8,6 +8,11 @@ Description:
>                 non-zero brightness settings. The value is between 0 and
>                 /sys/class/leds/<led>/max_brightness.
>
> +               If LED supports continuous brightness settings, 50% brightness
> +               should correspond to 50% brightness perceived by human, in a similar
> +               manner pixel brightness on monitor does (not 50% PWM).

How many drivers do it right? How many don't?

For those that don't, perhaps we handle the conversion between perceived and
pwm in the core, e.g. by adding a new flag to led_classdev.flags to indicate
the need for conversion?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Machek March 9, 2015, 9:08 a.m. UTC | #2
On Mon 2015-03-09 09:08:37, Geert Uytterhoeven wrote:
> Hi Pavel,
> 
> On Sun, Mar 8, 2015 at 9:57 PM, Pavel Machek <pavel@ucw.cz> wrote:
> > Ok, so I played with RGB LED a bit, and we have quite a gap in
> > documentation: what 50% brightness means is non-trivial and very
> > important in case we want to do smooth blinking and color transitions.
> >
> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >
> > diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
> > index 3646ec8..649d7a6 100644
> > --- a/Documentation/ABI/testing/sysfs-class-led
> > +++ b/Documentation/ABI/testing/sysfs-class-led
> > @@ -8,6 +8,11 @@ Description:
> >                 non-zero brightness settings. The value is between 0 and
> >                 /sys/class/leds/<led>/max_brightness.
> >
> > +               If LED supports continuous brightness settings, 50% brightness
> > +               should correspond to 50% brightness perceived by human, in a similar
> > +               manner pixel brightness on monitor does (not 50% PWM).
> 
> How many drivers do it right? How many don't?

Not sure. leds-lp5523.c gets is wrong. Easy test is to attempt to set
"electric indigo" color
(http://en.wikipedia.org/wiki/Indigo#Violet-blue) and see what comes
out.

> For those that don't, perhaps we handle the conversion between perceived and
> pwm in the core, e.g. by adding a new flag to led_classdev.flags to indicate
> the need for conversion?

There is not that many drivers that support smooth power
adjustments. But yes, we can probably conversion in the core for
trivial case.

Unfortunately, we only have 8-bits of precision to work with... 
									Pavel
Måns Rullgård March 9, 2015, 11:50 a.m. UTC | #3
Geert Uytterhoeven <geert@linux-m68k.org> writes:

> Hi Pavel,
>
> On Sun, Mar 8, 2015 at 9:57 PM, Pavel Machek <pavel@ucw.cz> wrote:
>> Ok, so I played with RGB LED a bit, and we have quite a gap in
>> documentation: what 50% brightness means is non-trivial and very
>> important in case we want to do smooth blinking and color transitions.
>>
>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
>> index 3646ec8..649d7a6 100644
>> --- a/Documentation/ABI/testing/sysfs-class-led
>> +++ b/Documentation/ABI/testing/sysfs-class-led
>> @@ -8,6 +8,11 @@ Description:
>>                 non-zero brightness settings. The value is between 0 and
>>                 /sys/class/leds/<led>/max_brightness.
>>
>> +               If LED supports continuous brightness settings, 50% brightness
>> +               should correspond to 50% brightness perceived by human, in a similar
>> +               manner pixel brightness on monitor does (not 50% PWM).
>
> How many drivers do it right? How many don't?
>
> For those that don't, perhaps we handle the conversion between perceived and
> pwm in the core, e.g. by adding a new flag to led_classdev.flags to indicate
> the need for conversion?

Some LED controllers do the right thing in hardware, so any adjustment
done in the core needs to be optional.
Pavel Machek March 10, 2015, 8:04 a.m. UTC | #4
On Mon 2015-03-09 11:50:56, Måns Rullgård wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> writes:
> 
> > Hi Pavel,
> >
> > On Sun, Mar 8, 2015 at 9:57 PM, Pavel Machek <pavel@ucw.cz> wrote:
> >> Ok, so I played with RGB LED a bit, and we have quite a gap in
> >> documentation: what 50% brightness means is non-trivial and very
> >> important in case we want to do smooth blinking and color transitions.
> >>
> >> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >>
> >> diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
> >> index 3646ec8..649d7a6 100644
> >> --- a/Documentation/ABI/testing/sysfs-class-led
> >> +++ b/Documentation/ABI/testing/sysfs-class-led
> >> @@ -8,6 +8,11 @@ Description:
> >>                 non-zero brightness settings. The value is between 0 and
> >>                 /sys/class/leds/<led>/max_brightness.
> >>
> >> +               If LED supports continuous brightness settings, 50% brightness
> >> +               should correspond to 50% brightness perceived by human, in a similar
> >> +               manner pixel brightness on monitor does (not 50% PWM).
> >
> > How many drivers do it right? How many don't?
> >
> > For those that don't, perhaps we handle the conversion between perceived and
> > pwm in the core, e.g. by adding a new flag to led_classdev.flags to indicate
> > the need for conversion?
> 
> Some LED controllers do the right thing in hardware, so any adjustment
> done in the core needs to be optional.

Do you have example controller that gets it right, btw?

Bryan, can you apply the documentation patch so we can start fixing
the drivers?

Thanks,
									Pavel
diff mbox

Patch

diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
index 3646ec8..649d7a6 100644
--- a/Documentation/ABI/testing/sysfs-class-led
+++ b/Documentation/ABI/testing/sysfs-class-led
@@ -8,6 +8,11 @@  Description:
 		non-zero brightness settings. The value is between 0 and
 		/sys/class/leds/<led>/max_brightness.
 
+		If LED supports continuous brightness settings, 50% brightness
+		should correspond to 50% brightness perceived by human, in a similar
+		manner pixel brightness on monitor does (not 50% PWM).
+
+
 What:		/sys/class/leds/<led>/max_brightness
 Date:		March 2006
 KernelVersion:	2.6.17