diff options
author | Colin Cross <ccross@android.com> | 2010-10-23 23:22:07 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:34:16 -0800 |
commit | 908430a117bad953bf00f058eb4c04480d2f357a (patch) | |
tree | e732eada889c79532b9a9e8a3c9379ca2184490f /arch/arm/mach-tegra/pm-irq.c | |
parent | bc9c15314865d58bca3ef00b37b9107c84603f21 (diff) |
ARM: tegra: irq: Add debugfs file to show wake irqs
Change-Id: I4a4a05e4b082fff11ed6bd975daebbed31f02a6b
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/pm-irq.c')
-rw-r--r-- | arch/arm/mach-tegra/pm-irq.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/pm-irq.c b/arch/arm/mach-tegra/pm-irq.c index 67a543675512..198f6e379294 100644 --- a/arch/arm/mach-tegra/pm-irq.c +++ b/arch/arm/mach-tegra/pm-irq.c @@ -44,6 +44,8 @@ static u32 tegra_lp0_wake_level; static u32 tegra_lp0_wake_level_any; static int tegra_prevent_lp0; +static unsigned int tegra_wake_irq_count[32]; + static bool debug_lp0; module_param(debug_lp0, bool, S_IRUGO | S_IWUSR); @@ -143,6 +145,8 @@ static void tegra_pm_irq_syscore_resume(void) pr_info("Resume caused by WAKE%d, %s\n", wake, desc->action->name); + tegra_wake_irq_count[wake]++; + generic_handle_irq(irq); } } @@ -201,3 +205,60 @@ static int tegra_pm_irq_syscore_init(void) return 0; } subsys_initcall(tegra_pm_irq_syscore_init); + +#ifdef CONFIG_DEBUG_FS +static int tegra_pm_irq_debug_show(struct seq_file *s, void *data) +{ + int wake; + int irq; + struct irq_desc *desc; + const char *irq_name; + + seq_printf(s, "wake irq count name\n"); + seq_printf(s, "----------------------\n"); + for (wake = 0; wake < 32; wake++) { + irq = tegra_wake_to_irq(wake); + if (irq < 0) + continue; + + desc = irq_to_desc(irq); + if (tegra_wake_irq_count[wake] == 0 && desc->action == NULL) + continue; + + irq_name = (desc->action && desc->action->name) ? + desc->action->name : "???"; + + seq_printf(s, "%4d %3d %5d %s\n", + wake, irq, tegra_wake_irq_count[wake], irq_name); + } + return 0; +} + +static int tegra_pm_irq_debug_open(struct inode *inode, struct file *file) +{ + return single_open(file, tegra_pm_irq_debug_show, NULL); +} + +static const struct file_operations tegra_pm_irq_debug_fops = { + .open = tegra_pm_irq_debug_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init tegra_pm_irq_debug_init(void) +{ + struct dentry *d; + + d = debugfs_create_file("wake_irq", S_IRUGO, NULL, NULL, + &tegra_pm_irq_debug_fops); + if (!d) { + pr_err("Failed to create suspend_mode debug file\n"); + return -ENOMEM; + } + + return 0; +} + +late_initcall(tegra_pm_irq_debug_init); +#endif |