Re: [PATCH] gpio: pcf857x: Fix missing first interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 16, 2021 at 9:16 PM Maksim Kiselev <bigunclemax@xxxxxxxxx> wrote:
>
> From: Maxim Kiselev <bigunclemax@xxxxxxxxx>
> Date: Tue, 16 Feb 2021 17:00:58 +0300
> Subject: [PATCH] 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.
>
> Fixies: commit 6e20a0a429bd ("gpio: pcf857x: enable gpio_to_irq() support")
> Signed-off-by: Maxim Kiselev <bigunclemax@xxxxxxxxx>
> ---
> drivers/gpio/gpio-pcf857x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
> index a2a8d155c75e3..b7568ee33696d 100644
> --- a/drivers/gpio/gpio-pcf857x.c
> +++ b/drivers/gpio/gpio-pcf857x.c
> @@ -332,7 +332,7 @@ static int pcf857x_probe(struct i2c_client *client,
> * reset state. Otherwise it flags pins to be driven low.
> */
> gpio->out = ~n_latch;
> - gpio->status = gpio->out;
> + gpio->status = gpio->read(gpio->client);
> /* Enable irqchip if we have an interrupt */
> if (client->irq) {
> --
> 2.27.0

Applied with the Fixes tag fixed.

Bartosz



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux