diff options
author | Johannes Berg <johannes.berg@intel.com> | 2021-01-15 13:12:18 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2021-02-12 21:38:52 +0100 |
commit | dde8b58d512703d396e02427de1053b4d912aa42 (patch) | |
tree | 1536dfa429585580bdc252afb9bc0639d937d830 /arch/um/kernel/time.c | |
parent | bfc58e2b98e99737409cd9f4d86a79677c5b887c (diff) | |
download | linux-dde8b58d512703d396e02427de1053b4d912aa42.tar.gz linux-dde8b58d512703d396e02427de1053b4d912aa42.tar.bz2 linux-dde8b58d512703d396e02427de1053b4d912aa42.zip |
um: add a pseudo RTC
Add a pseudo RTC that simply is able to send an alarm signal
waking up the system at a given time in the future.
Since apparently timerfd_create() FDs don't support SIGIO, we
use the sigio-creating helper thread, which just learned to do
suspend/resume properly in the previous patch.
For time-travel mode, OTOH, just add an event at the specified
time in the future, and that's already sufficient to wake up
the system at that point in time since suspend will just be in
an "endless wait".
For s2idle support also call pm_system_wakeup().
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/kernel/time.c')
-rw-r--r-- | arch/um/kernel/time.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 8144406b6ea3..e0cdb9694fb8 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -321,6 +321,12 @@ static void time_travel_add_event(struct time_travel_event *e, __time_travel_add_event(e, time); } +void time_travel_add_event_rel(struct time_travel_event *e, + unsigned long long delay_ns) +{ + time_travel_add_event(e, time_travel_time + delay_ns); +} + void time_travel_periodic_timer(struct time_travel_event *e) { time_travel_add_event(&time_travel_timer_event, @@ -384,7 +390,7 @@ static void time_travel_deliver_event(struct time_travel_event *e) } } -static bool time_travel_del_event(struct time_travel_event *e) +bool time_travel_del_event(struct time_travel_event *e) { unsigned long flags; @@ -594,6 +600,8 @@ extern u64 time_travel_ext_req(u32 op, u64 time); /* these are empty macros so the struct/fn need not exist */ #define time_travel_add_event(e, time) do { } while (0) +/* externally not usable - redefine here so we can */ +#undef time_travel_del_event #define time_travel_del_event(e) do { } while (0) #endif |