• Guenter Roeck's avatar
    rtc: Add support for limited alarm timer offsets · 781589e4
    Guenter Roeck authored
    Some alarm timers are based on time offsets, not on absolute times.
    In some situations, the amount of time that can be scheduled in the
    future is limited. This may result in a refusal to suspend the system,
    causing substantial battery drain.
    
    Some RTC alarm drivers remedy the situation by setting the alarm time
    to the maximum supported time if a request for an out-of-range timeout
    is made. This is not really desirable since it may result in unexpected
    early wakeups.
    
    To reduce the impact of this problem, let RTC drivers report the maximum
    supported alarm timer offset. The code setting alarm timers can then
    decide if it wants to reject setting alarm timers to a larger value, if it
    wants to implement recurring alarms until the actually requested alarm
    time is met, or if it wants to accept the limited alarm time.
    
    Only introduce the necessary variable into struct rtc_device.
    Code to set and use the variable will follow with subsequent patches.
    
    Cc: Brian Norris <briannorris@chromium.org>
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20230817225537.4053865-2-linux@roeck-us.netSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
    781589e4
rtc.h 8.76 KB