]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: pcf857x: Fix missing first interrupt
authorMaxim Kiselev <bigunclemax@gmail.com>
Wed, 17 Feb 2021 13:10:00 +0000 (14:10 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 18 Feb 2021 14:52:44 +0000 (15:52 +0100)
commita8002a35935aaefcd6a42ad3289f62bab947f2ca
treea7496c7662fc06e50935844f109b2f6063ae0343
parent35d9e69592419fa2d138f64a2e4286635cdd98ac
gpio: pcf857x: Fix missing first interrupt

If no n_latch value will be provided at driver probe then all pins will
be used as an input:

    gpio->out = ~n_latch;

In that case initial state for all pins is "one":

    gpio->status = gpio->out;

So if pcf857x IRQ happens with change pin value from "zero" to "one"
then we miss it, because of "one" from IRQ and "one" from initial state
leaves corresponding pin unchanged:
change = (gpio->status ^ status) & gpio->irq_enabled;

The right solution will be to read actual state at driver probe.

Cc: stable@vger.kernel.org
Fixes: 6e20a0a429bd ("gpio: pcf857x: enable gpio_to_irq() support")
Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-pcf857x.c