summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Williams <scwilliams@nvidia.com>2011-07-18 14:19:07 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2012-03-22 23:26:46 -0700
commit0d6e676a06791b1bfc67c8d5a157f6763ed6e756 (patch)
treea2beb5d251c5cfe64279f272b391ecab2a5a2b79
parentb908018a3c7f93b866dfed3c8ecd624ecb039af1 (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
-rw-r--r--arch/arm/mach-tegra/Makefile2
-rw-r--r--arch/arm/mach-tegra/cpuidle.c27
-rw-r--r--arch/arm/mach-tegra/cpuidle.h3
-rw-r--r--arch/arm/mach-tegra/pm.c15
4 files changed, 33 insertions, 14 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 7aa8ef40f45b..739c5d1fcb86 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -59,8 +59,10 @@ obj-$(CONFIG_TEGRA_PCI) += pcie.o
obj-$(CONFIG_USB_SUPPORT) += usb_phy.o
ifeq ($(CONFIG_CPU_IDLE),y)
obj-y += cpuidle.o
+ifeq ($(CONFIG_PM_SLEEP),y)
obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += cpuidle-t2.o
endif
+endif
obj-$(CONFIG_TEGRA_IOVMM) += iovmm.o
obj-$(CONFIG_TEGRA_IOVMM_GART) += iovmm-gart.o
obj-$(CONFIG_TEGRA_IOVMM_SMMU) += iovmm-smmu.o
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);
diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h
index f3f80ad05ba0..c0fbb45a0f38 100644
--- a/arch/arm/mach-tegra/cpuidle.h
+++ b/arch/arm/mach-tegra/cpuidle.h
@@ -21,6 +21,8 @@
#include <linux/cpuidle.h>
+#ifdef CONFIG_PM_SLEEP
+
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
void tegra2_idle_lp2(struct cpuidle_device *dev, struct cpuidle_state *state);
void tegra2_cpu_idle_stats_lp2_ready(unsigned int cpu);
@@ -66,5 +68,6 @@ void tegra_lp2_in_idle(bool enable);
#else
static inline void tegra_lp2_in_idle(bool enable) {}
#endif
+#endif /* CONFIG_PM_SLEEP */
#endif
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 0355a14a0e40..29911e70b557 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -862,19 +862,18 @@ void __init tegra_init_suspend(struct tegra_suspend_platform_data *plat)
pr_err("%s: sysfs_create_file suspend type failed!\n",
__func__);
}
-#else
- if ((plat->suspend_mode == TEGRA_SUSPEND_LP0) ||
- (plat->suspend_mode == TEGRA_SUSPEND_LP1)) {
- pr_warning("%s: Suspend mode LP0 or LP1 requires "
- "CONFIG_PM_SLEEP -- limiting to LP2\n", __func__);
- plat->suspend_mode = TEGRA_SUSPEND_LP2;
- }
-#endif
#ifdef CONFIG_CPU_IDLE
if (plat->suspend_mode == TEGRA_SUSPEND_NONE)
tegra_lp2_in_idle(false);
#endif
+#else
+ if (plat->suspend_mode != TEGRA_SUSPEND_NONE) {
+ pr_warning("%s: Suspend requires CONFIG_PM_SLEEP -- "
+ "disabling suspend\n", __func__);
+ plat->suspend_mode = TEGRA_SUSPEND_NONE;
+ }
+#endif
current_suspend_mode = plat->suspend_mode;
}