From: Advait Dhamorikar <advaitd@mechasystems.com>
To: myungjoo.ham@samsung.com, cw00.choi@samsung.com,
linux-kernel@vger.kernel.org
Cc: alsi@bang-olufsen.dk, gregkh@linuxfoundation.org, marex@denx.de,
heikki.krogerus@linux.intel.com,
Advait Dhamorikar <advaitd@mechasystems.com>
Subject: [PATCH] extcon: usbc-tusb320: always rewrite REG9 to deassert INT_N
Date: Tue, 28 Jul 2026 21:07:44 +0530 [thread overview]
Message-ID: <20260728153744.321743-1-advaitd@mechasystems.com> (raw)
The IRQ handler currently returns IRQ_NONE without rewriting REG9 when
INTERRUPT_STATUS is clear, skipping the documented interrupt acknowledge
sequence which says that rewrites to this register are needed for the
INT_N to be correctly asserted for all interrupt events.
On some hardware, this can leave INT_N asserted, causing repeated
level-triggered interrupts until the kernel disables the IRQ as
spurious.
Always rewrite REG9 before returning from the IRQ handler, regardless
of the observed INTERRUPT_STATUS bit, and return IRQ_HANDLED once the
acknowledge sequence has been performed. Also report REG9 write
failures to aid debugging.
Fixes: 581c848b610d ("extcon: usbc-tusb320: Update state on probe even if no IRQ pending")
Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
---
drivers/extcon/extcon-usbc-tusb320.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 920b03421850..56c888004f41 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -375,14 +375,25 @@ static irqreturn_t tusb320_state_update_handler(struct tusb320_priv *priv,
bool force_update)
{
unsigned int reg;
+ int ret;
- if (regmap_read(priv->regmap, TUSB320_REG9, ®)) {
- dev_err(priv->dev, "error during i2c read!\n");
+ ret = regmap_read(priv->regmap, TUSB320_REG9, ®);
+ if (ret) {
+ dev_err(priv->dev, "REG9 read failed: %d\n", ret);
return IRQ_NONE;
}
- if (!force_update && !(reg & TUSB320_REG9_INTERRUPT_STATUS))
- return IRQ_NONE;
+ if (!force_update && !(reg & TUSB320_REG9_INTERRUPT_STATUS)) {
+ dev_dbg(priv->dev, "IRQ fired but interrupt status not set\n");
+ /*
+ * Rewrites to this register are needed for the INT_N
+ * to be correctly asserted for all interrupt events.
+ */
+ ret = regmap_write(priv->regmap, TUSB320_REG9, reg);
+ if (ret)
+ dev_err(priv->dev, "REG9 write failed: %d\n", ret);
+ return IRQ_HANDLED;
+ }
tusb320_extcon_irq_handler(priv, reg);
@@ -393,7 +404,9 @@ static irqreturn_t tusb320_state_update_handler(struct tusb320_priv *priv,
if (priv->port)
tusb320_typec_irq_handler(priv, reg);
- regmap_write(priv->regmap, TUSB320_REG9, reg);
+ ret = regmap_write(priv->regmap, TUSB320_REG9, reg);
+ if (ret)
+ dev_err(priv->dev, "REG9 write failed: %d\n", ret);
return IRQ_HANDLED;
}
--
2.43.0
next reply other threads:[~2026-07-28 15:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 15:37 Advait Dhamorikar [this message]
2026-07-29 7:27 ` Alvin Šipraga
2026-07-29 11:08 ` Advait Dhamorikar
2026-07-29 11:28 ` Alvin Šipraga
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=20260728153744.321743-1-advaitd@mechasystems.com \
--to=advaitd@mechasystems.com \
--cc=alsi@bang-olufsen.dk \
--cc=cw00.choi@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=myungjoo.ham@samsung.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®