summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorJin Qian <jqian@nvidia.com>2011-03-16 12:30:41 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:42:30 -0800
commit6ea707c882369365877deb6c8f2af744a174bc2e (patch)
treedbdca98ebb92b35e30a0036d01bf1f48907b8ec0 /arch/arm/mach-tegra
parent4b958e3ae8f1904c36d77bc159a402b6b5b4468c (diff)
ARM: tegra: power: add partition power check before suspend
Original-Change-Id: Ie4b29d1119bc2f640891525ab781c8de1bf64ddf Reviewed-on: http://git-master/r/23215 Tested-by: Jin Qian <jqian@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: Idc616485ecdb9e7c39728409d91a511e1de79e05 Rebase-Id: Rd61725b233749ea76467686439b92ac22b65f424
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/include/mach/powergate.h1
-rw-r--r--arch/arm/mach-tegra/pm.c30
-rw-r--r--arch/arm/mach-tegra/powergate.c12
3 files changed, 41 insertions, 2 deletions
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 <mach/clk.h>
#include <mach/iomap.h>
#include <mach/irqs.h>
+#include <mach/powergate.h>
#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;