pinctrl: at91: enhance (debugfs) at91_gpio_dbg_show
authorMatthieu Crapet <mcrapet@gmail.com>
Tue, 18 Nov 2014 14:43:45 +0000 (15:43 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 3 Dec 2014 11:23:10 +0000 (12:23 +0100)
When a pin is configured as GPIO, print also direction (input or output).

Signed-off-by: Matthieu Crapet <mcrapet@gmail.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-at91.c

index 94643bbaee3768deb2b2b908c3e9909265e80c33..66db9849aca832d9fd49b47dd6c5a6db347f8c5c 100644 (file)
@@ -1342,7 +1342,6 @@ static void at91_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
        for (i = 0; i < chip->ngpio; i++) {
                unsigned mask = pin_to_mask(i);
                const char *gpio_label;
-               u32 pdsr;
 
                gpio_label = gpiochip_is_requested(chip, i);
                if (!gpio_label)
@@ -1351,11 +1350,13 @@ static void at91_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
                seq_printf(s, "[%s] GPIO%s%d: ",
                           gpio_label, chip->label, i);
                if (mode == AT91_MUX_GPIO) {
-                       pdsr = readl_relaxed(pio + PIO_PDSR);
-
-                       seq_printf(s, "[gpio] %s\n",
-                                  pdsr & mask ?
-                                  "set" : "clear");
+                       seq_printf(s, "[gpio] ");
+                       seq_printf(s, "%s ",
+                                     readl_relaxed(pio + PIO_OSR) & mask ?
+                                     "output" : "input");
+                       seq_printf(s, "%s\n",
+                                     readl_relaxed(pio + PIO_PDSR) & mask ?
+                                     "set" : "clear");
                } else {
                        seq_printf(s, "[periph %c]\n",
                                   mode + 'A' - 1);