diff options
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-nomadik.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index 09efb8c1a2eb..3c29d9187146 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c | |||
@@ -986,6 +986,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, | |||
986 | container_of(chip, struct nmk_gpio_chip, chip); | 986 | container_of(chip, struct nmk_gpio_chip, chip); |
987 | int mode; | 987 | int mode; |
988 | bool is_out; | 988 | bool is_out; |
989 | bool data_out; | ||
989 | bool pull; | 990 | bool pull; |
990 | u32 bit = 1 << offset; | 991 | u32 bit = 1 << offset; |
991 | const char *modes[] = { | 992 | const char *modes[] = { |
@@ -998,28 +999,41 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, | |||
998 | [NMK_GPIO_ALT_C+3] = "altC3", | 999 | [NMK_GPIO_ALT_C+3] = "altC3", |
999 | [NMK_GPIO_ALT_C+4] = "altC4", | 1000 | [NMK_GPIO_ALT_C+4] = "altC4", |
1000 | }; | 1001 | }; |
1002 | const char *pulls[] = { | ||
1003 | "none ", | ||
1004 | "pull down", | ||
1005 | "pull up ", | ||
1006 | }; | ||
1001 | 1007 | ||
1002 | clk_enable(nmk_chip->clk); | 1008 | clk_enable(nmk_chip->clk); |
1003 | is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit); | 1009 | is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit); |
1004 | pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); | 1010 | pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); |
1011 | data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & bit); | ||
1005 | mode = nmk_gpio_get_mode(gpio); | 1012 | mode = nmk_gpio_get_mode(gpio); |
1006 | if ((mode == NMK_GPIO_ALT_C) && pctldev) | 1013 | if ((mode == NMK_GPIO_ALT_C) && pctldev) |
1007 | mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); | 1014 | mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); |
1008 | 1015 | ||
1009 | seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s", | 1016 | if (is_out) { |
1010 | gpio, label ?: "(none)", | 1017 | seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s", |
1011 | is_out ? "out" : "in ", | 1018 | gpio, |
1012 | chip->get | 1019 | label ?: "(none)", |
1013 | ? (chip->get(chip, offset) ? "hi" : "lo") | 1020 | data_out ? "hi" : "lo", |
1014 | : "? ", | 1021 | (mode < 0) ? "unknown" : modes[mode]); |
1015 | (mode < 0) ? "unknown" : modes[mode], | 1022 | } else { |
1016 | pull ? "pull" : "none"); | ||
1017 | |||
1018 | if (!is_out) { | ||
1019 | int irq = gpio_to_irq(gpio); | 1023 | int irq = gpio_to_irq(gpio); |
1020 | struct irq_desc *desc = irq_to_desc(irq); | 1024 | struct irq_desc *desc = irq_to_desc(irq); |
1025 | int pullidx = 0; | ||
1021 | 1026 | ||
1022 | /* This races with request_irq(), set_irq_type(), | 1027 | if (pull) |
1028 | pullidx = data_out ? 1 : 2; | ||
1029 | |||
1030 | seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", | ||
1031 | gpio, | ||
1032 | label ?: "(none)", | ||
1033 | pulls[pullidx], | ||
1034 | (mode < 0) ? "unknown" : modes[mode]); | ||
1035 | /* | ||
1036 | * This races with request_irq(), set_irq_type(), | ||
1023 | * and set_irq_wake() ... but those are "rare". | 1037 | * and set_irq_wake() ... but those are "rare". |
1024 | */ | 1038 | */ |
1025 | if (irq > 0 && desc && desc->action) { | 1039 | if (irq > 0 && desc && desc->action) { |