Commit 891e1286 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Thierry Reding

ARM: tegra: Propagate error from tegra_idle_lp2_last()

Technically cpu_suspend() may fail and it's never good to lose information
about failure. For example things like cpuidle core could correctly sample
idling time in the case of failure.
Acked-by: default avatarPeter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: default avatarPeter Geis <pgwipeout@gmail.com>
Tested-by: default avatarJasper Korten <jja2000@gmail.com>
Tested-by: default avatarDavid Heidelberg <david@ixit.cz>
Tested-by: default avatarNicolas Chauvet <kwizart@gmail.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent f5619492
...@@ -86,15 +86,17 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev, ...@@ -86,15 +86,17 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
struct cpuidle_driver *drv, struct cpuidle_driver *drv,
int index) int index)
{ {
bool ret;
while (!tegra_cpu_rail_off_ready()) while (!tegra_cpu_rail_off_ready())
cpu_relax(); cpu_relax();
tegra_idle_lp2_last(); ret = !tegra_idle_lp2_last();
if (cpu_online(1)) if (cpu_online(1))
tegra20_wake_cpu1_from_reset(); tegra20_wake_cpu1_from_reset();
return true; return ret;
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -68,9 +68,7 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev, ...@@ -68,9 +68,7 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
return false; return false;
} }
tegra_idle_lp2_last(); return !tegra_idle_lp2_last();
return true;
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -189,14 +189,16 @@ static void tegra_pm_set(enum tegra_suspend_mode mode) ...@@ -189,14 +189,16 @@ static void tegra_pm_set(enum tegra_suspend_mode mode)
tegra_pmc_enter_suspend_mode(mode); tegra_pmc_enter_suspend_mode(mode);
} }
void tegra_idle_lp2_last(void) int tegra_idle_lp2_last(void)
{ {
int err;
tegra_pm_set(TEGRA_SUSPEND_LP2); tegra_pm_set(TEGRA_SUSPEND_LP2);
cpu_cluster_pm_enter(); cpu_cluster_pm_enter();
suspend_cpu_complex(); suspend_cpu_complex();
cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu); err = cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
/* /*
* Resume L2 cache if it wasn't re-enabled early during resume, * Resume L2 cache if it wasn't re-enabled early during resume,
...@@ -208,6 +210,8 @@ void tegra_idle_lp2_last(void) ...@@ -208,6 +210,8 @@ void tegra_idle_lp2_last(void)
restore_cpu_complex(); restore_cpu_complex();
cpu_cluster_pm_exit(); cpu_cluster_pm_exit();
return err;
} }
enum tegra_suspend_mode tegra_pm_validate_suspend_mode( enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
......
...@@ -25,7 +25,7 @@ void tegra30_sleep_core_init(void); ...@@ -25,7 +25,7 @@ void tegra30_sleep_core_init(void);
void tegra_clear_cpu_in_lp2(void); void tegra_clear_cpu_in_lp2(void);
void tegra_set_cpu_in_lp2(void); void tegra_set_cpu_in_lp2(void);
void tegra_idle_lp2_last(void); int tegra_idle_lp2_last(void);
extern void (*tegra_tear_down_cpu)(void); extern void (*tegra_tear_down_cpu)(void);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment