From 6ea707c882369365877deb6c8f2af744a174bc2e Mon Sep 17 00:00:00 2001 From: Jin Qian Date: Wed, 16 Mar 2011 12:30:41 -0700 Subject: ARM: tegra: power: add partition power check before suspend Original-Change-Id: Ie4b29d1119bc2f640891525ab781c8de1bf64ddf Reviewed-on: http://git-master/r/23215 Tested-by: Jin Qian Reviewed-by: Scott Williams Original-Change-Id: Idc616485ecdb9e7c39728409d91a511e1de79e05 Rebase-Id: Rd61725b233749ea76467686439b92ac22b65f424 --- arch/arm/mach-tegra/include/mach/powergate.h | 1 + arch/arm/mach-tegra/pm.c | 30 ++++++++++++++++++++++++++++ arch/arm/mach-tegra/powergate.c | 12 +++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-tegra') diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h index dd636a73de77..6f79b047d99d 100644 --- a/arch/arm/mach-tegra/include/mach/powergate.h +++ b/arch/arm/mach-tegra/include/mach/powergate.h @@ -51,6 +51,7 @@ int tegra_powergate_power_on(int id); int tegra_powergate_power_off(int id); bool tegra_powergate_is_powered(int id); int tegra_powergate_remove_clamping(int id); +const char* tegra_powergate_get_name(int id); /* Must be called with clk disabled, and returns with clk enabled */ int tegra_powergate_sequence_power_up(int id, struct clk *clk); diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index 127263e8b4dd..30d6fb7ed6eb 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c @@ -49,6 +49,7 @@ #include #include #include +#include #include "board.h" #include "clock.h" @@ -192,6 +193,32 @@ static unsigned long tegra_cluster_switch_times[tegra_cluster_switch_time_id_max #define tegra_cluster_switch_time(flags, id) do {} while(0) #endif +static void tegra_suspend_check_pwr_stats(void) +{ + /* cpus and l2 are powered off later */ + unsigned long pwrgate_partid_mask = +#if !defined(CONFIG_ARCH_TEGRA_2x_SOC) + (1 << TEGRA_POWERGATE_HEG) | + (1 << TEGRA_POWERGATE_SATA) | + (1 << TEGRA_POWERGATE_3D1) | +#endif + (1 << TEGRA_POWERGATE_3D) | + (1 << TEGRA_POWERGATE_VENC) | + (1 << TEGRA_POWERGATE_PCIE) | + (1 << TEGRA_POWERGATE_VDEC) | + (1 << TEGRA_POWERGATE_MPE); + + int partid; + + for (partid = 0; partid < TEGRA_NUM_POWERGATE; partid++) + if ((1 << partid) & pwrgate_partid_mask) + if (tegra_powergate_is_powered(partid)) + pr_warning("partition %s is lef on before suspend\n", + tegra_powergate_get_name(partid)); + + return; +} + unsigned long tegra_cpu_power_good_time(void) { if (WARN_ON_ONCE(!pdata)) @@ -683,6 +710,9 @@ static int tegra_suspend_enter(suspend_state_t state) mode = TEGRA_SUSPEND_LP1; } + if ((mode == TEGRA_SUSPEND_LP0) || (mode == TEGRA_SUSPEND_LP1)) + tegra_suspend_check_pwr_stats(); + tegra_common_suspend(); pr_info("Entering suspend state %s\n", lp_state[mode]); diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c index 788c9fd63c72..ba3b06806909 100644 --- a/arch/arm/mach-tegra/powergate.c +++ b/arch/arm/mach-tegra/powergate.c @@ -180,8 +180,6 @@ err_power: return ret; } -#ifdef CONFIG_DEBUG_FS - static const char * const powergate_name[] = { [TEGRA_POWERGATE_CPU] = "cpu0", [TEGRA_POWERGATE_3D] = "3d0", @@ -201,6 +199,16 @@ static const char * const powergate_name[] = { #endif }; +const char* tegra_powergate_get_name(int id) +{ + if (id < 0 || id >= TEGRA_NUM_POWERGATE) + return "invalid"; + + return powergate_name[id]; +} + +#ifdef CONFIG_DEBUG_FS + static int powergate_show(struct seq_file *s, void *data) { int i; -- cgit v1.2.3