diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 03:49:44 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-03-24 09:04:37 -0400 |
commit | c65d1fd350fa28de79e86e18ef73b902a67c791a (patch) | |
tree | a9af6c70bb9fb1f784bb73e2912836c4237e6807 | |
parent | 07242b248119a9388a67975aa7fae7c23afc7a07 (diff) |
gpio: sa1100: implement get_direction method
Allow gpiolib to read back the current IO direction configuration by
implementing the .get_direction callback. This, in part, allows
debugfs to report the complete true hardware state rather than the
software state.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-sa1100.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c index bad0169524c9..249f433aa62d 100644 --- a/drivers/gpio/gpio-sa1100.c +++ b/drivers/gpio/gpio-sa1100.c | |||
@@ -52,6 +52,13 @@ static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
52 | writel_relaxed(BIT(offset), sa1100_gpio_chip(chip)->membase + reg); | 52 | writel_relaxed(BIT(offset), sa1100_gpio_chip(chip)->membase + reg); |
53 | } | 53 | } |
54 | 54 | ||
55 | static int sa1100_get_direction(struct gpio_chip *chip, unsigned offset) | ||
56 | { | ||
57 | void __iomem *gpdr = sa1100_gpio_chip(chip)->membase + R_GPDR; | ||
58 | |||
59 | return !(readl_relaxed(gpdr) & BIT(offset)); | ||
60 | } | ||
61 | |||
55 | static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset) | 62 | static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset) |
56 | { | 63 | { |
57 | void __iomem *gpdr = sa1100_gpio_chip(chip)->membase + R_GPDR; | 64 | void __iomem *gpdr = sa1100_gpio_chip(chip)->membase + R_GPDR; |
@@ -85,6 +92,7 @@ static int sa1100_to_irq(struct gpio_chip *chip, unsigned offset) | |||
85 | static struct sa1100_gpio_chip sa1100_gpio_chip = { | 92 | static struct sa1100_gpio_chip sa1100_gpio_chip = { |
86 | .chip = { | 93 | .chip = { |
87 | .label = "gpio", | 94 | .label = "gpio", |
95 | .get_direction = sa1100_get_direction, | ||
88 | .direction_input = sa1100_direction_input, | 96 | .direction_input = sa1100_direction_input, |
89 | .direction_output = sa1100_direction_output, | 97 | .direction_output = sa1100_direction_output, |
90 | .set = sa1100_gpio_set, | 98 | .set = sa1100_gpio_set, |