aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-pl061.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-04-28 13:18:59 +0200
committerLinus Walleij <linus.walleij@linaro.org>2016-04-28 14:36:37 +0200
commit3484f1be2dbf520ad150a0be11f04464b930a4e6 (patch)
tree9c56208841f9307863fe7659888ff5e1c5c27a4d /drivers/gpio/gpio-pl061.c
parentgpio: pl061: remove range check (diff)
downloadlinux-dev-3484f1be2dbf520ad150a0be11f04464b930a4e6.tar.xz
linux-dev-3484f1be2dbf520ad150a0be11f04464b930a4e6.zip
gpio: pl061: implement .get_direction()
Implement this callback so that the driver reports correctly the direction setting of each line. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pl061.c')
-rw-r--r--drivers/gpio/gpio-pl061.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 70eb9ada002e..6e3c1430616f 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -61,6 +61,13 @@ struct pl061_gpio {
#endif
};
+static int pl061_get_direction(struct gpio_chip *gc, unsigned offset)
+{
+ struct pl061_gpio *chip = gpiochip_get_data(gc);
+
+ return !(readb(chip->base + GPIODIR) & BIT(offset));
+}
+
static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
{
struct pl061_gpio *chip = gpiochip_get_data(gc);
@@ -315,6 +322,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
chip->gc.free = gpiochip_generic_free;
}
+ chip->gc.get_direction = pl061_get_direction;
chip->gc.direction_input = pl061_direction_input;
chip->gc.direction_output = pl061_direction_output;
chip->gc.get = pl061_get_value;