ARM: tegra: power: Boost CPU rate before device resume
Alex Frid [Tue, 28 Feb 2012 21:52:58 +0000 (13:52 -0800)]
Boost CPU frequency in tegra platform resume finish phase, just
before driver resume. Boost level is specified by platform suspend
data (ignored if 0).

Bug 946301

Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit eaedf228861e4456454ca13f0958ed97e799fc59)

Change-Id: Ica0cff28f9651e38787ec98f54563d95d876d79e
Reviewed-on: http://git-master/r/89353
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R6fb2c94bac7079a35224ed5b2d81b98babb60dca

arch/arm/mach-tegra/cpu-tegra.c
arch/arm/mach-tegra/cpu-tegra.h
arch/arm/mach-tegra/pm.c
arch/arm/mach-tegra/pm.h

index 9e73052..d0bb8b9 100644 (file)
@@ -578,6 +578,20 @@ int tegra_cpu_set_speed_cap(unsigned int *speed_cap)
        return ret;
 }
 
+int tegra_suspended_target(unsigned int target_freq)
+{
+       unsigned int new_speed = target_freq;
+
+       if (!is_suspended)
+               return -EBUSY;
+
+       /* apply only "hard" caps */
+       new_speed = tegra_throttle_governor_speed(new_speed);
+       new_speed = edp_governor_speed(new_speed);
+
+       return tegra_update_cpu_speed(new_speed);
+}
+
 static int tegra_target(struct cpufreq_policy *policy,
                       unsigned int target_freq,
                       unsigned int relation)
index 348d138..b1a5b40 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/cpu-tegra.h
  *
- * Copyright (c) 2011, NVIDIA Corporation.
+ * Copyright (c) 2011-2012, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -73,4 +73,11 @@ static inline bool tegra_cpu_edp_favor_down(unsigned int n, int mp_overhead)
 { return false; }
 #endif
 
+#ifdef CONFIG_CPU_FREQ
+int tegra_suspended_target(unsigned int target_freq);
+#else
+static inline int tegra_suspended_target(unsigned int target_freq)
+{ return -ENOSYS; }
+#endif
+
 #endif /* __MACH_TEGRA_CPU_TEGRA_H */
index 1d4e2cb..3ae25e4 100644 (file)
@@ -69,6 +69,7 @@
 #include "sleep.h"
 #include "timer.h"
 #include "dvfs.h"
+#include "cpu-tegra.h"
 
 struct suspend_context {
        /*
@@ -920,6 +921,12 @@ static int tegra_suspend_prepare(void)
 
 static void tegra_suspend_finish(void)
 {
+       if (pdata && pdata->cpu_resume_boost) {
+               int ret = tegra_suspended_target(pdata->cpu_resume_boost);
+               pr_info("Tegra: resume CPU boost to %u KHz: %s (%d)\n",
+                       pdata->cpu_resume_boost, ret ? "Failed" : "OK", ret);
+       }
+
        if ((current_suspend_mode == TEGRA_SUSPEND_LP0) && tegra_deep_sleep)
                tegra_deep_sleep(0);
 }
index 2ad25d8..a71092d 100644 (file)
@@ -2,7 +2,7 @@
  * arch/arm/mach-tegra/include/mach/pm.h
  *
  * Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010-2011 NVIDIA Corporation
+ * Copyright (C) 2010-2012 NVIDIA Corporation
  *
  * Author:
  *     Colin Cross <ccross@google.com>
@@ -64,6 +64,7 @@ struct tegra_suspend_platform_data {
        void (*board_suspend)(int lp_state, enum suspend_stage stg);
        /* lp_state = 0 for LP0 state, 1 for LP1 state, 2 for LP2 state */
        void (*board_resume)(int lp_state, enum resume_stage stg);
+       unsigned int cpu_resume_boost;  /* CPU frequency resume boost in kHz */
 };
 
 /* Tegra io dpd entry - for each supported driver */