diff options
author | Bengt Jonsson <bengt.g.jonsson@stericsson.com> | 2012-02-14 07:01:00 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-02-04 03:31:50 -0500 |
commit | 8f0eb43be5f461a28341fe724686f265b0719dd3 (patch) | |
tree | b83534be81143dd7b5d2a53c7cfee2d7c7cbdb75 /drivers | |
parent | 20bf428329400d3c71be3bdaaa265a485902f90b (diff) |
mfd: ab8500-debugfs: Add interrupt debug
This patch adds an entry in debugfs to check number of interrupts
from the AB.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/ab8500-core.c | 1 | ||||
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index d228697f5d9b..05a7af4b9768 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -521,6 +521,7 @@ static irqreturn_t ab8500_irq(int irq, void *dev) | |||
521 | int virq = ab8500_irq_get_virq(ab8500, line); | 521 | int virq = ab8500_irq_get_virq(ab8500, line); |
522 | 522 | ||
523 | handle_nested_irq(virq); | 523 | handle_nested_irq(virq); |
524 | ab8500_debug_register_interrupt(line); | ||
524 | value &= ~(1 << bit); | 525 | value &= ~(1 << bit); |
525 | 526 | ||
526 | } while (value); | 527 | } while (value); |
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 8617b132e730..cbebbd7e7b40 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -737,6 +737,35 @@ static ssize_t ab8500_val_write(struct file *file, | |||
737 | } | 737 | } |
738 | 738 | ||
739 | /* | 739 | /* |
740 | * Interrupt status | ||
741 | */ | ||
742 | static u32 num_interrupts[AB8500_MAX_NR_IRQS]; | ||
743 | static int num_interrupt_lines; | ||
744 | |||
745 | void ab8500_debug_register_interrupt(int line) | ||
746 | { | ||
747 | if (line < num_interrupt_lines) | ||
748 | num_interrupts[line]++; | ||
749 | } | ||
750 | |||
751 | static int ab8500_interrupts_print(struct seq_file *s, void *p) | ||
752 | { | ||
753 | int line; | ||
754 | |||
755 | seq_printf(s, "irq: number of\n"); | ||
756 | |||
757 | for (line = 0; line < num_interrupt_lines; line++) | ||
758 | seq_printf(s, "%3i: %6i\n", line, num_interrupts[line]); | ||
759 | |||
760 | return 0; | ||
761 | } | ||
762 | |||
763 | static int ab8500_interrupts_open(struct inode *inode, struct file *file) | ||
764 | { | ||
765 | return single_open(file, ab8500_interrupts_print, inode->i_private); | ||
766 | } | ||
767 | |||
768 | /* | ||
740 | * - HWREG DB8500 formated routines | 769 | * - HWREG DB8500 formated routines |
741 | */ | 770 | */ |
742 | static int ab8500_hwreg_print(struct seq_file *s, void *d) | 771 | static int ab8500_hwreg_print(struct seq_file *s, void *d) |
@@ -1489,6 +1518,14 @@ static const struct file_operations ab8500_val_fops = { | |||
1489 | .owner = THIS_MODULE, | 1518 | .owner = THIS_MODULE, |
1490 | }; | 1519 | }; |
1491 | 1520 | ||
1521 | static const struct file_operations ab8500_interrupts_fops = { | ||
1522 | .open = ab8500_interrupts_open, | ||
1523 | .read = seq_read, | ||
1524 | .llseek = seq_lseek, | ||
1525 | .release = single_release, | ||
1526 | .owner = THIS_MODULE, | ||
1527 | }; | ||
1528 | |||
1492 | static const struct file_operations ab8500_subscribe_fops = { | 1529 | static const struct file_operations ab8500_subscribe_fops = { |
1493 | .open = ab8500_subscribe_unsubscribe_open, | 1530 | .open = ab8500_subscribe_unsubscribe_open, |
1494 | .write = ab8500_subscribe_write, | 1531 | .write = ab8500_subscribe_write, |
@@ -1597,6 +1634,18 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
1597 | if (!file) | 1634 | if (!file) |
1598 | goto err; | 1635 | goto err; |
1599 | 1636 | ||
1637 | if (is_ab8500(ab8500)) | ||
1638 | num_interrupt_lines = AB8500_NR_IRQS; | ||
1639 | else if (is_ab8505(ab8500)) | ||
1640 | num_interrupt_lines = AB8505_NR_IRQS; | ||
1641 | else if (is_ab9540(ab8500)) | ||
1642 | num_interrupt_lines = AB9540_NR_IRQS; | ||
1643 | |||
1644 | file = debugfs_create_file("interrupts", (S_IRUGO), | ||
1645 | ab8500_dir, &plf->dev, &ab8500_interrupts_fops); | ||
1646 | if (!file) | ||
1647 | goto err; | ||
1648 | |||
1600 | file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR), | 1649 | file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR), |
1601 | ab8500_dir, &plf->dev, &ab8500_unsubscribe_fops); | 1650 | ab8500_dir, &plf->dev, &ab8500_unsubscribe_fops); |
1602 | if (!file) | 1651 | if (!file) |