[06/18] gpio: sch: Implement .get_direction()

Message ID 20180629063544.3826-6-linus.walleij@linaro.org
State New
Headers show
Series
  • [01/18] gpio: rc5t583: Include the right header
Related show

Commit Message

Linus Walleij June 29, 2018, 6:35 a.m.
It's pretty simple to implement the .get_direction() for this
chip, so let's just do it.

Cc: Denis Turischev <denis.turischev@compulab.co.il>
Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-sch.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Mika Westerberg June 29, 2018, 9:55 a.m. | #1
On Fri, Jun 29, 2018 at 08:35:32AM +0200, Linus Walleij wrote:
> It's pretty simple to implement the .get_direction() for this
> chip, so let's just do it.
> 
> Cc: Denis Turischev <denis.turischev@compulab.co.il>
> Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 26e9b1cd2c78..e9878f6ede67 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -137,6 +137,13 @@  static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num,
 	return 0;
 }
 
+static int sch_gpio_get_direction(struct gpio_chip *gc, unsigned gpio_num)
+{
+	struct sch_gpio *sch = gpiochip_get_data(gc);
+
+	return sch_gpio_reg_get(sch, gpio_num, GIO);
+}
+
 static const struct gpio_chip sch_gpio_chip = {
 	.label			= "sch_gpio",
 	.owner			= THIS_MODULE,
@@ -144,6 +151,7 @@  static const struct gpio_chip sch_gpio_chip = {
 	.get			= sch_gpio_get,
 	.direction_output	= sch_gpio_direction_out,
 	.set			= sch_gpio_set,
+	.get_direction		= sch_gpio_get_direction,
 };
 
 static int sch_gpio_probe(struct platform_device *pdev)