From: sashiko-bot@kernel.org
To: "Maria Garcia" <mariagarcia7293@gmail.com>, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 2/2] gpio: pca953x: Fix TCA6418 interrupt handling
Date: Mon, 23 Nov 2026 11:47:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-229168@kernel.org> (raw)
In-Reply-To: <20261123113234.197852-3-mariagarcia7293@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] gpio: pca953x: wrong TCA6418 direction check in
pca953x_irq_bus_sync_unlock()
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] gpio: pca953x: broken TCA6418 volatility in
tca6418_check_register() and IRQs [1]
--
commit 5ed3e002b749b9b8aa9dbd3081f6ed840b5b291d
Author: Maria Garcia <mariagarcia7293@gmail.com>
gpio: pca953x: Fix TCA6418 interrupt handling
This commit adds TCA6418-specific interrupt register programming and status
handling to pca953x_irq_bus_sync_unlock(), pca953x_irq_pending(), and
pca953x_irq_setup(), and restricts TCA6418 to rising or falling edge triggers.
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 8d9f5563e222a..5a39c5a5c8a36 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -910,6 +910,12 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
>
> /* Unmask enabled interrupts */
> pca953x_write_regs(chip, PCAL953X_INT_MASK, irq_mask);
> + } else if (PCA_CHIP_TYPE(chip->driver_data) == TCA6418_TYPE) {
> + /* 0 = falling edge, 1 = rising edge */
> + pca953x_write_regs(chip, TCA6418_GPIO_INT_LVL, chip->irq_trig_raise);
> +
> + /* Unmask enabled interrupts */
> + pca953x_write_regs(chip, TCA6418_GPIO_INT_EN, chip->irq_mask);
> }
>
> /* Switch direction to input if needed */
[Severity: Medium]
Does the direction switch below work on TCA6418?
pca953x_irq_bus_sync_unlock() falls through to:
drivers/gpio/gpio-pca953x.c:pca953x_irq_bus_sync_unlock() {
...
/* Look for any newly setup interrupt */
for_each_andnot_bit(level, irq_mask, reg_direction, gc->ngpio)
pca953x_gpio_direction_input_unlocked(&chip->gpio_chip, level);
}
On TCA6418, a bit in TCA6418_DIRECTION is 0 for input and 1 for output
(unlike standard PCA953x where 1 is input and 0 is output). Because
for_each_andnot_bit() iterates over pins where reg_direction is 0, any
interrupt pin that was previously configured as an output (reg_direction
bit 1) is skipped and remains driving as an output, while pins already in
input mode (bit 0) are reconfigured on every IRQ bus unlock.
[Severity: High]
This problem wasn't introduced by this patch, but as part of [1],
pca953x_irq_bus_sync_unlock() still treats set bits in reg_direction as
inputs on TCA6418 instead of outputs, leaving newly requested interrupt
pins configured as outputs when switching direction to input.
[1] https://sashiko.dev/#/bug/linux-a8794f43-5e5f-405d-ba31-cf360dc2e1af
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123113234.197852-1-mariagarcia7293@gmail.com?part=2
next prev parent reply other threads:[~2026-11-23 11:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 11:32 [PATCH 0/2] gpio: pca953x: Fix TCA6418 multi-bank I/O, caching, and IRQs Maria Garcia
2026-11-23 11:32 ` [PATCH 1/2] gpio: pca953x: Fix TCA6418 bulk transfers and input caching Maria Garcia
2026-11-23 11:48 ` sashiko-bot
2026-11-23 11:32 ` [PATCH 2/2] gpio: pca953x: Fix TCA6418 interrupt handling Maria Garcia
2026-11-23 11:47 ` sashiko-bot [this message]
2026-11-23 11:42 ` [PATCH 0/2] gpio: pca953x: Fix TCA6418 multi-bank I/O, caching, and IRQs María García Fernández
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-229168@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mariagarcia7293@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.