• Shuah Khan's avatar
    leds: add new transient trigger for one shot timer activation · 44e1e9f8
    Shuah Khan authored
    The leds timer trigger does not currently have an interface to activate a
    one shot timer.  The current support allows for setting two timers, one
    for specifying how long a state to be on, and the second for how long the
    state to be off.  The delay_on value specifies the time period an LED
    should stay in on state, followed by a delay_off value that specifies how
    long the LED should stay in off state.  The on and off cycle repeats until
    the trigger gets deactivated.  There is no provision for one time
    activation to implement features that require an on or off state to be
    held just once and then stay in the original state forever.
    Without one shot timer interface, user space can still use timer trigger
    to set a timer to hold a state, however when user space application
    crashes or goes away without deactivating the timer, the hardware will be
    left in that state permanently.
    As a specific example of this use-case, let's look at vibrate feature on
    phones.  Vibrate function on phones is implemented using PWM pins on SoC
    or PMIC.  There is a need to activate one shot timer to control the
    vibrate feature, to prevent user space crashes leaving the phone in
    vibrate mode permanently causing the battery to drain.
    This trigger exports three properties, activate, state, and duration When
    transient trigger is activated these properties are set to default values.
    - duration allows setting timer value in msecs. The initial value is 0.
    - activate allows activating and deactivating the timer specified by
      duration as needed. The initial and default value is 0.  This will allow
      duration to be set after trigger activation.
    - state allows user to specify a transient state to be held for the specified
    Signed-off-by: default avatarShuah Khan <shuahkhan@gmail.com>
    Cc: Jonas Bonn <jonas@southpole.se>
    Cc: Richard Purdie <rpurdie@rpsys.net>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Bryan Wu <bryan.wu@canonical.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
ledtrig-transient.txt 7.2 KB