diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-07-18 11:47:13 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-07-18 17:31:47 -0700 |
commit | 0eb9b4c59731b915b2be6c83e67ddeea54e3c8b4 (patch) | |
tree | a0ca2b321707fcff50f44d3728101c46ff6ee3bf | |
parent | 636520e513cc2a48df9c6c8f1233c43e955080a1 (diff) |
arm: tegra: Console suspend for all boards
Added the board level suspend/resume and call the console
suspend from board level suspend/resume.
bug 820536
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>
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-power.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-power.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-power.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/suspend.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-tegra/suspend.c | 16 |
9 files changed, 53 insertions, 21 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-power.c b/arch/arm/mach-tegra/board-cardhu-power.c index ccf428c9fa66..4ab54218d416 100644 --- a/arch/arm/mach-tegra/board-cardhu-power.c +++ b/arch/arm/mach-tegra/board-cardhu-power.c @@ -903,13 +903,13 @@ int __init cardhu_gpio_switch_regulator_init(void) static void cardhu_board_suspend(int lp_state, enum suspend_stage stg) { if ((lp_state == 1) && (stg == TEGRA_SUSPEND_BEFORE_CPU)) - debug_uart_suspend(); + tegra_console_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(); + tegra_console_uart_resume(); } static struct tegra_suspend_platform_data cardhu_suspend_data = { diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index c651e93e84bc..541d3c3774fe 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -37,7 +37,6 @@ #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> @@ -443,7 +442,6 @@ 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) @@ -522,18 +520,6 @@ 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 0299a5e5b7ed..d5c2b803a3d2 100644 --- a/arch/arm/mach-tegra/board-cardhu.h +++ b/arch/arm/mach-tegra/board-cardhu.h @@ -172,9 +172,6 @@ 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 diff --git a/arch/arm/mach-tegra/board-enterprise-power.c b/arch/arm/mach-tegra/board-enterprise-power.c index 72d191c56d39..7fd09d081995 100644 --- a/arch/arm/mach-tegra/board-enterprise-power.c +++ b/arch/arm/mach-tegra/board-enterprise-power.c @@ -401,6 +401,18 @@ int __init enterprise_regulator_init(void) return 0; } +static void enterprise_board_suspend(int lp_state, enum suspend_stage stg) +{ + if ((lp_state == 1) && (stg == TEGRA_SUSPEND_BEFORE_CPU)) + tegra_console_uart_suspend(); +} + +static void enterprise_board_resume(int lp_state, enum resume_stage stg) +{ + if ((lp_state == 1) && (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, @@ -414,6 +426,9 @@ static struct tegra_suspend_platform_data enterprise_suspend_data = { .wake_high = TEGRA_WAKE_RTC_ALARM, .wake_low = 0, .wake_any = TEGRA_WAKE_KBC_EVENT, + .board_suspend = enterprise_board_suspend, + .board_resume = enterprise_board_resume, + }; int __init enterprise_suspend_init(void) diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index 245bc3bc58d1..f7e792f8e269 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -466,7 +466,6 @@ 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) diff --git a/arch/arm/mach-tegra/board-ventana-power.c b/arch/arm/mach-tegra/board-ventana-power.c index 420972f64b09..8b220608472a 100644 --- a/arch/arm/mach-tegra/board-ventana-power.c +++ b/arch/arm/mach-tegra/board-ventana-power.c @@ -202,6 +202,18 @@ static struct i2c_board_info __initdata ventana_regulators[] = { }, }; +static void ventana_board_suspend(int lp_state, enum suspend_stage stg) +{ + if ((lp_state == 1) && (stg == TEGRA_SUSPEND_BEFORE_CPU)) + tegra_console_uart_suspend(); +} + +static void ventana_board_resume(int lp_state, enum resume_stage stg) +{ + if ((lp_state == 1) && (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 @@ -219,6 +231,8 @@ static struct tegra_suspend_platform_data ventana_suspend_data = { .wake_high = 0, .wake_low = TEGRA_WAKE_GPIO_PV2 | TEGRA_WAKE_GPIO_PY6, .wake_any = 0, + .board_suspend = ventana_board_suspend, + .board_resume = ventana_board_resume, }; int __init ventana_regulator_init(void) diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c index 9a701fce3439..5ae440a472d6 100644 --- a/arch/arm/mach-tegra/board-ventana.c +++ b/arch/arm/mach-tegra/board-ventana.c @@ -516,7 +516,6 @@ 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) diff --git a/arch/arm/mach-tegra/include/mach/suspend.h b/arch/arm/mach-tegra/include/mach/suspend.h index b4dc2fd1fa56..622e1688071c 100644 --- a/arch/arm/mach-tegra/include/mach/suspend.h +++ b/arch/arm/mach-tegra/include/mach/suspend.h @@ -23,6 +23,8 @@ #ifndef _MACH_TEGRA_SUSPEND_H_ #define _MACH_TEGRA_SUSPEND_H_ +#include <mach/clk.h> + enum tegra_suspend_mode { TEGRA_SUSPEND_NONE = 0, TEGRA_SUSPEND_LP2, /* CPU voltage off */ @@ -110,4 +112,8 @@ extern void (*tegra_deep_sleep)(int); /* 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_SUSPEND_H_ */ diff --git a/arch/arm/mach-tegra/suspend.c b/arch/arm/mach-tegra/suspend.c index 4a9f93479908..11f3051e5517 100644 --- a/arch/arm/mach-tegra/suspend.c +++ b/arch/arm/mach-tegra/suspend.c @@ -39,6 +39,7 @@ #include <linux/serial_reg.h> #include <linux/seq_file.h> #include <linux/uaccess.h> +#include <linux/console.h> #include <linux/regulator/machine.h> @@ -822,6 +823,21 @@ static void tegra_debug_uart_resume(void) writeb(lcr, uart + UART_LCR * 4); } +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); +} + #define MC_SECURITY_START 0x6c #define MC_SECURITY_SIZE 0x70 #define MC_SECURITY_CFG2 0x7c |