summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/pm.c
diff options
context:
space:
mode:
authorBitan Biswas <bbiswas@nvidia.com>2012-01-25 15:24:30 +0530
committerVarun Colbert <vcolbert@nvidia.com>2012-01-30 13:21:11 -0800
commit3d4a6ee914dd777ce2b45259d02e7be360a6c3e9 (patch)
tree49422bdb6823e44fa07b66444c6978789dbb7208 /arch/arm/mach-tegra/pm.c
parent1b4416a47933312bf69f1ec945a759fef75f2da9 (diff)
arm: tegra: power: disable SUSPEND_NONE mode selection
sysfs interface to select suspend mode as TEGRA_SUSPEND_NONE is disabled. Additionally, if tegra_suspend_dram is called with suspend mode as TEGRA_SUSPEND_NONE we return error bug 927937 Reviewed-on: http://git-master/r/77268 Change-Id: Ifdd57cdf27e739a9c093cad4eddefb73a6a2355d Signed-off-by: Bitan Biswas <bbiswas@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/77757 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'arch/arm/mach-tegra/pm.c')
-rw-r--r--arch/arm/mach-tegra/pm.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 7c82a054328a..58aec4ff0f8d 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -763,6 +763,10 @@ static int tegra_suspend_enter(suspend_state_t state)
read_persistent_clock(&ts_entry);
ret = tegra_suspend_dram(current_suspend_mode, 0);
+ if (ret) {
+ pr_info("Aborting suspend, tegra_suspend_dram error=%d\n", ret);
+ goto abort_suspend;
+ }
read_persistent_clock(&ts_exit);
@@ -776,6 +780,7 @@ static int tegra_suspend_enter(suspend_state_t state)
tegra_dvfs_rail_pause(tegra_core_rail, delta, true);
}
+abort_suspend:
if (pdata && pdata->board_resume)
pdata->board_resume(current_suspend_mode, TEGRA_RESUME_AFTER_PERIPHERAL);
@@ -810,7 +815,13 @@ static void tegra_suspend_check_pwr_stats(void)
int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
{
- BUG_ON(mode < 0 || mode >= TEGRA_MAX_SUSPEND_MODE);
+ int err = 0;
+
+ if (WARN_ON(mode <= TEGRA_SUSPEND_NONE ||
+ mode >= TEGRA_MAX_SUSPEND_MODE)) {
+ err = -ENXIO;
+ goto fail;
+ }
if ((mode == TEGRA_SUSPEND_LP0) && !tegra_pm_irq_lp0_allowed()) {
pr_info("LP0 not used due to unsupported wakeup events\n");
@@ -892,7 +903,8 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
tegra_common_resume();
- return 0;
+fail:
+ return err;
}
/*
@@ -950,6 +962,11 @@ static ssize_t suspend_mode_store(struct kobject *kobj,
len = name_ptr - buf;
if (!len)
goto bad_name;
+ /* TEGRA_SUSPEND_NONE not allowed as suspend state */
+ if (!(strncmp(buf, tegra_suspend_name[TEGRA_SUSPEND_NONE], len))) {
+ pr_info("Illegal tegra suspend state: %s\n", buf);
+ goto bad_name;
+ }
for (new_mode = TEGRA_SUSPEND_NONE; \
new_mode < TEGRA_MAX_SUSPEND_MODE; ++new_mode) {