diff options
| author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-05-24 17:07:09 -0400 |
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2011-05-26 19:30:18 -0400 |
| commit | 8ea72a30a31c30ec7fa0c30c743b2cec0712d143 (patch) | |
| tree | 1f34deaf6760087b47993edff4b709415d6842d8 | |
| parent | 37d72457644a1ded37d57dd9ae664e4e228a034d (diff) | |
gpio/nomadik: show all pins in debug
Useful to check the status of the runtime pin muxing.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
[Squashed, modified to use chip-internal IRQ trigger state]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
| -rw-r--r-- | drivers/gpio/gpio-nomadik.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 307b8131aa8c..380204781f84 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c | |||
| @@ -811,20 +811,43 @@ static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
| 811 | bool pull; | 811 | bool pull; |
| 812 | u32 bit = 1 << i; | 812 | u32 bit = 1 << i; |
| 813 | 813 | ||
| 814 | if (!label) | ||
| 815 | continue; | ||
| 816 | |||
| 817 | is_out = readl(nmk_chip->addr + NMK_GPIO_DIR) & bit; | 814 | is_out = readl(nmk_chip->addr + NMK_GPIO_DIR) & bit; |
| 818 | pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); | 815 | pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); |
| 819 | mode = nmk_gpio_get_mode(gpio); | 816 | mode = nmk_gpio_get_mode(gpio); |
| 820 | seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s", | 817 | seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s", |
| 821 | gpio, label, | 818 | gpio, label ?: "(none)", |
| 822 | is_out ? "out" : "in ", | 819 | is_out ? "out" : "in ", |
| 823 | chip->get | 820 | chip->get |
| 824 | ? (chip->get(chip, i) ? "hi" : "lo") | 821 | ? (chip->get(chip, i) ? "hi" : "lo") |
| 825 | : "? ", | 822 | : "? ", |
| 826 | (mode < 0) ? "unknown" : modes[mode], | 823 | (mode < 0) ? "unknown" : modes[mode], |
| 827 | pull ? "pull" : "none"); | 824 | pull ? "pull" : "none"); |
| 825 | |||
| 826 | if (label && !is_out) { | ||
| 827 | int irq = gpio_to_irq(gpio); | ||
| 828 | struct irq_desc *desc = irq_to_desc(irq); | ||
| 829 | |||
| 830 | /* This races with request_irq(), set_irq_type(), | ||
| 831 | * and set_irq_wake() ... but those are "rare". | ||
| 832 | */ | ||
| 833 | if (irq >= 0 && desc->action) { | ||
| 834 | char *trigger; | ||
| 835 | u32 bitmask = nmk_gpio_get_bitmask(gpio); | ||
| 836 | |||
| 837 | if (nmk_chip->edge_rising & bitmask) | ||
| 838 | trigger = "edge-rising"; | ||
| 839 | else if (nmk_chip->edge_falling & bitmask) | ||
| 840 | trigger = "edge-falling"; | ||
| 841 | else | ||
| 842 | trigger = "edge-undefined"; | ||
| 843 | |||
| 844 | seq_printf(s, " irq-%d %s%s", | ||
| 845 | irq, trigger, | ||
| 846 | irqd_is_wakeup_set(&desc->irq_data) | ||
| 847 | ? " wakeup" : ""); | ||
| 848 | } | ||
| 849 | } | ||
| 850 | |||
| 828 | seq_printf(s, "\n"); | 851 | seq_printf(s, "\n"); |
| 829 | } | 852 | } |
| 830 | } | 853 | } |
