diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2016-11-12 08:36:17 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-11-12 08:36:17 -0500 |
commit | 9298539c0472c1bd7516c62d444e561493e3f26c (patch) | |
tree | 44af6fd71702f3f65936c5a4a591a5eb28fc8ece /drivers/gpio | |
parent | c82064f26f44ea13f097dfb58d5ffd4359dcabbb (diff) |
gpio: htc-egpio: add .get_direction() support
This makes is possible to read out the current direction of a
GPIO line on the HTC CPLD GPIO expander.
Suggested-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-htc-egpio.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-htc-egpio.c b/drivers/gpio/gpio-htc-egpio.c index 5ab895b41819..27af52850927 100644 --- a/drivers/gpio/gpio-htc-egpio.c +++ b/drivers/gpio/gpio-htc-egpio.c | |||
@@ -225,6 +225,15 @@ static int egpio_direction_output(struct gpio_chip *chip, | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | static int egpio_get_direction(struct gpio_chip *chip, unsigned offset) | ||
229 | { | ||
230 | struct egpio_chip *egpio; | ||
231 | |||
232 | egpio = gpiochip_get_data(chip); | ||
233 | |||
234 | return !test_bit(offset, &egpio->is_out); | ||
235 | } | ||
236 | |||
228 | static void egpio_write_cache(struct egpio_info *ei) | 237 | static void egpio_write_cache(struct egpio_info *ei) |
229 | { | 238 | { |
230 | int i; | 239 | int i; |
@@ -327,6 +336,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
327 | chip->set = egpio_set; | 336 | chip->set = egpio_set; |
328 | chip->direction_input = egpio_direction_input; | 337 | chip->direction_input = egpio_direction_input; |
329 | chip->direction_output = egpio_direction_output; | 338 | chip->direction_output = egpio_direction_output; |
339 | chip->get_direction = egpio_get_direction; | ||
330 | chip->base = pdata->chip[i].gpio_base; | 340 | chip->base = pdata->chip[i].gpio_base; |
331 | chip->ngpio = pdata->chip[i].num_gpios; | 341 | chip->ngpio = pdata->chip[i].num_gpios; |
332 | 342 | ||