leds: add oneshot blink functions
authorFabio Baltieri <fabio.baltieri@gmail.com>
Sat, 26 May 2012 23:19:22 +0000 (07:19 +0800)
committerBryan Wu <bryan.wu@canonical.com>
Mon, 23 Jul 2012 23:52:34 +0000 (07:52 +0800)
commit5bb629c504394f4d42c53a25d75ccb02a393f92f
treec504fb776de83b95045d3274cd7bc82cee0bc983
parenteb202621f8c0fb264a35e1b35fc00bdb3114a897
leds: add oneshot blink functions

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.

(bryan.wu@canonical.com: rebase to commit 'leds: don't disable blinking
when writing the same value to delay_on or delay_off')

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Acked-by: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
drivers/leds/led-class.c
drivers/leds/led-core.c
drivers/leds/led-triggers.c
include/linux/leds.h