aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2019-02-13 08:15:03 -0500
committerLinus Walleij <linus.walleij@linaro.org>2019-02-20 04:30:45 -0500
commit2a9a2f27d35af6c44c2e38437c855f55390c3439 (patch)
treeff2eed9121535a4f0c07f6b76f0f11aa86993b6a
parent2f7db3c70fdfb22480a1b0aa734664fc256532f2 (diff)
gpio: pca953x: Add wake-up support
Implement the irq_set_wake() method in the (optional) irq_chip of the GPIO expander, and propagate wake-up settings to the upstream interrupt controller. This allows GPIOs connected to a PCA953X GPIO expander to serve as wake-up sources. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-pca953x.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index cf50d7dbf6ff..caf7dd1d5e16 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -576,6 +576,14 @@ static void pca953x_irq_unmask(struct irq_data *d)
576 chip->irq_mask[d->hwirq / BANK_SZ] |= 1 << (d->hwirq % BANK_SZ); 576 chip->irq_mask[d->hwirq / BANK_SZ] |= 1 << (d->hwirq % BANK_SZ);
577} 577}
578 578
579static int pca953x_irq_set_wake(struct irq_data *d, unsigned int on)
580{
581 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
582 struct pca953x_chip *chip = gpiochip_get_data(gc);
583
584 return irq_set_irq_wake(chip->client->irq, on);
585}
586
579static void pca953x_irq_bus_lock(struct irq_data *d) 587static void pca953x_irq_bus_lock(struct irq_data *d)
580{ 588{
581 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 589 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -795,6 +803,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
795 irq_chip->name = dev_name(&chip->client->dev); 803 irq_chip->name = dev_name(&chip->client->dev);
796 irq_chip->irq_mask = pca953x_irq_mask; 804 irq_chip->irq_mask = pca953x_irq_mask;
797 irq_chip->irq_unmask = pca953x_irq_unmask; 805 irq_chip->irq_unmask = pca953x_irq_unmask;
806 irq_chip->irq_set_wake = pca953x_irq_set_wake;
798 irq_chip->irq_bus_lock = pca953x_irq_bus_lock; 807 irq_chip->irq_bus_lock = pca953x_irq_bus_lock;
799 irq_chip->irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock; 808 irq_chip->irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock;
800 irq_chip->irq_set_type = pca953x_irq_set_type; 809 irq_chip->irq_set_type = pca953x_irq_set_type;