0012-gpio-sch-Implement-.get_direction.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 8c5cc2a98dcbcbd4208c62e5709d3669405072f7 Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <linus.walleij@linaro.org>
  3. Date: Wed, 27 Jun 2018 10:39:31 +0200
  4. Subject: [PATCH 12/32] gpio: sch: Implement .get_direction()
  5. It's pretty simple to implement the .get_direction() for this
  6. chip, so let's just do it.
  7. Cc: Denis Turischev <denis.turischev@compulab.co.il>
  8. Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
  9. Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  10. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  11. ---
  12. drivers/gpio/gpio-sch.c | 8 ++++++++
  13. 1 file changed, 8 insertions(+)
  14. diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
  15. index 5f72b177fc80..6715828c3940 100644
  16. --- a/drivers/gpio/gpio-sch.c
  17. +++ b/drivers/gpio/gpio-sch.c
  18. @@ -138,6 +138,13 @@ static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num,
  19. return 0;
  20. }
  21. +static int sch_gpio_get_direction(struct gpio_chip *gc, unsigned gpio_num)
  22. +{
  23. + struct sch_gpio *sch = gpiochip_get_data(gc);
  24. +
  25. + return sch_gpio_reg_get(sch, gpio_num, GIO);
  26. +}
  27. +
  28. static struct gpio_chip sch_gpio_chip = {
  29. .label = "sch_gpio",
  30. .owner = THIS_MODULE,
  31. @@ -145,6 +152,7 @@ static struct gpio_chip sch_gpio_chip = {
  32. .get = sch_gpio_get,
  33. .direction_output = sch_gpio_direction_out,
  34. .set = sch_gpio_set,
  35. + .get_direction = sch_gpio_get_direction,
  36. };
  37. static int sch_gpio_probe(struct platform_device *pdev)
  38. --
  39. 2.16.4