Skip to contentSkip to conversation

"advanced" LED controllers

DISCUSSION Felipe Balbi 6 participants 16 messages Feb 19, 2015 – Mar 11, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

AFAICT, in linux today we would have to register each of the 8 LEDs as a different LED and have driver magic to write the proper bits on register 0x44, that seems a bit overkill, specially when we want to make
patterns: instead of writing 0xff we would have to write 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 separately and have the driver cache the previous results so we don't end up switching off other LEDs.

IOW, what could be handled with a single write, currently needs 8.

I wonder if there's any work happening to support these slightly more inteligent LED engines.

regards

[1] http://www.ti.com/product/tpic2810

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Currently the driver loads patterns as if it was a firmware blob and registers each of R, G and B components as separate LEDs. Each component also has its own brightness controls (something tpic2810 doesn't have, it's either on or off).

Signature · 1 line
balbi
#1 lore raw
Quoted 21 lines · Felipe Balbi

Hi,

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

AFAICT, in linux today we would have to register each of the 8 LEDs as a different LED and have driver magic to write the proper bits on register 0x44, that seems a bit overkill, specially when we want to make
patterns: instead of writing 0xff we would have to write 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 separately and have the driver cache the previous results so we don't end up switching off other LEDs.

IOW, what could be handled with a single write, currently needs 8.

I wonder if there's any work happening to support these slightly more inteligent LED engines.

Quoted 6 lines

regards

[1] http://www.ti.com/product/tpic2810

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Well... some more advanced pattern engines can actually run code, up to and including prime number computation. So yes, this is complex, and how to handle it nicely is a question...

I have "notcc" to compile for that.

#!/usr/bin/python3
#
# NOTification Compiler
#

# for LP5523 chip.
#
# Copyright 2014 Pavel Machek <[email protected]>, GPLv3
#
# http://wiki.maemo.org/LED_patterns#Lysti_Format_Engine_Patterns_and_Commands
# http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=lp5523&fileType=pdf
#
# Seems to have A,B local variables, C global variable,
#
# 2.6.28-omap1 seems to cut execution after 16 steps.

import sys

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
Quoted 26 lines · Pavel Machek
Quoted 25 lines · Felipe Balbi

Hi,

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

AFAICT, in linux today we would have to register each of the 8 LEDs as a different LED and have driver magic to write the proper bits on register 0x44, that seems a bit overkill, specially when we want to make
patterns: instead of writing 0xff we would have to write 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 separately and have the driver cache the previous results so we don't end up switching off other LEDs.

IOW, what could be handled with a single write, currently needs 8.

I wonder if there's any work happening to support these slightly more inteligent LED engines.

regards

[1] http://www.ti.com/product/tpic2810

Quoted 8 lines
Quoted 2 lines

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Well... some more advanced pattern engines can actually run code, up to and including prime number computation. So yes, this is complex, and how to handle it nicely is a question...

I have "notcc" to compile for that.

right, the point is that this is a solution which only works with lp5523 and IMO linux led subsystem should do a little more for such devices.

Signature · 1 line
balbi
#6 lore raw
In reply to Felipe Balbi

CC linux-gpio, as this looks like the LED equivalent of bulk gpio?

Quoted 30 lines · Felipe Balbi

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

AFAICT, in linux today we would have to register each of the 8 LEDs as a different LED and have driver magic to write the proper bits on register 0x44, that seems a bit overkill, specially when we want to make
patterns: instead of writing 0xff we would have to write 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 separately and have the driver cache the previous results so we don't end up switching off other LEDs.

IOW, what could be handled with a single write, currently needs 8.

I wonder if there's any work happening to support these slightly more inteligent LED engines.

regards

[1] http://www.ti.com/product/tpic2810

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Currently the driver loads patterns as if it was a firmware blob and registers each of R, G and B components as separate LEDs. Each component also has its own brightness controls (something tpic2810 doesn't have, it's either on or off).

#7 lore raw
Quoted 1 line · Geert Uytterhoeven

CC linux-gpio, as this looks like the LED equivalent of bulk gpio?

