lkml.org 
[lkml]   [2005]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: best way to handle LEDs
From
On Wed, November 2, 2005 3:51 am, Pavel Machek said:
> Hi!
>
>> > I think even slow blinking was used somewhere. I have some code from
>> > John Lenz (attached); it uses sysfs interface, exports led collor, and
>> > allows setting different frequencies.
>> >
>> > Is that acceptable, or should some other interface be used?
>>
>> there is already an LED interface for linux-arm, which is
>> used by a number of the extant machines in the sa11x0 and
>> pxa range.
>
> Where is that interface? I think that making collie use it is obvious
> first step...
> Pavel
>

I originally wrote the collie led code to use that interface, and you
might look at some of the old versions of the patch on my web site. The
actual code is in arch/arm/kernel/time.c, but this code calls out to an
individual machine function through say arch/arm/mach-sa1100/leds.c...
The problem for collie was that the device model for locomo did not allow
an easy way to do it... as you can see, in my patch it implements a driver
for those leds and the driver model takes care of it.

I just looked, and
http://www.cs.wisc.edu/~lenz/zaurus/files/patch-2.6.7-jl2.diff.gz contins
the implementation of the arm led interface for collie.... not sure if it
will still work anymore, but...
I then grew the led code to support more than four leds, multi color leds,
more than just the arm architecture, etc... Russell has been very critical
of my patch on the "waste" of memory (a struct device for each led, along
with a bunch of struct attributes for each led), where by contrast the arm
one has a single attribute.

But this led interface and the one arm provides can almost not even be
compared. My patch correctly implements the sysfs model of one attribute,
one file (instead of all leds controlled through a single file). My patch
also is more flexible and provides needed options for many leds. The
downside is, it makes the leds hard to use for debugging, which is the
primary purpose of the original arm led code.

For debugging, the arm specific led code is a great tool, and I am not
meaning to replace it. For debugging, you can just specifiy
CONFIG_CLASS_LEDS=n.

John

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-03 03:34    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site