LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* "advanced" LED controllers
@ 2015-02-19 21:14 Felipe Balbi
  2015-02-23 22:34 ` Pavel Machek
  2015-02-25  8:25 ` Geert Uytterhoeven
  0 siblings, 2 replies; 16+ messages in thread
From: Felipe Balbi @ 2015-02-19 21:14 UTC (permalink / raw)
  To: cooloney, rpurdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

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).

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-19 21:14 "advanced" LED controllers Felipe Balbi
@ 2015-02-23 22:34 ` Pavel Machek
  2015-02-23 22:58   ` Felipe Balbi
  2015-02-25  8:25 ` Geert Uytterhoeven
  1 sibling, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2015-02-23 22:34 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: cooloney, rpurdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List

On Thu 2015-02-19 15:14:24, Felipe Balbi wrote:
> 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.

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 <pavel@ucw.cz>, 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-23 22:34 ` Pavel Machek
@ 2015-02-23 22:58   ` Felipe Balbi
  2015-02-25 21:49     ` Pavel Machek
  0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2015-02-23 22:58 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Felipe Balbi, cooloney, rpurdie, linux-leds,
	Linux Kernel Mailing List, Linux OMAP Mailing List

[-- Attachment #1: Type: text/plain, Size: 1778 bytes --]

On Mon, Feb 23, 2015 at 11:34:57PM +0100, Pavel Machek wrote:
> On Thu 2015-02-19 15:14:24, Felipe Balbi wrote:
> > 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.
> 
> 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.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-19 21:14 "advanced" LED controllers Felipe Balbi
  2015-02-23 22:34 ` Pavel Machek
@ 2015-02-25  8:25 ` Geert Uytterhoeven
  2015-02-25  9:06   ` Alexandre Courbot
  1 sibling, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2015-02-25  8:25 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Bryan Wu, Richard Purdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List, linux-gpio

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

On Thu, Feb 19, 2015 at 10:14 PM, Felipe Balbi <balbi@ti.com> wrote:
> 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).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-25  8:25 ` Geert Uytterhoeven
@ 2015-02-25  9:06   ` Alexandre Courbot
  2015-03-02  9:21     ` Pavel Machek
  0 siblings, 1 reply; 16+ messages in thread
From: Alexandre Courbot @ 2015-02-25  9:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Felipe Balbi, Bryan Wu, Richard Purdie, linux-leds,
	Linux Kernel Mailing List, Linux OMAP Mailing List, linux-gpio

On Wed, Feb 25, 2015 at 5:25 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> 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.

>
> On Thu, Feb 19, 2015 at 10:14 PM, Felipe Balbi <balbi@ti.com> wrote:
>> 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).
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-23 22:58   ` Felipe Balbi
@ 2015-02-25 21:49     ` Pavel Machek
  2015-02-25 23:55       ` NeilBrown
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2015-02-25 21:49 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: cooloney, rpurdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List

On Mon 2015-02-23 16:58:36, Felipe Balbi wrote:
> On Mon, Feb 23, 2015 at 11:34:57PM +0100, Pavel Machek wrote:
> > On Thu 2015-02-19 15:14:24, Felipe Balbi wrote:
> > > 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.
> > 
> > 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-25 21:49     ` Pavel Machek
@ 2015-02-25 23:55       ` NeilBrown
  2015-02-28 16:18         ` Pavel Machek
  0 siblings, 1 reply; 16+ messages in thread
From: NeilBrown @ 2015-02-25 23:55 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Felipe Balbi, cooloney, rpurdie, linux-leds,
	Linux Kernel Mailing List, Linux OMAP Mailing List

[-- Attachment #1: Type: text/plain, Size: 3036 bytes --]

On Wed, 25 Feb 2015 22:49:41 +0100 Pavel Machek <pavel@ucw.cz> wrote:

> On Mon 2015-02-23 16:58:36, Felipe Balbi wrote:
> > On Mon, Feb 23, 2015 at 11:34:57PM +0100, Pavel Machek wrote:
> > > On Thu 2015-02-19 15:14:24, Felipe Balbi wrote:
> > > > 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.
> > > 
> > > 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

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-25 23:55       ` NeilBrown
@ 2015-02-28 16:18         ` Pavel Machek
  0 siblings, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2015-02-28 16:18 UTC (permalink / raw)
  To: NeilBrown
  Cc: Felipe Balbi, cooloney, rpurdie, linux-leds,
	Linux Kernel Mailing List, Linux OMAP Mailing List

Hi!

On Thu 2015-02-26 10:55:52, NeilBrown wrote:
> On Wed, 25 Feb 2015 22:49:41 +0100 Pavel Machek <pavel@ucw.cz> wrote:
> 
> > On Mon 2015-02-23 16:58:36, Felipe Balbi wrote:
> > > On Mon, Feb 23, 2015 at 11:34:57PM +0100, Pavel Machek wrote:
> > > > On Thu 2015-02-19 15:14:24, Felipe Balbi wrote:
> > > > > 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

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

> > 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.
> 
> 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, 

> > 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.
> 
> 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

> > 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.
> 
> 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, 

> > 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.
> 
> 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.

> "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.

> 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-02-25  9:06   ` Alexandre Courbot
@ 2015-03-02  9:21     ` Pavel Machek
  2015-03-03  8:15       ` Alexandre Courbot
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2015-03-02  9:21 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Geert Uytterhoeven, Felipe Balbi, Bryan Wu, Richard Purdie,
	linux-leds, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-gpio

On Wed 2015-02-25 18:06:07, Alexandre Courbot wrote:
> On Wed, Feb 25, 2015 at 5:25 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > 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).

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: "advanced" LED controllers
  2015-03-02  9:21     ` Pavel Machek
@ 2015-03-03  8:15       ` Alexandre Courbot
  2015-03-08 20:57         ` RGB LED control (was Re: "advanced" LED controllers) Pavel Machek
  0 siblings, 1 reply; 16+ messages in thread
From: Alexandre Courbot @ 2015-03-03  8:15 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Geert Uytterhoeven, Felipe Balbi, Bryan Wu, Richard Purdie,
	linux-leds, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-gpio

On Mon, Mar 2, 2015 at 6:21 PM, Pavel Machek <pavel@ucw.cz> wrote:
> On Wed 2015-02-25 18:06:07, Alexandre Courbot wrote:
>> On Wed, Feb 25, 2015 at 5:25 PM, Geert Uytterhoeven
>> <geert@linux-m68k.org> wrote:
>> > 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).

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?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RGB LED control (was Re: "advanced" LED controllers)
  2015-03-03  8:15       ` Alexandre Courbot
@ 2015-03-08 20:57         ` Pavel Machek
  2015-03-09  8:08           ` Geert Uytterhoeven
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2015-03-08 20:57 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Geert Uytterhoeven, Felipe Balbi, Bryan Wu, Richard Purdie,
	linux-leds, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-gpio


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).
+
+
 What:		/sys/class/leds/<led>/max_brightness
 Date:		March 2006
 KernelVersion:	2.6.17


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: RGB LED control (was Re: "advanced" LED controllers)
  2015-03-08 20:57         ` RGB LED control (was Re: "advanced" LED controllers) Pavel Machek
