diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-07-19 14:34:41 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2012-03-22 23:27:08 -0700 |
commit | 46bc1af654e8997d6741da6261d2304187479c5f (patch) | |
tree | 246fb86a597ce5b2f6655f4fddf35d23038f32c2 /arch/arm/mach-tegra/cpuidle.c | |
parent | 4f6513bbca6957edf5fd9204f899e1d57bb79f49 (diff) |
ARM: tegra: power: Disallow LP2 in idle if permanently disabled
For a variety of reasons, it is possible that LP2 in idle can never
be allowed. If one of these conditions exists, do not allow LP2 in
idle to be re-enabled via the module_param interface.
Change-Id: I980f147844ad9374c218bfb2a25c0d91dad85281
Signed-off-by: Scott Williams <scwilliams@nvidia.com>
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Rebase-Id: Rb897f6dc8245e525fd9ac90c9243e290307c4e58
Diffstat (limited to 'arch/arm/mach-tegra/cpuidle.c')
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index fbcd4a66bf28..820eba972a1b 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c @@ -45,9 +45,47 @@ #include "sleep.h" #ifdef CONFIG_PM_SLEEP -static bool lp2_in_idle __read_mostly = true; -module_param(lp2_in_idle, bool, 0644); 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; @@ -81,13 +119,6 @@ static int tegra_idle_enter_lp3(struct cpuidle_device *dev, return (int)us; } -void tegra_lp2_in_idle(bool enable) -{ -#ifdef CONFIG_PM_SLEEP - lp2_in_idle = enable; -#endif -} - #ifdef CONFIG_PM_SLEEP static int tegra_idle_enter_lp2(struct cpuidle_device *dev, struct cpuidle_state *state) |