[PATCH] gpio: pca953x: mask interrupts in irq shutdown

Martin Larsson posted 1 patch 2 weeks, 4 days ago
drivers/gpio/gpio-pca953x.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] gpio: pca953x: mask interrupts in irq shutdown
Posted by Martin Larsson 2 weeks, 4 days ago
In the existing implementation irq_shutdown does not mask the interrupts
in hardware. This can cause spurious interrupts from the IO expander.
Add masking to irq_shutdown to prevent spurious interrupts.

Signed-off-by: Martin Larsson <martin.larsson@actia.se>
---
 drivers/gpio/gpio-pca953x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 8727ae54bc57..f93a3dbb2daa 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -914,6 +914,8 @@ static void pca953x_irq_shutdown(struct irq_data *d)
 	clear_bit(hwirq, chip->irq_trig_fall);
 	clear_bit(hwirq, chip->irq_trig_level_low);
 	clear_bit(hwirq, chip->irq_trig_level_high);
+
+	pca953x_irq_mask(d);
 }
 
 static void pca953x_irq_print_chip(struct irq_data *data, struct seq_file *p)
-- 
2.51.0
Re: [PATCH] gpio: pca953x: mask interrupts in irq shutdown
Posted by Bartosz Golaszewski 1 week, 5 days ago
On Wed, 21 Jan 2026 12:57:22 +0000, Martin Larsson wrote:
> In the existing implementation irq_shutdown does not mask the interrupts
> in hardware. This can cause spurious interrupts from the IO expander.
> Add masking to irq_shutdown to prevent spurious interrupts.
> 
> 

Cc'ed stable and applied for fixes, thanks!

[1/1] gpio: pca953x: mask interrupts in irq shutdown
      commit: b168ba38e82d354c4875befdb34498a94045cb21

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Re: [PATCH] gpio: pca953x: mask interrupts in irq shutdown
Posted by Linus Walleij 1 week, 5 days ago
Add a few recent developers to CC, this is a very widely used GPIO chip.

Emanuele was dealing with IRQ storms and may want to look at this.

On Wed, Jan 21, 2026 at 2:12 PM Martin Larsson <martin.larsson@actia.se> wrote:

> In the existing implementation irq_shutdown does not mask the interrupts
> in hardware. This can cause spurious interrupts from the IO expander.
> Add masking to irq_shutdown to prevent spurious interrupts.
>
> Signed-off-by: Martin Larsson <martin.larsson@actia.se>
> ---
>  drivers/gpio/gpio-pca953x.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 8727ae54bc57..f93a3dbb2daa 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -914,6 +914,8 @@ static void pca953x_irq_shutdown(struct irq_data *d)
>         clear_bit(hwirq, chip->irq_trig_fall);
>         clear_bit(hwirq, chip->irq_trig_level_low);
>         clear_bit(hwirq, chip->irq_trig_level_high);
> +
> +       pca953x_irq_mask(d);

It makes sense to me.

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij
Re: [PATCH] gpio: pca953x: mask interrupts in irq shutdown
Posted by Emanuele Ghidoli 1 week, 5 days ago

On 27/01/2026 10:29, Linus Walleij wrote:
> Add a few recent developers to CC, this is a very widely used GPIO chip.
> 
> Emanuele was dealing with IRQ storms and may want to look at this.
> 
> On Wed, Jan 21, 2026 at 2:12 PM Martin Larsson <martin.larsson@actia.se> wrote:
> 
>> In the existing implementation irq_shutdown does not mask the interrupts
>> in hardware. This can cause spurious interrupts from the IO expander.
>> Add masking to irq_shutdown to prevent spurious interrupts.
>>
>> Signed-off-by: Martin Larsson <martin.larsson@actia.se>
>> ---
>>  drivers/gpio/gpio-pca953x.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
>> index 8727ae54bc57..f93a3dbb2daa 100644
>> --- a/drivers/gpio/gpio-pca953x.c
>> +++ b/drivers/gpio/gpio-pca953x.c
>> @@ -914,6 +914,8 @@ static void pca953x_irq_shutdown(struct irq_data *d)
>>         clear_bit(hwirq, chip->irq_trig_fall);
>>         clear_bit(hwirq, chip->irq_trig_level_low);
>>         clear_bit(hwirq, chip->irq_trig_level_high);
>> +
>> +       pca953x_irq_mask(d);
> 
> It makes sense to me.
> 
> Reviewed-by: Linus Walleij <linusw@kernel.org>
> 
> Yours,
> Linus Walleij

Looks good to me, thanks.

Emanuele