diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-07-15 11:10:57 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-07-15 16:50:44 -0700 |
commit | 0285ea73b85f3f1f662c307c13f208c5eab64178 (patch) | |
tree | a7265156d41d1deacf27350584bfd490f765eef7 | |
parent | cddc2f824cbce533c1d8229e1cc29a212370f2cc (diff) |
arm: tegra: cardhu: Add board level suspend/resume
Adding board level suspend/resume for cardhu.
Disabling the clock for console uart port if console_suspend
is enabled.
bug 820536
Change-Id: Iecb78708ff7784dd131ffa83692b2419dba44e88
Reviewed-on: http://git-master/r/41147
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-power.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.h | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-power.c b/arch/arm/mach-tegra/board-cardhu-power.c index 11a33200dca3..ccf428c9fa66 100644 --- a/arch/arm/mach-tegra/board-cardhu-power.c +++ b/arch/arm/mach-tegra/board-cardhu-power.c @@ -900,6 +900,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 == 1) && (stg == TEGRA_SUSPEND_BEFORE_CPU)) + debug_uart_suspend(); +} + +static void cardhu_board_resume(int lp_state, enum resume_stage stg) +{ + if ((lp_state == 1) && (stg == TEGRA_RESUME_AFTER_CPU)) + debug_uart_resume(); +} + static struct tegra_suspend_platform_data cardhu_suspend_data = { .cpu_timer = 2000, .cpu_off_timer = 200, @@ -915,6 +927,8 @@ static struct tegra_suspend_platform_data cardhu_suspend_data = { .wake_low = TEGRA_WAKE_GPIO_PV0 | TEGRA_WAKE_PWR_INT, .wake_any = TEGRA_WAKE_KBC_EVENT, .cpu_lp2_min_residency = 2000, + .board_suspend = cardhu_board_suspend, + .board_resume = cardhu_board_resume, }; int __init cardhu_suspend_init(void) diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index 85222bfe8d9c..c651e93e84bc 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -37,6 +37,8 @@ #include <linux/spi/spi.h> #include <linux/tegra_uart.h> #include <linux/memblock.h> +#include <linux/console.h> + #include <mach/clk.h> #include <mach/iomap.h> #include <mach/irqs.h> @@ -520,6 +522,18 @@ static void __init cardhu_uart_init(void) ARRAY_SIZE(cardhu_uart_devices)); } +void debug_uart_suspend(void) +{ + if (console_suspend_enabled) + clk_disable(debug_uart_clk); +} + +void debug_uart_resume(void) +{ + if (console_suspend_enabled) + clk_enable(debug_uart_clk); +} + #if defined(CONFIG_RTC_DRV_TEGRA) static struct resource tegra_rtc_resources[] = { [0] = { diff --git a/arch/arm/mach-tegra/board-cardhu.h b/arch/arm/mach-tegra/board-cardhu.h index d5c2b803a3d2..0299a5e5b7ed 100644 --- a/arch/arm/mach-tegra/board-cardhu.h +++ b/arch/arm/mach-tegra/board-cardhu.h @@ -172,6 +172,9 @@ int cardhu_power_off_init(void); int cardhu_edp_init(void); int cardhu_pmon_init(void); +void debug_uart_suspend(void); +void debug_uart_resume(void); + #define TOUCH_GPIO_IRQ_ATMEL_T9 TEGRA_GPIO_PH4 #define TOUCH_GPIO_RST_ATMEL_T9 TEGRA_GPIO_PH6 #define TOUCH_BUS_ATMEL_T9 1 |