aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm-debug.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-09-16 14:34:24 -0700
committerColin Cross <ccross@android.com>2011-09-16 14:35:35 -0700
commitbd5f7c5fb682fc1536c8afc104bb8562acc69ffe (patch)
tree1832c2a720669891e044ef8c1bce0b007f23e543 /arch/arm/mach-omap2/pm-debug.c
parentf8eeb22fcef5cd266371a3428ad560963793941b (diff)
downloadkernel_samsung_tuna-bd5f7c5fb682fc1536c8afc104bb8562acc69ffe.zip
kernel_samsung_tuna-bd5f7c5fb682fc1536c8afc104bb8562acc69ffe.tar.gz
kernel_samsung_tuna-bd5f7c5fb682fc1536c8afc104bb8562acc69ffe.tar.bz2
ARM: omap2+: pm-debug: add last_count and last_time files
last_count and last_time will show the number of transitions and time spent in each state since the last time the file was read. Change-Id: I672e2d8cd595118607b0ac03b58d7d0e8a3b80da Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm-debug.c')
-rw-r--r--arch/arm/mach-omap2/pm-debug.c134
1 files changed, 110 insertions, 24 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 6635f7c..5942d23 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -210,6 +210,8 @@ static int pm_dbg_init(void);
enum {
DEBUG_FILE_COUNTERS = 0,
DEBUG_FILE_TIMERS,
+ DEBUG_FILE_LAST_COUNTERS,
+ DEBUG_FILE_LAST_TIMERS,
};
struct pm_module_def {
@@ -405,10 +407,53 @@ static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user)
return 0;
}
+static int pwrdm_dbg_show_count_stats(struct powerdomain *pwrdm,
+ struct powerdomain_count_stats *stats, struct seq_file *s)
+{
+ int i;
+
+ seq_printf(s, "%s (%s)", pwrdm->name,
+ pwrdm_state_names[pwrdm->state]);
+
+ for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
+ seq_printf(s, ",%s:%d", pwrdm_state_names[i],
+ stats->state[i]);
+
+ seq_printf(s, ",RET-LOGIC-OFF:%d", stats->ret_logic_off);
+ for (i = 0; i < pwrdm->banks; i++)
+ seq_printf(s, ",RET-MEMBANK%d-OFF:%d", i + 1,
+ stats->ret_mem_off[i]);
+
+ seq_printf(s, "\n");
+
+ return 0;
+}
+
+static int pwrdm_dbg_show_time_stats(struct powerdomain *pwrdm,
+ struct powerdomain_time_stats *stats, struct seq_file *s)
+{
+ int i;
+ u64 total = 0;
+
+ seq_printf(s, "%s (%s)", pwrdm->name,
+ pwrdm_state_names[pwrdm->state]);
+
+ for (i = 0; i < 4; i++)
+ total += stats->state[i];
+
+ for (i = 0; i < 4; i++)
+ seq_printf(s, ",%s:%lld (%lld%%)", pwrdm_state_names[i],
+ stats->state[i],
+ total ? div64_u64(stats->state[i] * 100, total) : 0);
+
+ seq_printf(s, "\n");
+
+ return 0;
+}
+
static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
{
struct seq_file *s = (struct seq_file *)user;
- int i;
if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
@@ -419,47 +464,66 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n",
pwrdm->name, pwrdm->state, pwrdm_read_pwrst(pwrdm));
- seq_printf(s, "%s (%s)", pwrdm->name,
- pwrdm_state_names[pwrdm->state]);
- for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
- seq_printf(s, ",%s:%d", pwrdm_state_names[i],
- pwrdm->count.state[i]);
+ pwrdm_dbg_show_count_stats(pwrdm, &pwrdm->count, s);
- seq_printf(s, ",RET-LOGIC-OFF:%d", pwrdm->count.ret_logic_off);
- for (i = 0; i < pwrdm->banks; i++)
- seq_printf(s, ",RET-MEMBANK%d-OFF:%d", i + 1,
- pwrdm->count.ret_mem_off[i]);
+ return 0;
+}
- seq_printf(s, "\n");
+static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
+{
+ struct seq_file *s = (struct seq_file *)user;
+
+ if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
+ strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
+ strncmp(pwrdm->name, "dpll", 4) == 0)
+ return 0;
+
+ pwrdm_state_switch(pwrdm);
+
+ pwrdm_dbg_show_time_stats(pwrdm, &pwrdm->time, s);
return 0;
}
-static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
+static int pwrdm_dbg_show_last_counter(struct powerdomain *pwrdm, void *user)
{
struct seq_file *s = (struct seq_file *)user;
+ struct powerdomain_count_stats stats;
int i;
- u64 total = 0;
if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
strncmp(pwrdm->name, "dpll", 4) == 0)
return 0;
- pwrdm_state_switch(pwrdm);
+ stats = pwrdm->count;
+ for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
+ stats.state[i] -= pwrdm->last_count.state[i];
+ for (i = 0; i < PWRDM_MAX_MEM_BANKS; i++)
+ stats.ret_mem_off[i] -= pwrdm->last_count.ret_mem_off[i];
+ stats.ret_logic_off -= pwrdm->last_count.ret_logic_off;
- seq_printf(s, "%s (%s)", pwrdm->name,
- pwrdm_state_names[pwrdm->state]);
+ pwrdm->last_count = pwrdm->count;
- for (i = 0; i < 4; i++)
- total += pwrdm->time.state[i];
+ pwrdm_dbg_show_count_stats(pwrdm, &stats, s);
- for (i = 0; i < 4; i++)
- seq_printf(s, ",%s:%lld (%lld%%)", pwrdm_state_names[i],
- pwrdm->time.state[i],
- total ? div64_u64(pwrdm->time.state[i] * 100, total) : 0);
+ return 0;
+}
+
+static int pwrdm_dbg_show_last_timer(struct powerdomain *pwrdm, void *user)
+{
+ struct seq_file *s = (struct seq_file *)user;
+ struct powerdomain_time_stats stats;
+ int i;
+
+ stats = pwrdm->time;
+ for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
+ stats.state[i] -= pwrdm->last_time.state[i];
+
+ pwrdm->last_time = pwrdm->time;
+
+ pwrdm_dbg_show_time_stats(pwrdm, &stats, s);
- seq_printf(s, "\n");
return 0;
}
@@ -479,6 +543,18 @@ static int pm_dbg_show_timers(struct seq_file *s, void *unused)
return 0;
}
+static int pm_dbg_show_last_counters(struct seq_file *s, void *unused)
+{
+ pwrdm_for_each(pwrdm_dbg_show_last_counter, s);
+ return 0;
+}
+
+static int pm_dbg_show_last_timers(struct seq_file *s, void *unused)
+{
+ pwrdm_for_each(pwrdm_dbg_show_last_timer, s);
+ return 0;
+}
+
static int pm_dbg_open(struct inode *inode, struct file *file)
{
switch ((int)inode->i_private) {
@@ -486,9 +562,15 @@ static int pm_dbg_open(struct inode *inode, struct file *file)
return single_open(file, pm_dbg_show_counters,
&inode->i_private);
case DEBUG_FILE_TIMERS:
- default:
return single_open(file, pm_dbg_show_timers,
&inode->i_private);
+ case DEBUG_FILE_LAST_COUNTERS:
+ return single_open(file, pm_dbg_show_last_counters,
+ &inode->i_private);
+ case DEBUG_FILE_LAST_TIMERS:
+ default:
+ return single_open(file, pm_dbg_show_last_timers,
+ &inode->i_private);
};
}
@@ -700,6 +782,10 @@ static int __init pm_dbg_init(void)
d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
(void) debugfs_create_file("time", S_IRUGO,
d, (void *)DEBUG_FILE_TIMERS, &debug_fops);
+ (void) debugfs_create_file("last_count", S_IRUGO,
+ d, (void *)DEBUG_FILE_LAST_COUNTERS, &debug_fops);
+ (void) debugfs_create_file("last_time", S_IRUGO,
+ d, (void *)DEBUG_FILE_LAST_TIMERS, &debug_fops);
pwrdm_for_each(pwrdms_setup, (void *)d);