@ 2015-03-09  8:08           ` Geert Uytterhoeven
  2015-03-09  9:08             ` Pavel Machek
  2015-03-09 11:50             ` Måns Rullgård
  0 siblings, 2 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2015-03-09  8:08 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Alexandre Courbot, Felipe Balbi, Bryan Wu, Richard Purdie,
	linux-leds, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-gpio

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: RGB LED control (was Re: "advanced" LED controllers)
  2015-03-09  8:08           ` Geert Uytterhoeven
@ 2015-03-09  9:08             ` Pavel Machek
  2015-03-09 11:50             ` Måns Rullgård
  1 sibling, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2015-03-09  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Alexandre Courbot, Felipe Balbi, Bryan Wu, Richard Purdie,
	linux-leds, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-gpio

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: RGB LED control (was Re: "advanced" LED controllers)
  2015-03-09  8:08           ` Geert Uytterhoeven
  2015-03-09  9:08             ` Pavel Machek
@ 2015-03-09 11:50             ` Måns Rullgård
  2015-03-10  8:04               ` Pavel Machek
  1 sibling, 1 reply; 16+ messages in thread
From: Måns Rullgård @ 2015-03-09 11:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Pavel Machek, Alexandre Courbot, Felipe Balbi, Bryan Wu,
	Richard Purdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List, linux-gpio

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.

-- 
Måns Rullgård
mans@mansr.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: RGB LED control (was Re: "advanced" LED controllers)
  2015-03-09 11:50             ` Måns Rullgård
@ 2015-03-10  8:04               ` Pavel Machek
       [not found]                 ` <CAK5ve-K4jyBSVk1CZ8qQrFgevqdbhdsgZ1ZYX2e-t07494oq4A@mail.gmail.com>
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2015-03-10  8:04 UTC (permalink / raw)
  To: Måns Rullgård
  Cc: Geert Uytterhoeven, Alexandre Courbot, Felipe Balbi, Bryan Wu,
	Richard Purdie, linux-leds, Linux Kernel Mailing List,
	Linux OMAP Mailing List, linux-gpio

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Documentation: leds: clarify what 50% brightness means
       [not found]                 ` <CAK5ve-K4jyBSVk1CZ8qQrFgevqdbhdsgZ1ZYX2e-t07494oq4A@mail.gmail.com>
@ 2015-03-11  9:34                   ` Pavel Machek
  0 siblings, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2015-03-11  9:34 UTC (permalink / raw)
  To: Bryan Wu
  Cc: Måns Rullgård, Geert Uytterhoeven, Alexandre Courbot,
	Felipe Balbi, Bryan Wu, Richard Purdie, linux-leds,
	Linux Kernel Mailing List, Linux OMAP Mailing List, linux-gpio

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).
+
+
 What:		/sys/class/leds/<led>/max_brightness
 Date:		March 2006
 KernelVersion:	2.6.17

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-03-11  9:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 21:14 "advanced" LED controllers Felipe Balbi
2015-02-23 22:34 ` Pavel Machek
2015-02-23 22:58   ` Felipe Balbi
2015-02-25 21:49     ` Pavel Machek
2015-02-25 23:55       ` NeilBrown
2015-02-28 16:18         ` Pavel Machek
2015-02-25  8:25 ` Geert Uytterhoeven
2015-02-25  9:06   ` Alexandre Courbot
2015-03-02  9:21     ` Pavel Machek
2015-03-03  8:15       ` Alexandre Courbot
2015-03-08 20:57         ` RGB LED control (was Re: "advanced" LED controllers) Pavel Machek
2015-03-09  8:08           ` Geert Uytterhoeven
2015-03-09  9:08             ` Pavel Machek
2015-03-09 11:50             ` Måns Rullgård
2015-03-10  8:04               ` Pavel Machek
     [not found]                 ` <CAK5ve-K4jyBSVk1CZ8qQrFgevqdbhdsgZ1ZYX2e-t07494oq4A@mail.gmail.com>
2015-03-11  9:34                   ` Documentation: leds: clarify what 50% brightness means Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).