cpuidle: lpm-levels: Reorganize code to calculate next wakeup
Add new inline function to calculate next wakeup. Change-Id: Iaa17563597cf794966cc0e89159a1d8b257fa6dd Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
parent
bc904ccd88
commit
763cf29b05
@ -636,6 +636,21 @@ out:
|
||||
return false;
|
||||
}
|
||||
|
||||
static void calculate_next_wakeup(uint32_t *next_wakeup_us,
|
||||
uint32_t next_event_us,
|
||||
uint32_t lvl_latency_us,
|
||||
s64 sleep_us)
|
||||
{
|
||||
if (!next_event_us)
|
||||
return;
|
||||
|
||||
if (next_event_us < lvl_latency_us)
|
||||
return;
|
||||
|
||||
if (next_event_us < sleep_us)
|
||||
*next_wakeup_us = next_event_us - lvl_latency_us;
|
||||
}
|
||||
|
||||
static int cpu_power_select(struct cpuidle_device *dev,
|
||||
struct lpm_cpu *cpu)
|
||||
{
|
||||
@ -672,13 +687,8 @@ static int cpu_power_select(struct cpuidle_device *dev,
|
||||
if (latency_us < lvl_latency_us)
|
||||
break;
|
||||
|
||||
if (next_event_us) {
|
||||
if (next_event_us < lvl_latency_us)
|
||||
break;
|
||||
|
||||
if (next_event_us < sleep_us)
|
||||
next_wakeup_us = next_event_us - lvl_latency_us;
|
||||
}
|
||||
calculate_next_wakeup(&next_wakeup_us, next_event_us,
|
||||
lvl_latency_us, sleep_us);
|
||||
|
||||
if (!i && !cpu_isolated(dev->cpu)) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user