Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/Makefile            |    2 +-
 arch/arm/mach-omap2/powerdomain-debug.c |   50 +++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain-debug.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index d89b7cb..e1adb0e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -24,7 +24,7 @@ obj-y                                 += pm.o
 obj-$(CONFIG_ARCH_OMAP2)               += pm24xx.o
 obj-$(CONFIG_ARCH_OMAP24XX)            += sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)               += pm34xx.o sleep34xx.o
-obj-$(CONFIG_PM_DEBUG)                 += pm-debug.o
+obj-$(CONFIG_PM_DEBUG)                 += pm-debug.o powerdomain-debug.o
 endif
 
 # SmartReflex driver
diff --git a/arch/arm/mach-omap2/powerdomain-debug.c 
b/arch/arm/mach-omap2/powerdomain-debug.c
new file mode 100644
index 0000000..dda88e1
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomain-debug.c
@@ -0,0 +1,50 @@
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+#include <mach/powerdomain.h>
+
+
+int show_off_mode_count(struct powerdomain *pwrdm, void *user)
+{
+       struct seq_file *s = (struct seq_file *)user;
+
+       if (strcmp(pwrdm->name, "emu_pwrdm") &&
+               strcmp(pwrdm->name, "wkup_pwrdm"))
+               seq_printf(s, "%s : %d\n", pwrdm->name, pwrdm->offstate_count);
+
+       return 0;
+}
+
+int show_off_mode_counters(struct seq_file *s, void *unused)
+{
+       pwrdm_for_each(show_off_mode_count, s);
+
+       return 0;
+}
+
+static int off_mode_counter_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, show_off_mode_counters, &inode->i_private);
+}
+
+static const struct file_operations debug_fops = {
+       .open   = off_mode_counter_open,
+       .read   = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
+};
+
+static int __init off_mode_counter_debug(void)
+{
+       struct dentry *d;
+
+       d = debugfs_create_dir("off_mode_counters", NULL);
+       if (IS_ERR(d))
+               return PTR_ERR(d);
+
+       debugfs_create_file("count", S_IRUGO,
+                               d, NULL, &debug_fops);
+
+       return 0;
+}
+
+late_initcall(off_mode_counter_debug);
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to