Indeed. The LED core could implement something similar to gpiod_set_array() to allow several LEDs to be set in one call. If the controller supports it, it would then set all the LEDs at once, otherwise the core would apply the values serially.

In leds-gpio.c, this multiple LED setting could be implemented by a single call to gpiod_set_array() and the right thing would happen.

Quoted 36 lines · Felipe Balbi
Quoted 23 lines

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

AFAICT, in linux today we would have to register each of the 8 LEDs as a different LED and have driver magic to write the proper bits on register 0x44, that seems a bit overkill, specially when we want to make
patterns: instead of writing 0xff we would have to write 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 separately and have the driver cache the previous results so we don't end up switching off other LEDs.

IOW, what could be handled with a single write, currently needs 8.

I wonder if there's any work happening to support these slightly more inteligent LED engines.

regards

[1] http://www.ti.com/product/tpic2810

Quoted 7 lines

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Currently the driver loads patterns as if it was a firmware blob and registers each of R, G and B components as separate LEDs. Each component also has its own brightness controls (something tpic2810 doesn't have, it's either on or off).

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Felipe Balbi
Quoted 16 lines · Felipe Balbi
Quoted 15 lines · Pavel Machek
Quoted 13 lines · Felipe Balbi

Hi,

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

[1] http://www.ti.com/product/tpic2810

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Quoted 8 lines
Quoted 5 lines

Well... some more advanced pattern engines can actually run code, up to and including prime number computation. So yes, this is complex, and how to handle it nicely is a question...

I have "notcc" to compile for that.

right, the point is that this is a solution which only works with lp5523 and IMO linux led subsystem should do a little more for such devices.

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
Quoted 37 lines · On Wed, 25 Feb 2015 22:49:41 +0100 Pavel Machek <[email protected]> wrote:
Quoted 16 lines · Felipe Balbi
Quoted 15 lines · Pavel Machek
Quoted 13 lines · Felipe Balbi

Hi,

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

[1] http://www.ti.com/product/tpic2810

ps: tpic2810 is probably the simplest example, lp551, lp5523 and others have even more advanced pattern engines which can even handle RGB leds.

Quoted 8 lines
Quoted 5 lines

Well... some more advanced pattern engines can actually run code, up to and including prime number computation. So yes, this is complex, and how to handle it nicely is a question...

I have "notcc" to compile for that.

right, the point is that this is a solution which only works with lp5523 and IMO linux led subsystem should do a little more for such devices.

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

Quoted 5 lines

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Pavel

All (most) current options for controlling LEDs are based on what a user might want, rather than what the hardware can provide.

I think it would be good to keep that approach, but add more "interesting" functions which each hardware can support in whichever way suits it best.

So "ramp_blink" which allow a ramp on/off time to be specified would be useful.

"audio_meter" which allows a particular sound card (or output or something) to be specified would also be useful. You could also specify a what volume the LED saturates.
Then if you set each led on a given controller to saturate at different level and to use the same sound source, then you could get the "graphic equaliser" effect.

Maybe 'blinking' should have a 'synchronise' setting to that a bunch of LEDs can be synchonised so you can create a "cylon eye" effect.

i.e. don't focus on the low-level 'what can we provide' but on the high level "what might users want".

NeilBrown

#5 lore raw

Hi!

Quoted 7 lines · NeilBrown
Quoted 5 lines · On Wed, 25 Feb 2015 22:49:41 +0100 Pavel Machek <[email protected]> wrote:
Quoted 4 lines · Felipe Balbi
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Felipe Balbi

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Do we have support for LED controllers which can handle patterns of different kinds ? I mean, currently, if we have an LED controller such as TPIC2810 [1] which can control 8 different leds and each LED corresponds to one bit on register 0x44, we could control leds by just "playing" a wave file on the controller and create easy patterns with that.

[1] http://www.ti.com/product/tpic2810

Does tpic2810 support brightness on the LEDs, or is it just one bit per led?

Quoted 15 lines
Quoted 6 lines

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

Quoted 8 lines

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Quoted 8 lines

