Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Russell King and committed by
Linus Walleij
c65d1fd3 07242b24

+8
+8
drivers/gpio/gpio-sa1100.c
··· 52 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 62 static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset) 56 63 { 57 64 void __iomem *gpdr = sa1100_gpio_chip(chip)->membase + R_GPDR; ··· 92 85 static struct sa1100_gpio_chip sa1100_gpio_chip = { 93 86 .chip = { 94 87 .label = "gpio", 88 + .get_direction = sa1100_get_direction, 95 89 .direction_input = sa1100_direction_input, 96 90 .direction_output = sa1100_direction_output, 97 91 .set = sa1100_gpio_set,