mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
timekeeping: Add suspend and resume of clock event devices
Some clock event devices, for example such that belong to PM domains, need to be handled in a spcial way during the timekeeping suspend and resume (which takes place in the system core, or "syscore", stages of system power transitions) in analogy with clock sources. Introduce .suspend() and .resume() callbacks for clock event devices that will be executed by timekeeping_suspend/_resume(), respectively, next the the clock sources' .suspend() and .resume() callbacks. Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
parent
77f827de07
commit
adc78e6b99
3 changed files with 34 additions and 0 deletions
|
|
@ -397,6 +397,30 @@ void clockevents_exchange_device(struct clock_event_device *old,
|
|||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* clockevents_suspend - suspend clock devices
|
||||
*/
|
||||
void clockevents_suspend(void)
|
||||
{
|
||||
struct clock_event_device *dev;
|
||||
|
||||
list_for_each_entry_reverse(dev, &clockevent_devices, list)
|
||||
if (dev->suspend)
|
||||
dev->suspend(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* clockevents_resume - resume clock devices
|
||||
*/
|
||||
void clockevents_resume(void)
|
||||
{
|
||||
struct clock_event_device *dev;
|
||||
|
||||
list_for_each_entry(dev, &clockevent_devices, list)
|
||||
if (dev->resume)
|
||||
dev->resume(dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_CLOCKEVENTS
|
||||
/**
|
||||
* clockevents_notify - notification about relevant events
|
||||
|
|
|
|||
|
|
@ -773,6 +773,7 @@ static void timekeeping_resume(void)
|
|||
|
||||
read_persistent_clock(&ts);
|
||||
|
||||
clockevents_resume();
|
||||
clocksource_resume();
|
||||
|
||||
write_seqlock_irqsave(&tk->lock, flags);
|
||||
|
|
@ -832,6 +833,7 @@ static int timekeeping_suspend(void)
|
|||
|
||||
clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
|
||||
clocksource_suspend();
|
||||
clockevents_suspend();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue