summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Gaikwad <pgaikwad@nvidia.com>2011-12-14 16:55:32 +0530
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-22 11:32:26 +0530
commit1a24e0399b3011d25ac3448cead470947db63202 (patch)
tree4512a235281f49c49575133b8fd6344b601406de
parent2dbf0713ce5f4925c1d0021190e065da127f8f73 (diff)
ARM: tegra2: power: Fix LP2/LP3 states accounting
Made sure LP3 state is reported as last entered state to cpuidle governor in case when LP3 is entered as a fall back from LP2 path. bug 905813 Change-Id: I850dddef733d45587875eb796e609b01b1732ab9 Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com> Reviewed-on: http://git-master/r/70012 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User
-rw-r--r--arch/arm/mach-tegra/cpuidle-t2.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/arch/arm/mach-tegra/cpuidle-t2.c b/arch/arm/mach-tegra/cpuidle-t2.c
index 8fc935d7f54f..e5ff7c61f24c 100644
--- a/arch/arm/mach-tegra/cpuidle-t2.c
+++ b/arch/arm/mach-tegra/cpuidle-t2.c
@@ -173,6 +173,15 @@ bool tegra2_lp2_is_allowed(struct cpuidle_device *dev,
return true;
}
+static inline void tegra2_lp3_fall_back(struct cpuidle_device *dev)
+{
+ /* Not enough time left to enter LP2 */
+ tegra_cpu_wfi();
+
+ /* fall back here from LP2 path - tell cpuidle governor */
+ dev->last_state = &dev->states[0];
+}
+
static int tegra2_idle_lp2_cpu_0(struct cpuidle_device *dev,
struct cpuidle_state *state, s64 request)
{
@@ -187,13 +196,12 @@ static int tegra2_idle_lp2_cpu_0(struct cpuidle_device *dev,
cpu_relax();
if (tegra2_reset_other_cpus(dev->cpu))
- return -EBUSY;
+ return 0;
idle_stats.both_idle_count++;
if (request < state->target_residency) {
- /* Not enough time left to enter LP2 */
- tegra_cpu_wfi();
+ tegra2_lp3_fall_back(dev);
return -EBUSY;
}
@@ -269,11 +277,8 @@ static void tegra2_idle_lp2_cpu_1(struct cpuidle_device *dev,
struct tegra_twd_context twd_context;
if (request < tegra_lp2_exit_latency) {
- /*
- * Not enough time left to enter LP2
- */
tegra2_cpu_clear_resettable();
- tegra_cpu_wfi();
+ tegra2_lp3_fall_back(dev);
return;
}
@@ -314,8 +319,9 @@ void tegra2_idle_lp2(struct cpuidle_device *dev,
tegra2_wake_reset_cpu(i);
}
}
- } else
- tegra_cpu_wfi();
+ } else {
+ tegra2_lp3_fall_back(dev);
+ }
} else {
BUG_ON(last_cpu);
tegra2_idle_lp2_cpu_1(dev, state, request);