Skip to content

Commit 781589e

Browse files
groeckalexandrebelloni
authored andcommitted
rtc: Add support for limited alarm timer offsets
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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent f45d32d commit 781589e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/rtc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ struct rtc_device {
146146

147147
time64_t range_min;
148148
timeu64_t range_max;
149+
timeu64_t alarm_offset_max;
149150
time64_t start_secs;
150151
time64_t offset_secs;
151152
bool set_start_time;

0 commit comments

Comments
 (0)