diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-07-18 14:19:07 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2012-03-22 23:26:46 -0700 |
commit | 0d6e676a06791b1bfc67c8d5a157f6763ed6e756 (patch) | |
tree | a2beb5d251c5cfe64279f272b391ecab2a5a2b79 /arch/arm/mach-tegra/cpuidle.c | |
parent | b908018a3c7f93b866dfed3c8ecd624ecb039af1 (diff) |
ARM: tegra: Make LP2 require CONFIG_PM_SLEEP
Change-Id: Iaaf96375eaf7408f5bedc4196d33a04fb94129ef
Signed-off-by: Scott Williams <scwilliams@nvidia.com>
DW: Split into logical changes
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Rebase-Id: R98567e0d894acbdac770b191f7e46f16592d5d0b
Diffstat (limited to 'arch/arm/mach-tegra/cpuidle.c')
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index 6f70bf3e014b..d1061fb850ef 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c @@ -44,11 +44,13 @@ #include "pm.h" #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 unsigned int tegra_lp2_min_residency; +#endif struct cpuidle_driver tegra_idle = { .name = "tegra_idle", @@ -57,11 +59,6 @@ struct cpuidle_driver tegra_idle = { static DEFINE_PER_CPU(struct cpuidle_device *, idle_devices); -void tegra_lp2_in_idle(bool enable) -{ - lp2_in_idle = enable; -} - static inline unsigned int time_to_bin(unsigned int time) { return fls(time); @@ -88,6 +85,14 @@ 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) { @@ -122,13 +127,16 @@ static int tegra_idle_enter_lp2(struct cpuidle_device *dev, return (int)us; } +#endif static int tegra_idle_prepare(struct cpuidle_device *dev) { +#ifdef CONFIG_PM_SLEEP if (lp2_in_idle) dev->states[1].flags &= ~CPUIDLE_FLAG_IGNORE; else dev->states[1].flags |= CPUIDLE_FLAG_IGNORE; +#endif return 0; } @@ -156,6 +164,7 @@ static int tegra_cpuidle_register_device(unsigned int cpu) dev->safe_state = state; dev->state_count++; +#ifdef CONFIG_PM_SLEEP state = &dev->states[1]; snprintf(state->name, CPUIDLE_NAME_LEN, "LP2"); snprintf(state->desc, CPUIDLE_DESC_LEN, "CPU power-gate"); @@ -172,6 +181,8 @@ static int tegra_cpuidle_register_device(unsigned int cpu) dev->power_specified = 1; dev->safe_state = state; dev->state_count++; +#endif + dev->prepare = tegra_idle_prepare; if (cpuidle_register_device(dev)) { @@ -186,10 +197,12 @@ static int tegra_cpuidle_register_device(unsigned int cpu) static int tegra_cpuidle_pm_notify(struct notifier_block *nb, unsigned long event, void *dummy) { +#ifdef CONFIG_PM_SLEEP if (event == PM_SUSPEND_PREPARE) lp2_disabled_by_suspend = true; else if (event == PM_POST_SUSPEND) lp2_disabled_by_suspend = false; +#endif return NOTIFY_OK; } @@ -207,8 +220,10 @@ static int __init tegra_cpuidle_init(void) if (ret) return ret; +#ifdef CONFIG_PM_SLEEP /* !!!FIXME!!! Add tegra_lp2_power_off_time */ tegra_lp2_min_residency = tegra_cpu_lp2_min_residency(); +#endif for_each_possible_cpu(cpu) { if (tegra_cpuidle_register_device(cpu)) @@ -228,7 +243,7 @@ static void __exit tegra_cpuidle_exit(void) module_init(tegra_cpuidle_init); module_exit(tegra_cpuidle_exit); -#ifdef CONFIG_DEBUG_FS +#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_PM_SLEEP) static int tegra_lp2_debug_open(struct inode *inode, struct file *file) { return single_open(file, tegra_lp2_debug_show, inode->i_private); |