Age | Commit message (Collapse) | Author | Files | Lines |
|
Add two new functions, led_blink_set_oneshot and
led_trigger_blink_oneshot, to be used by triggers for one-shot blink of
led devices.
This is implemented extending the existing software-blink code, and uses
the same timer and handler function.
The behavior of the code is to do a blink-on, blink-off sequence when
the function is called, ignoring other calls until the sequence is
completed so that the leds keep blinking at constant rate if the
functions are called repeatedly.
This is meant to be used by drivers which needs to trigger on sporadic
event, but doesn't have clear busy/idle trigger points.
After the blink sequence the led remains off. This behavior can be
inverted setting the "invert" argument, which blink the led off, than on
and leave the led on after the sequence.
([email protected]: rebase to commit 'leds: don't disable blinking
when writing the same value to delay_on or delay_off')
Signed-off-by: Fabio Baltieri <[email protected]>
Acked-by: Shuah Khan <[email protected]>
Signed-off-by: Bryan Wu <[email protected]>
|
|
Fixed a coding style issue relating to trailing
white space error found by checkpatch.pl tool in drivers/leds/led-class.c
Signed-off-by: Jeffrin Jose <[email protected]>
Signed-off-by: Bryan Wu <[email protected]>
|
|
led-class.c and ledtrig-timer.c still use simple_strtoul(). Change them
to use kstrtoul() instead of obsolete simple_strtoul().
Also fix the existing int ret declaration to be ssize_t to match the
return type for _store functions in ledtrig-timer.c.
Signed-off-by: Shuah Khan <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Bryan Wu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
After moving some core functions to led-core.c, led-class.c can be built
as module again.
Signed-off-by: Bryan Wu <[email protected]>
Acked-by: Richard Purdie <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
This resolves the conflict in the arch/arm/mach-s3c64xx/s3c6400.c file,
and it fixes the build error in the arch/x86/kernel/microcode_core.c
file, that the merge did not catch.
The microcode_core.c patch was provided by Stephen Rothwell
<[email protected]> who was invaluable in the merge issues involved
with the large sysdev removal process in the driver-core tree.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
The sysdev.h file should not be needed by any in-kernel code, so remove
the .h file from these random files that seem to still want to include
it.
The sysdev code will be going away soon, so this include needs to be
removed no matter what.
Cc: Jiandong Zheng <[email protected]>
Cc: Scott Branden <[email protected]>
Cc: Russell King <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: David Brown <[email protected]>
Cc: Daniel Walker <[email protected]>
Cc: Bryan Huntsman <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Wan ZongShun <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
Cc: Hans-Christian Egtvedt <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: "Venkatesh Pallipadi
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Matthew Garrett <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
|
|
Revert commit 6123b0e274503a0d3588e84fbe07c9aa01bfaf5d.
The problem this patch intends to solve has alreadqy been fixed by
commit 7a5caabd090b ("drivers/leds/ledtrig-timer.c: fix broken sysfs
delay handling").
Signed-off-by: Johan Hovold <[email protected]>
Cc: Antonio Ospite <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Depending on the implementation of the hardware blinking function in
blink_set(), the led can support hardware blinking for some values of
delay_on and delay_off and fall-back to software blinking for some other
values.
Turning off the blink_timer unconditionally before starting to blink
make sure that a sequence like:
OFF
hardware blinking
software blinking
hardware blinking
does not leave the software blinking timer active.
Signed-off-by: Antonio Ospite <[email protected]>
Reviewed-by: Johannes Berg <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
When calling the hardware blinking function implemented by blink_set(),
the delay_on and delay_off values are not preserved across calls.
Fix that and make the "timer" trigger work as expected when hardware
blinking is available.
BEFORE the fix:
$ cd /sys/class/leds/someled
$ echo timer > trigger
$ cat delay_on delay_off
0
0
$ echo 100 > delay_on
$ cat delay_on delay_off
0
0
$ echo 100 > delay_off
$ cat delay_on delay_off
0
0
AFTER the fix:
$ cd /sys/class/leds/someled
$ echo timer > trigger
$ cat delay_on delay_off
0
0
$ echo 100 > delay_on
$ cat delay_on delay_off
100
0
$ echo 100 > delay_off
$ cat delay_on delay_off
100
100
Signed-off-by: Antonio Ospite <[email protected]>
Reviewed-by: Johannes Berg <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
By setting initial values blink_delay_on and blink_delay_off in a
led_classdev struct, this change starts the blinking when the led is
initialized.
With this patch, you can initialize blink_delay_on and blink_delay_off in
led_classdev with default_trigger set to "timer", and the led will start
up blinking. The current ledtrig-timer implementation ignores any initial
blink_delay_on/blink_delay_off settings, and requires setting
blink_delay_on/blink_delay_off (typically from userspace) before the led
blinks.
Signed-off-by: Esben Haabendal <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Randy Dunlap <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
When I added led_blink_set I had a typo: the return value of the hw
offload is a regular error code that is zero when succesful, and in that
case software emulation should not be used, rather than the other way
around.
Signed-off-by: Johannes Berg <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Currently, blinking LEDs can be awkward because it is not guaranteed that
all LEDs implement blinking. The trigger that wants it to blink then
needs to implement its own timer solution.
Rather than require that, add led_blink_set() API that triggers can use.
This function will attempt to use hw blinking, but if that fails
implements a timer for it. To stop blinking again, brightness_set() also
needs to be wrapped into API that will stop the software blink.
As a result of this, the timer trigger becomes a very trivial one, and
hopefully we can finally see triggers using blinking as well because it's
always easy to use.
Signed-off-by: Johannes Berg <[email protected]>
Acked-by: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
max_brightness is not writable, thus set permissions to 0444.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
If we were to dynamically register/unregister leds and have udev or other
daemons handle the leds class uevents, we would be notified of the adding of a
new LED and if the daemon immediately tries to open one of the attributes of
the led device, it would fail with a "no such file or directory" error since
this the attributes are not yet created. Fix this by switching attributes to be
class-wide, such that the driver core will register these attributes with
device_add_attrs and then emit the kobject_uevent ADD signal.
Signed-off-by: Fainelli <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
As each led device gets registered a kernel message gets printed. In
an embedded system with a number of leds this can produce a lot
of output that just looks like noise.
Change the message type to KERN_DEBUG since it might be useful
in the dmesg output "after" booting.
Signed-off-by: H Hartley Sweeten <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
Makes use of skip_spaces() defined in lib/string.c for removing leading
spaces from strings all over the tree.
It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
text data bss dec hex filename
64688 584 592 65864 10148 (TOTALS-BEFORE)
64641 584 592 65817 10119 (TOTALS-AFTER)
Also, while at it, if we see (*str && isspace(*str)), we can be sure to
remove the first condition (*str) as the second one (isspace(*str)) also
evaluates to 0 whenever *str == 0, making it redundant. In other words,
"a char equals zero is never a space".
Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
and found occurrences of this pattern on 3 more files:
drivers/leds/led-class.c
drivers/leds/ledtrig-timer.c
drivers/video/output.c
@@
expression str;
@@
( // ignore skip_spaces cases
while (*str && isspace(*str)) { \(str++;\|++str;\) }
|
- *str &&
isspace(*str)
)
Signed-off-by: André Goddard Rosa <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: David Howells <[email protected]>
Cc: <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: Takashi Iwai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
This patch allows drivers to override the default maximum brightness value
of 255. We take care to preserve backwards-compatibility as much as
possible, so that user-space ABI doesn't change for existing drivers.
LED trigger code has also been updated to use the per-LED maximum.
Signed-off-by: Guennadi Liakhovetski <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
Add suspend/resume to the core class and remove all the now unneeded
code from various drivers. Originally the class code couldn't support
suspend/resume but since class_device can there is no reason for
each driver doing its own suspend/resume anymore.
|
|
Signed-off-by: Sven Wegener <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
Fix a race during trigger registration where we could try and use a lock
before it was initialised.
Signed-off-by: Richard Purdie <[email protected]>
|
|
led_classdev_unregister() has no "__" prefix, remove it.
Signed-off-by: Qinghuang Feng <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
There's no need for the additional call to strlen(), we can directly
return the value returned by sprintf(). We now return a length value
that doesn't include the final '\0', but user space shouldn't bother
about it anyway.
Signed-off-by: Sven Wegener <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
Now that device_create() has been audited, rename things back to the
original call to be sane.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.
This patch fixes the problem by using the new function,
device_create_drvdata().
Cc: Kay Sievers <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
Some drivers have duplicated unlikely() macros. IS_ERR() already has
unlikely() in itself.
This patch cleans up such pointless code.
Signed-off-by: Hirofumi Nakagawa <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Jeff Garzik <[email protected]>
Cc: Paul Clements <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: David Brownell <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Michael Halcrow <[email protected]>
Cc: Anton Altaparmakov <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Carsten Otte <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Acked-by: Mike Frysinger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Some led hardware allows drivers to query the led state, and this patch
adds a hook to let the led class take advantage of that information when
available.
Without this functionality, when access to the led hardware is not
exclusive (i.e. firmware or hardware might change its state behind the
kernel's back), reality goes out of sync with the led class' idea of what
the led is doing, which is annoying at best.
Behaviour for drivers that do not or cannot read the led status is
unchanged.
Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
Disable any active triggers when the brightness attribute is
set to zero.
Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Márton Németh <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
|
|
After 2.6.24 there was a plan to make the PM core acquire all device
semaphores during a suspend/hibernation to protect itself from
concurrent operations involving device objects. That proved to be
too heavy-handed and we found a better way to achieve the goal, but
before it happened, we had introduced the functions
device_pm_schedule_removal() and destroy_suspended_device() to allow
drivers to "safely" destroy a suspended device and we had adapted some
drivers to use them. Now that these functions are no longer necessary,
it seems reasonable to remove them and modify their users to use the
normal device unregistration instead.
Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
Make it possible to unregister a led classdev object in a safe way during a
suspend/resume cycle.
Signed-off-by: Rafael J. Wysocki <[email protected]>
Cc: Michael Buesch <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: "John W. Linville" <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Covert leds_list_lock to a rw_sempahore to match previous LED trigger
locking fixes, fixing lock ordering.
Signed-off-by: Richard Purdie <[email protected]>
|
|
Convert part of the led trigger core from rw spinlocks to rw
semaphores. We're calling functions which can sleep from invalid
contexts otherwise. Fixes bug #9264.
Signed-off-by: Richard Purdie <[email protected]>
|
|
Convert the LEDs class from struct class_device to struct device
since class_device is scheduled for removal.
Signed-off-by: Richard Purdie <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
|
|
Signed-off-by: Jeff Garzik <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Fixes a typo in led-class.c kerneldoc.
Signed-off-by: Henrik Kretzschmar <[email protected]>
Signed-off-by: Adrian Bunk <[email protected]>
|
|
Signed-off-by: Jörn Engel <[email protected]>
Signed-off-by: Adrian Bunk <[email protected]>
|
|
Fix the error handling of some LED _store functions. This corrects them to
return -EINVAL if the value is not numeric with an optional byte of trailing
whitespace.
Signed-off-by: Richard Purdie <[email protected]>
Cc: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Add support for LED triggers to the LED subsystem. "Triggers" are events
which change the state of an LED. Two kinds of trigger are available, simple
ones which can be added to exising code with minimum disruption and complex
ones for implementing new or more complex functionality.
Signed-off-by: Richard Purdie <[email protected]>
Cc: Russell King <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Add the foundations of a new LEDs subsystem. This patch adds a class which
presents LED devices within sysfs and allows their brightness to be
controlled.
Signed-off-by: Richard Purdie <[email protected]>
Cc: Russell King <[email protected]>
Cc: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|