diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-07-29 17:45:21 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:47:00 -0800 |
commit | dc5482ee2f76e9d282c461b002deb5051d98f1cb (patch) | |
tree | 38b8d0d3f66defaf4d1287c255c0b2ad757106ad /arch/arm/mach-tegra/cpuidle.c | |
parent | 3f487ed69f84809548a052cc61b84b11c4f83c1e (diff) |
ARM: tegra: power: Reorganize CPU idle code
Change-Id: I57653997b7dc059f74e0722b9ea298f3d8a38095
Signed-off-by: Scott Williams <scwilliams@nvidia.com>
Rebase-Id: Rc8638db0a47faf6fe25976375542fb6eb6326c4c
Diffstat (limited to 'arch/arm/mach-tegra/cpuidle.c')
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.c | 91 |
1 files changed, 47 insertions, 44 deletions
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index 73ed6d4e3a2f..af4d09d52206 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c @@ -44,52 +44,8 @@ #include "pm.h" #include "sleep.h" -#ifdef CONFIG_PM_SLEEP -static bool lp2_disabled_by_suspend; -static bool lp2_in_idle __read_mostly = true; -static bool lp2_in_idle_modifiable __read_mostly = true; - -void tegra_lp2_in_idle(bool enable) -{ -#ifdef CONFIG_PM_SLEEP - /* If LP2 in idle is permanently disabled it can't be re-enabled. */ - if (lp2_in_idle_modifiable) { - lp2_in_idle = enable; - lp2_in_idle_modifiable = enable; - if (!enable) - pr_warn("LP2 in idle disabled\n"); - } -#endif -} - -static int lp2_in_idle_set(const char *arg, const struct kernel_param *kp) -{ -#ifdef CONFIG_PM_SLEEP - int ret; - - /* If LP2 in idle is permanently disabled it can't be re-enabled. */ - if (lp2_in_idle_modifiable) { - ret = param_set_bool(arg, kp); - return ret; - } -#endif - return -ENODEV; -} - -static int lp2_in_idle_get(char *buffer, const struct kernel_param *kp) -{ - return param_get_bool(buffer, kp); -} - -static struct kernel_param_ops lp2_in_idle_ops = { - .set = lp2_in_idle_set, - .get = lp2_in_idle_get, -}; -module_param_cb(lp2_in_idle, &lp2_in_idle_ops, &lp2_in_idle, 0644); - int tegra_lp2_exit_latency; static unsigned int tegra_lp2_min_residency; -#endif struct cpuidle_driver tegra_idle = { .name = "tegra_idle", @@ -120,6 +76,28 @@ static int tegra_idle_enter_lp3(struct cpuidle_device *dev, } #ifdef CONFIG_PM_SLEEP +#define LP2_IN_IDLE_INIT true +#else +#define LP2_IN_IDLE_INIT false +#endif + +static bool lp2_in_idle __read_mostly = LP2_IN_IDLE_INIT; + +#ifdef CONFIG_PM_SLEEP +static bool lp2_in_idle_modifiable __read_mostly = true; +static bool lp2_disabled_by_suspend; + +void tegra_lp2_in_idle(bool enable) +{ + /* If LP2 in idle is permanently disabled it can't be re-enabled. */ + if (lp2_in_idle_modifiable) { + lp2_in_idle = enable; + lp2_in_idle_modifiable = enable; + if (!enable) + pr_warn("LP2 in idle disabled\n"); + } +} + static int tegra_idle_enter_lp2(struct cpuidle_device *dev, struct cpuidle_state *state) { @@ -274,6 +252,31 @@ static void __exit tegra_cpuidle_exit(void) module_init(tegra_cpuidle_init); module_exit(tegra_cpuidle_exit); +static int lp2_in_idle_set(const char *arg, const struct kernel_param *kp) +{ +#ifdef CONFIG_PM_SLEEP + int ret; + + /* If LP2 in idle is permanently disabled it can't be re-enabled. */ + if (lp2_in_idle_modifiable) { + ret = param_set_bool(arg, kp); + return ret; + } +#endif + return -ENODEV; +} + +static int lp2_in_idle_get(char *buffer, const struct kernel_param *kp) +{ + return param_get_bool(buffer, kp); +} + +static struct kernel_param_ops lp2_in_idle_ops = { + .set = lp2_in_idle_set, + .get = lp2_in_idle_get, +}; +module_param_cb(lp2_in_idle, &lp2_in_idle_ops, &lp2_in_idle, 0644); + #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_PM_SLEEP) static int tegra_lp2_debug_open(struct inode *inode, struct file *file) { |