• Todd Poynor's avatar
    alarmtimer: Implement minimum alarm interval for allowing suspend · 59a93c27
    Todd Poynor authored
    alarmtimer suspend return -EBUSY if the next alarm will fire in less
    than 2 seconds.  This allows one RTC seconds tick to occur subsequent
    to this check before the alarm wakeup time is set, ensuring the wakeup
    time is still in the future (assuming the RTC does not tick one more
    second prior to setting the alarm).
    
    If suspend is rejected due to an imminent alarm, hold a wakeup source
    for 2 seconds to process the alarm prior to reattempting suspend.
    
    If setting the alarm incurs an -ETIME for an alarm set in the past,
    or any other problem setting the alarm, abort suspend and hold a
    wakelock for 1 second while the alarm is allowed to be serviced or
    other hopefully transient conditions preventing the alarm clear up.
    Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    59a93c27
alarmtimer.c 20.3 KB