summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-pca953x.c
diff options
context:
space:
mode:
authorGrigoryev Denis <grigoryev@fastwel.ru>2018-05-04 19:53:18 +0300
committerLinus Walleij <linus.walleij@linaro.org>2018-05-23 12:47:26 +0300
commit0a70fe00efea7c6ac087a10aa57131e59d63e194 (patch)
tree34b2b86251c9e770813ce87a9f7998dc37ef4ab5 /drivers/gpio/gpio-pca953x.c
parent060f3ebf6a9a4a92dd92149e6ebffae10679ed17 (diff)
downloadlinux-0a70fe00efea7c6ac087a10aa57131e59d63e194.tar.xz
gpio: pca953x: Clear irq trigger type on irq shutdown
The driver stores the result of irq_set_type() in the internal variables irq_trig_raise and irq_trig_fall, which later are used to determine the GPIOs that must be re-configured as input. These variables retain their value between gpiolib's export / unexport, resulting in an incorrect state in some cases. The corresponding bits in the variables irq_trig_raise and irq_trig_fall should be cleared in irq_shutdown(). Signed-off-by: Denis Grigoryev <grigoryev@fastwel.ru> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pca953x.c')
-rw-r--r--drivers/gpio/gpio-pca953x.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 6e3ddeae127f..d01e09d37573 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -532,6 +532,15 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
return 0;
}
+static void pca953x_irq_shutdown(struct irq_data *d)
+{
+ struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
+ u8 mask = 1 << (d->hwirq % BANK_SZ);
+
+ chip->irq_trig_raise[d->hwirq / BANK_SZ] &= ~mask;
+ chip->irq_trig_fall[d->hwirq / BANK_SZ] &= ~mask;
+}
+
static struct irq_chip pca953x_irq_chip = {
.name = "pca953x",
.irq_mask = pca953x_irq_mask,
@@ -539,6 +548,7 @@ static struct irq_chip pca953x_irq_chip = {
.irq_bus_lock = pca953x_irq_bus_lock,
.irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock,
.irq_set_type = pca953x_irq_set_type,
+ .irq_shutdown = pca953x_irq_shutdown,
};
static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)