All (most) current options for controlling LEDs are based on what a user might want, rather than what the hardware can provide.

I think it would be good to keep that approach, but add more "interesting" functions which each hardware can support in whichever way suits it best.

So "ramp_blink" which allow a ramp on/off time to be specified would be useful.

Well, ramp_blink would certainly cover a lot of cases, but not everything. For example, I'd like to do "ramp to 25% brightness, wait, ramp to 50% brightness,

Quoted 15 lines
Quoted 6 lines

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

Quoted 8 lines

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Quoted 8 lines

All (most) current options for controlling LEDs are based on what a user might want, rather than what the hardware can provide.

I think it would be good to keep that approach, but add more "interesting" functions which each hardware can support in whichever way suits it best.

So "ramp_blink" which allow a ramp on/off time to be specified would be useful.

Well, ramp_blink would certainly cover a lot of cases, but not everything. For example, I'd like to do "ramp to 25% brightness, wait, ramp to 50% brightness

Quoted 15 lines
Quoted 6 lines

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

Quoted 8 lines

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Quoted 8 lines

All (most) current options for controlling LEDs are based on what a user might want, rather than what the hardware can provide.

I think it would be good to keep that approach, but add more "interesting" functions which each hardware can support in whichever way suits it best.

So "ramp_blink" which allow a ramp on/off time to be specified would be useful.

Well, ramp_blink would certainly cover a lot of cases, but not everything. For example, I'd like to do "ramp to 25% brightness, wait, ramp to 50% brightness,

Quoted 15 lines
Quoted 6 lines

Well, question is what we want. Possibilities I see:

1) We won't support all the features, just some common subset. Kernel will get commands for LED controller and translate them. Question is what reasonable subset is, then.

Quoted 8 lines

I guess "delay", "set led brightness to X", "jump" would be minimal shared command set. lp5523 can do also "slowly increase/decrease brightness to X" (I believe we should support that one), arithmetics, conditional jumps, and communications between 3 threads.

2) We want to support all the features. I guess that would mean doing compilation in userspace, and having "compiler" for each led controller. Having common source code would still be nice.

Quoted 8 lines

All (most) current options for controlling LEDs are based on what a user might want, rather than what the hardware can provide.

I think it would be good to keep that approach, but add more "interesting" functions which each hardware can support in whichever way suits it best.

So "ramp_blink" which allow a ramp on/off time to be specified would be useful.

Well, ramp_blink would certainly cover a lot of cases, but not everything. For example, I'd like to do "ramp to 25% brightness, wait, ramp to 50% brightness, wait, ramp to 75% brightness, wait, ramp to 100% brightness, wait, ramp back to 0" pattern to indicate charging..

Also, I'd like to do "smoothly go through colors of rainbow" pattern to indicate booting.

So yes, "ramp_blink" would cover some common cases, but not nearly everything.

Quoted 3 lines

"audio_meter" which allows a particular sound card (or output or something) to be specified would also be useful. You could also specify a what volume the LED saturates.

audio_meter would have to be done by software, as hardware can not really accelerate that.

256 brightness values to cycle through for each r/g/b channel might be enough for most patterns... but it would be quite hard to "compile" that into program for lp5523.

Other solution would be specifying series of "time, brightness" points, with expectation of linear change between those".

So [ 0sec, 0%; 1sec, 0%; 1sec, 100%] would be turn the LED on quickly, and [ 0sec, 0%, 1sec, 100% ] would be slowly ramp the LED over one second.

Advantage would be that it should be fairly easy to compile from this to lp5523 and similar.

Quoted 5 lines

Maybe 'blinking' should have a 'synchronise' setting to that a bunch of LEDs can be synchonised so you can create a "cylon eye" effect.

i.e. don't focus on the low-level 'what can we provide' but on the high level "what might users want".

See above what I'd want, and

http://my-maemo.com/software/applications.php?fldAuto=1275&faq=42
http://my-maemo.com/software/applications.php?fldAuto=2096&faq=42
https://wiki.maemo.org/LED_patterns

