diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2016-03-14 11:21:44 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-03-30 04:38:50 -0400 |
commit | dbb763b8ea5d8eb0ce3e45e289969f6f1f418921 (patch) | |
tree | f79d7c5d4be2ecdd067714cf1de0a735f97c7bdf /drivers/gpio/gpio-rcar.c | |
parent | f85834229b1808781b0b56a9d637e19312916300 (diff) |
gpio: rcar: Implement gpiochip.set_multiple()
This allows to set multiple outputs using a single register write.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-rcar.c')
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index d9ab0cd1d205..3fe8e773d95c 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -336,6 +336,25 @@ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value) | |||
336 | spin_unlock_irqrestore(&p->lock, flags); | 336 | spin_unlock_irqrestore(&p->lock, flags); |
337 | } | 337 | } |
338 | 338 | ||
339 | static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask, | ||
340 | unsigned long *bits) | ||
341 | { | ||
342 | struct gpio_rcar_priv *p = gpiochip_get_data(chip); | ||
343 | unsigned long flags; | ||
344 | u32 val, bankmask; | ||
345 | |||
346 | bankmask = mask[0] & GENMASK(chip->ngpio - 1, 0); | ||
347 | if (!bankmask) | ||
348 | return; | ||
349 | |||
350 | spin_lock_irqsave(&p->lock, flags); | ||
351 | val = gpio_rcar_read(p, OUTDT); | ||
352 | val &= ~bankmask; | ||
353 | val |= (bankmask & bits[0]); | ||
354 | gpio_rcar_write(p, OUTDT, val); | ||
355 | spin_unlock_irqrestore(&p->lock, flags); | ||
356 | } | ||
357 | |||
339 | static int gpio_rcar_direction_output(struct gpio_chip *chip, unsigned offset, | 358 | static int gpio_rcar_direction_output(struct gpio_chip *chip, unsigned offset, |
340 | int value) | 359 | int value) |
341 | { | 360 | { |
@@ -476,6 +495,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
476 | gpio_chip->get = gpio_rcar_get; | 495 | gpio_chip->get = gpio_rcar_get; |
477 | gpio_chip->direction_output = gpio_rcar_direction_output; | 496 | gpio_chip->direction_output = gpio_rcar_direction_output; |
478 | gpio_chip->set = gpio_rcar_set; | 497 | gpio_chip->set = gpio_rcar_set; |
498 | gpio_chip->set_multiple = gpio_rcar_set_multiple; | ||
479 | gpio_chip->label = name; | 499 | gpio_chip->label = name; |
480 | gpio_chip->parent = dev; | 500 | gpio_chip->parent = dev; |
481 | gpio_chip->owner = THIS_MODULE; | 501 | gpio_chip->owner = THIS_MODULE; |