summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2010-08-09 20:49:09 -0700
committerYu-Huan Hsu <yhsu@nvidia.com>2010-08-16 20:14:26 -0700
commit360578084a43ba8c8326be91800c7d4a165cfd8e (patch)
tree4e8f56959819d87f0dda63e94bb271efd46a9d85
parentca47d2a962f17700a1b4d99dd290c8caa69f33d5 (diff)
[ARM/tegra] timers: Updated timers on LP2 exit.
Moved hrtimer_peek_ahead_timers() call from LP3 entry to LP2 exit. The purpose of this call is to account for time spent in LP2. No need to do it on every LP3 entry. Also made sure that LP2 is entered only when scheduler tick is stopped. Bug 720021 (cherry picked from commit 44137c615f2942d37b18f51ab80356ec9dff9bbb) Change-Id: Ia63c3075778f2bc7ba465c386e80503b7c40a97f Reviewed-on: http://git-master.nvidia.com/r/5165 Tested-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: John David Moser <jmoser@nvidia.com> Tested-by: John David Moser <jmoser@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/cpuidle.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
index 812c97490b90..21cb35980a27 100644
--- a/arch/arm/mach-tegra/cpuidle.c
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -76,8 +76,6 @@ static int tegra_idle_enter_lp3(struct cpuidle_device *dev,
local_irq_disable();
smp_rmb();
- if (lp2_supported)
- hrtimer_peek_ahead_timers();
enter = ktime_get();
if (!need_resched()) {
@@ -103,13 +101,14 @@ static int tegra_idle_enter_lp2(struct cpuidle_device *dev,
{
ktime_t enter;
s64 request, us, latency, idle_us;
+ struct tick_sched *ts = tick_get_tick_sched(dev->cpu);
unsigned int last_sample = (unsigned int)cpuidle_get_statedata(state);
/* LP2 not possible when running in SMP mode */
smp_rmb();
idle_us = state->exit_latency + state->target_residency;
request = ktime_to_us(tick_nohz_get_sleep_length());
- if (!lp2_supported || request <= idle_us ||
+ if (!lp2_supported || request <= idle_us || (!ts->tick_stopped) ||
system_is_suspending || (!tegra_nvrm_lp2_allowed())) {
dev->last_state = &dev->states[0];
return tegra_idle_enter_lp3(dev, &dev->states[0]);
@@ -127,6 +126,9 @@ static int tegra_idle_enter_lp2(struct cpuidle_device *dev,
state->target_residency = (latency_factor*state->exit_latency) >>
LATENCY_FACTOR_SHIFT;
+ /* adjust kernel timers */
+ hrtimer_peek_ahead_timers();
+
local_irq_enable();
return (int)idle_us;
}