arm: tegra: Console suspend for all boards
Laxman Dewangan [Mon, 18 Jul 2011 06:17:13 +0000 (11:17 +0530)]
Added the board level suspend/resume and call the console
suspend from board level suspend/resume.

bug 820536

Original-Change-Id: I246265241246dc0682870571c927bd23023e5aca
Reviewed-on: http://git-master/r/41448
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Narendra Damahe <ndamahe@nvidia.com>

Rebase-Id: Re1f3dd4f75ee05456899d9a67f74ae84f9572654

arch/arm/mach-tegra/board-cardhu-power.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-cardhu.h
arch/arm/mach-tegra/board-enterprise-power.c
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-ventana-power.c
arch/arm/mach-tegra/board-ventana.c
arch/arm/mach-tegra/pm.c
arch/arm/mach-tegra/pm.h

index 051ace4..b16447a 100644 (file)
@@ -902,13 +902,13 @@ int __init cardhu_gpio_switch_regulator_init(void)
 static void cardhu_board_suspend(int lp_state, enum suspend_stage stg)
 {
        if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_SUSPEND_BEFORE_CPU))
-               cardhu_debug_uart_suspend();
+               tegra_console_uart_suspend();
 }
 
 static void cardhu_board_resume(int lp_state, enum resume_stage stg)
 {
        if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_RESUME_AFTER_CPU))
-               cardhu_debug_uart_resume();
+               tegra_console_uart_resume();
 }
 
 static struct tegra_suspend_platform_data cardhu_suspend_data = {
index b285a38..924a94a 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/spi/spi.h>
 #include <linux/i2c/atmel_mxt_ts.h>
 #include <linux/tegra_uart.h>
-#include <linux/console.h>
 
 #include <sound/wm8903.h>
 
@@ -277,7 +276,6 @@ static struct uart_clk_parent uart_parent_clk[] = {
        [2] = {.name = "clk_m"},
 };
 
-static struct clk *debug_uart_clk;
 static struct tegra_uart_platform_data cardhu_uart_pdata;
 
 static void __init uart_debug_init(void)
@@ -356,18 +354,6 @@ static void __init cardhu_uart_init(void)
                                ARRAY_SIZE(cardhu_uart_devices));
 }
 
-void cardhu_debug_uart_suspend(void)
-{
-       if (console_suspend_enabled)
-               clk_disable(debug_uart_clk);
-}
-
-void cardhu_debug_uart_resume(void)
-{
-       if (console_suspend_enabled)
-               clk_enable(debug_uart_clk);
-}
-
 static struct platform_device tegra_camera = {
        .name = "tegra_camera",
        .id = -1,
index eddc20c..f9ed1e5 100644 (file)
@@ -171,7 +171,4 @@ int cardhu_power_off_init(void);
 int cardhu_edp_init(void);
 int cardhu_pmon_init(void);
 
-void cardhu_debug_uart_suspend(void);
-void cardhu_debug_uart_resume(void);
-
 #endif
index 9f1f959..4da5d1d 100644 (file)
@@ -400,6 +400,18 @@ int __init enterprise_regulator_init(void)
        return 0;
 }
 
+static void enterprise_board_suspend(int lp_state, enum suspend_stage stg)
+{
+       if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_SUSPEND_BEFORE_CPU))
+               tegra_console_uart_suspend();
+}
+
+static void enterprise_board_resume(int lp_state, enum resume_stage stg)
+{
+       if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_RESUME_AFTER_CPU))
+               tegra_console_uart_resume();
+}
+
 static struct tegra_suspend_platform_data enterprise_suspend_data = {
        .cpu_timer      = 2000,
        .cpu_off_timer  = 200,
@@ -408,6 +420,8 @@ static struct tegra_suspend_platform_data enterprise_suspend_data = {
        .core_off_timer = 0,
        .corereq_high   = true,
        .sysclkreq_high = true,
+       .board_suspend = enterprise_board_suspend,
+       .board_resume = enterprise_board_resume,
 };
 
 int __init enterprise_suspend_init(void)
index 87b353b..1b6171e 100644 (file)
@@ -241,7 +241,6 @@ static struct uart_clk_parent uart_parent_clk[] = {
        [1] = {.name = "pll_m"},
        [2] = {.name = "clk_m"},
 };
-static struct clk *debug_uart_clk;
 static struct tegra_uart_platform_data enterprise_uart_pdata;
 
 static void __init uart_debug_init(void)
index 14c5748..656ffc5 100644 (file)
@@ -201,6 +201,18 @@ static struct i2c_board_info __initdata ventana_regulators[] = {
        },
 };
 
+static void ventana_board_suspend(int lp_state, enum suspend_stage stg)
+{
+       if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_SUSPEND_BEFORE_CPU))
+               tegra_console_uart_suspend();
+}
+
+static void ventana_board_resume(int lp_state, enum resume_stage stg)
+{
+       if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_RESUME_AFTER_CPU))
+               tegra_console_uart_resume();
+}
+
 static struct tegra_suspend_platform_data ventana_suspend_data = {
        /*
         * Check power on time and crystal oscillator start time
@@ -213,6 +225,8 @@ static struct tegra_suspend_platform_data ventana_suspend_data = {
        .core_off_timer = 0xf,
        .corereq_high   = false,
        .sysclkreq_high = true,
+       .board_suspend = ventana_board_suspend,
+       .board_resume = ventana_board_resume,
 };
 
 int __init ventana_regulator_init(void)
index 8d4f80f..4157695 100644 (file)
@@ -201,7 +201,6 @@ static struct uart_clk_parent uart_parent_clk[] = {
        [2] = {.name = "clk_m"},
 };
 
-static struct clk *debug_uart_clk;
 static struct tegra_uart_platform_data ventana_uart_pdata;
 
 static void __init uart_debug_init(void)
index 34da66e..33fcca2 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/syscore_ops.h>
 #include <linux/vmalloc.h>
 #include <linux/memblock.h>
+#include <linux/console.h>
 
 #include <asm/cacheflush.h>
 #include <asm/cpu_pm.h>
@@ -1056,6 +1057,21 @@ static struct syscore_ops tegra_debug_uart_syscore_ops = {
        .resume = tegra_debug_uart_resume,
 };
 
+struct clk *debug_uart_clk = NULL;
+EXPORT_SYMBOL(debug_uart_clk);
+
+void tegra_console_uart_suspend(void)
+{
+       if (console_suspend_enabled && debug_uart_clk)
+               clk_disable(debug_uart_clk);
+}
+
+void tegra_console_uart_resume(void)
+{
+       if (console_suspend_enabled && debug_uart_clk)
+               clk_enable(debug_uart_clk);
+}
+
 static int tegra_debug_uart_syscore_init(void)
 {
        register_syscore_ops(&tegra_debug_uart_syscore_ops);
index 5a62092..49cd77f 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mutex.h>
 #include <linux/init.h>
 #include <linux/errno.h>
+#include <linux/clkdev.h>
 
 #include <mach/iomap.h>
 
@@ -213,4 +214,8 @@ extern bool tegra_all_cpus_booted __read_mostly;
 /* The debug channel uart base physical address */
 extern unsigned long  debug_uart_port_base;
 
+extern struct clk *debug_uart_clk;
+void tegra_console_uart_suspend(void);
+void tegra_console_uart_resume(void);
+
 #endif /* _MACH_TEGRA_PM_H_ */