diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-07-22 13:21:08 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 00:55:34 -0700 |
commit | ab3c2af8f38788e7684c186638adf7d717a8c2d5 (patch) | |
tree | 52ba94a7eb99d5c47644adf5446889872382c3a8 /arch/arm/mach-tegra/cpuidle-t2.c | |
parent | e4d09771731680401df686ca070191397f235c30 (diff) |
ARM: tegra: Add LP2 exit latency correction
Change-Id: I37cb57f8674d8ddea3861fdc59543c3dfa8498db
Signed-off-by: Scott Williams <scwilliams@nvidia.com>
DW: Split into logical changes
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Rebase-Id: R0a1d0c79e22f9191bde70b8b05541c5bfe26f4df
Diffstat (limited to 'arch/arm/mach-tegra/cpuidle-t2.c')
-rw-r--r-- | arch/arm/mach-tegra/cpuidle-t2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/cpuidle-t2.c b/arch/arm/mach-tegra/cpuidle-t2.c index aa32014b53df..948e6a42348a 100644 --- a/arch/arm/mach-tegra/cpuidle-t2.c +++ b/arch/arm/mach-tegra/cpuidle-t2.c @@ -154,6 +154,7 @@ static int tegra2_idle_lp2_last(struct cpuidle_device *dev, ktime_t entry_time; ktime_t exit_time; bool sleep_completed = false; + s64 sleep_time; int i; while (tegra2_cpu_is_resettable_soon()) @@ -170,7 +171,9 @@ static int tegra2_idle_lp2_last(struct cpuidle_device *dev, entry_time = ktime_get(); - if (tegra_idle_lp2_last(request, 0) == 0) + sleep_time = request - tegra_lp2_exit_latency; + + if (tegra_idle_lp2_last(sleep_time, 0) == 0) sleep_completed = true; else idle_stats.lp2_int_count[tegra_pending_interrupt()]++; @@ -185,10 +188,15 @@ static int tegra2_idle_lp2_last(struct cpuidle_device *dev, exit_time = ktime_get(); if (sleep_completed) { /* - * Stayed in LP2 for the full time until the next tick + * Stayed in LP2 for the full time until the next tick, + * adjust the exit latency based on measurement */ s64 actual_time = ktime_to_us(ktime_sub(exit_time, entry_time)); long offset = (long)(actual_time - request); + int latency = tegra_lp2_exit_latency + offset / 16; + latency = clamp(latency, 0, 10000); + tegra_lp2_exit_latency = latency; + smp_wmb(); pr_debug("%lld %lld %ld\n", request, actual_time, offset); |