arm: tegra: cardhu: Add board level suspend/resume
Laxman Dewangan [Fri, 15 Jul 2011 05:40:57 +0000 (10:40 +0530)]
Adding board level suspend/resume for cardhu.
Disabling the clock for console uart port if console_suspend
is enabled.

bug 820536

Original-Change-Id: Iecb78708ff7784dd131ffa83692b2419dba44e88
Reviewed-on: http://git-master/r/41147
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R14dcb8c7822b2bdc7e66807e292776b68d08d12d

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

index dfb566c..051ace4 100644 (file)
@@ -899,6 +899,18 @@ int __init cardhu_gpio_switch_regulator_init(void)
        return platform_device_register(&gswitch_regulator_pdata);
 }
 
+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();
+}
+
+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();
+}
+
 static struct tegra_suspend_platform_data cardhu_suspend_data = {
        .cpu_timer      = 2000,
        .cpu_off_timer  = 200,
@@ -908,6 +920,8 @@ static struct tegra_suspend_platform_data cardhu_suspend_data = {
        .corereq_high   = true,
        .sysclkreq_high = true,
        .cpu_lp2_min_residency = 2000,
+       .board_suspend = cardhu_board_suspend,
+       .board_resume = cardhu_board_resume,
 };
 
 int __init cardhu_suspend_init(void)
index 1d28df5..b285a38 100644 (file)
@@ -36,6 +36,7 @@
 #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>
 
@@ -355,6 +356,18 @@ 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 f9ed1e5..eddc20c 100644 (file)
@@ -171,4 +171,7 @@ 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