ARM: tegra: power: move cluster switch to syscore for LP0
Jin Qian [Thu, 1 Sep 2011 02:47:26 +0000 (19:47 -0700)]
move printk as well since they rely on uart resume in syscore

Bug 862504

Change-Id: Iad62c87dbb01d07bf731babb62cb480d62b9402e
Reviewed-on: http://git-master/r/50240
Reviewed-by: Jin Qian <jqian@nvidia.com>
Tested-by: Jin Qian <jqian@nvidia.com>
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>

Rebase-Id: R8c5b23f5045260160a4906da425cc297fae5b59b

arch/arm/mach-tegra/pm.c

index 57fcf55..7e17902 100644 (file)
@@ -760,8 +760,6 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 
        tegra_common_suspend();
 
-       pr_info("Entering suspend state %s\n", lp_state[mode]);
-
        tegra_pm_set(mode);
 
        if (pdata && pdata->board_suspend)
@@ -773,7 +771,6 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
        cpu_cluster_pm_enter();
 
        if (mode == TEGRA_SUSPEND_LP0) {
-               tegra_lp0_cpu_mode(true);
                tegra_lp0_suspend_mc();
                tegra_cpu_reset_handler_save();
        }
@@ -797,7 +794,6 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
        if (mode == TEGRA_SUSPEND_LP0) {
                tegra_cpu_reset_handler_restore();
                tegra_lp0_resume_mc();
-               tegra_lp0_cpu_mode(false);
        } else if (mode == TEGRA_SUSPEND_LP1)
                *iram_cpu_lp1_mask = 0;
 
@@ -813,8 +809,6 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 
        tegra_common_resume();
 
-       pr_info("Exited suspend state %s\n", lp_state[mode]);
-
        return 0;
 }
 
@@ -892,6 +886,33 @@ static struct kobj_attribute suspend_mode_attribute =
 static struct kobject *suspend_kobj;
 #endif
 
+static int tegra_pm_enter_suspend(void)
+{
+       pr_info("Entering suspend state %s\n", lp_state[current_suspend_mode]);
+       if (current_suspend_mode == TEGRA_SUSPEND_LP0)
+               tegra_lp0_cpu_mode(true);
+       return 0;
+}
+
+static void tegra_pm_enter_resume(void)
+{
+       if (current_suspend_mode == TEGRA_SUSPEND_LP0)
+               tegra_lp0_cpu_mode(false);
+       pr_info("Exited suspend state %s\n", lp_state[current_suspend_mode]);
+}
+
+static struct syscore_ops tegra_pm_enter_syscore_ops = {
+       .suspend = tegra_pm_enter_suspend,
+       .resume = tegra_pm_enter_resume,
+};
+
+static __init int tegra_pm_enter_syscore_init(void)
+{
+       register_syscore_ops(&tegra_pm_enter_syscore_ops);
+       return 0;
+}
+subsys_initcall(tegra_pm_enter_syscore_init);
+
 void __init tegra_init_suspend(struct tegra_suspend_platform_data *plat)
 {
        u32 reg;