]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: pca953x: Add wake-up support
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 13 Feb 2019 13:15:03 +0000 (14:15 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 20 Feb 2019 09:30:45 +0000 (10:30 +0100)
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>
drivers/gpio/gpio-pca953x.c

index cf50d7dbf6ffd62755d9467ee2761f444c65d763..caf7dd1d5e164d8fc7b9849d1fb46519c457dd30 100644 (file)
@@ -576,6 +576,14 @@ static void pca953x_irq_unmask(struct irq_data *d)
        chip->irq_mask[d->hwirq / BANK_SZ] |= 1 << (d->hwirq % BANK_SZ);
 }
 
+static int pca953x_irq_set_wake(struct irq_data *d, unsigned int on)
+{
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+       struct pca953x_chip *chip = gpiochip_get_data(gc);
+
+       return irq_set_irq_wake(chip->client->irq, on);
+}
+
 static void pca953x_irq_bus_lock(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -795,6 +803,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
        irq_chip->name = dev_name(&chip->client->dev);
        irq_chip->irq_mask = pca953x_irq_mask;
        irq_chip->irq_unmask = pca953x_irq_unmask;
+       irq_chip->irq_set_wake = pca953x_irq_set_wake;
        irq_chip->irq_bus_lock = pca953x_irq_bus_lock;
        irq_chip->irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock;
        irq_chip->irq_set_type = pca953x_irq_set_type;