what other people want.

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw
In reply to Alexandre Courbot
Quoted 11 lines · Alexandre Courbot
Quoted 1 line · Geert Uytterhoeven

CC linux-gpio, as this looks like the LED equivalent of bulk gpio?

Indeed. The LED core could implement something similar to gpiod_set_array() to allow several LEDs to be set in one call. If the controller supports it, it would then set all the LEDs at once, otherwise the core would apply the values serially.

In leds-gpio.c, this multiple LED setting could be implemented by a single call to gpiod_set_array() and the right thing would happen.

Actually, there are two issues: some controlles can set all LEDs at once, and some can program pwm level smoothly using given program (and handle multiple leds in the process).

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#9 lore raw
Quoted 10 lines · Pavel Machek
Quoted 9 lines · Alexandre Courbot
Quoted 1 line · Geert Uytterhoeven

CC linux-gpio, as this looks like the LED equivalent of bulk gpio?

Indeed. The LED core could implement something similar to gpiod_set_array() to allow several LEDs to be set in one call. If the controller supports it, it would then set all the LEDs at once, otherwise the core would apply the values serially.

Quoted 6 lines
Quoted 2 lines

In leds-gpio.c, this multiple LED setting could be implemented by a single call to gpiod_set_array() and the right thing would happen.

Actually, there are two issues: some controlles can set all LEDs at once, and some can program pwm level smoothly using given program (and handle multiple leds in the process).

In any case, that would be handled at the controller level and should work with a function similar to gpiod_set_array(), wouldn't it?

#10 lore raw

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

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.

Documentation/ABI/testing/sysfs-class-led +5 -0
index 3646ec8..649d7a6 100644
@@ -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
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#11 lore raw

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

Hi Pavel,

Quoted 11 lines · Pavel Machek

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.

Documentation/ABI/testing/sysfs-class-led +0 -0
index 3646ec8..649d7a6 100644

Documentation/ABI/testing/sysfs-class-led Description: · line 13

Quoted 6 lines
Documentation/ABI/testing/sysfs-class-led +3 -0
@@ -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 -- [email protected]

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

#12 lore raw

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

Quoted 17 lines · Geert Uytterhoeven

Hi Pavel,

Quoted 14 lines · Pavel Machek

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.

Documentation/ABI/testing/sysfs-class-led +0 -0
index 3646ec8..649d7a6 100644
@@ -8,6 +8,11 @@ Description:
                non-zero brightness settings. The value is between 0 and
                /sys/class/leds/<led>/max_brightness.
 
Quoted 5 lines

Documentation/ABI/testing/sysfs-class-led Description: · line 13

Quoted 3 lines
Documentation/ABI/testing/sysfs-class-led +3 -0
+               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.

Quoted 3 lines

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

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#13 lore raw

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

In reply to Geert Uytterhoeven
Quoted 23 lines · Geert Uytterhoeven

Hi Pavel,

Quoted 11 lines · Pavel Machek

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.

Documentation/ABI/testing/sysfs-class-led +0 -0
index 3646ec8..649d7a6 100644

Documentation/ABI/testing/sysfs-class-led Description: · line 13

Quoted 6 lines
Documentation/ABI/testing/sysfs-class-led +3 -0
@@ -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?

Quoted 3 lines

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.

Signature · 6 lines
Måns Rullgård
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#14 lore raw

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

Quoted 25 lines · Måns Rullgård
Quoted 23 lines · Geert Uytterhoeven

Hi Pavel,

Quoted 11 lines · Pavel Machek

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.

Documentation/ABI/testing/sysfs-class-led +0 -0
index 3646ec8..649d7a6 100644

Documentation/ABI/testing/sysfs-class-led Description: · line 13

Quoted 6 lines
Documentation/ABI/testing/sysfs-class-led +3 -0
@@ -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?

Quoted 6 lines
Quoted 3 lines

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

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#16 lore raw

Documentation: leds: clarify what 50% brightness means

In reply to a message not in the archive

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.

Documentation/ABI/testing/sysfs-class-led +5 -0
index 3646ec8..649d7a6 100644
@@ -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
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html