mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jianfeng.gao@intel.com
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Li Yifan <yifan2.li@intel.com>
Subject: [PATCH] usb: typec: tipd: mask interrupt across suspend to fix IRQ storm
Date: Tue,  1 Dec 2026 16:46:50 +0800	[thread overview]
Message-ID: <20261201084650.3697134-1-jianfeng.gao@intel.com> (raw)

From: JianFeng Gao <jianfeng.gao@intel.com>

When tps->wakeup is false, tps6598x_suspend() left the IRQ enabled because
disable_irq() was gated inside the "if (tps->wakeup)" branch.

During hibernation the parent I2C (designware) adapter suspends right
after the child's freeze callback, so with the IRQ still enabled and the
type-C line still asserted, tps6598x_interrupt() keeps re-firing. Its
register reads now fail with -ESHUTDOWN, the handler bails with
event1/event2 == 0 and returns IRQ_NONE, so the line is never acked and
the handler loops, flooding the log with "failed to read ..." errors
until the noirq phase finally masks interrupts.

Mask the interrupt unconditionally in suspend and re-enable it in resume,
keeping enable_irq()/disable_irq() balanced. The wake-source arming stays
conditional on tps->wakeup.

Fixes: 481735d64794 ("usb: typec: tipd: Support wakeup")
Cc: stable@vger.kernel.org
Co-developed-by: Li Yifan <yifan2.li@intel.com>
Signed-off-by: Li Yifan <yifan2.li@intel.com>
Signed-off-by: JianFeng Gao <jianfeng.gao@intel.com>
Tested-by: Munirah Izyani Mohammad Amin <munirah.izyani.mohammad.amin@intel.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/tipd/core.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 02539378ffed..aba000a36a06 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1973,12 +1973,19 @@ static int __maybe_unused tps6598x_suspend(struct device *dev)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct tps6598x *tps = i2c_get_clientdata(client);
 
-	if (tps->wakeup) {
+	/*
+	 * Mask the interrupt before the parent I2C controller is suspended:
+	 * otherwise a still-asserted level IRQ keeps re-entering the handler,
+	 * whose register reads then fail with -ESHUTDOWN, producing an
+	 * interrupt storm until the noirq phase globally disables interrupts.
+	 */
+	if (client->irq)
 		disable_irq(client->irq);
+
+	if (tps->wakeup)
 		enable_irq_wake(client->irq);
-	} else if (tps->reset) {
+	else if (tps->reset)
 		gpiod_set_value_cansleep(tps->reset, 1);
-	}
 
 	if (!client->irq)
 		cancel_delayed_work_sync(&tps->wq_poll);
@@ -2004,12 +2011,15 @@ static int __maybe_unused tps6598x_resume(struct device *dev)
 
 	if (tps->wakeup) {
 		disable_irq_wake(client->irq);
-		enable_irq(client->irq);
 	} else if (tps->reset) {
 		gpiod_set_value_cansleep(tps->reset, 0);
 		msleep(TPS_SETUP_MS);
 	}
 
+	/* Balance the unconditional disable_irq() in tps6598x_suspend() */
+	if (client->irq)
+		enable_irq(client->irq);
+
 	if (!client->irq)
 		queue_delayed_work(system_power_efficient_wq, &tps->wq_poll,
 				   msecs_to_jiffies(POLL_INTERVAL));
-- 
2.34.1


             reply	other threads:[~2026-12-01  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  8:46 jianfeng.gao [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-18  5:18 jianfeng.gao

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=20261201084650.3697134-1-jianfeng.gao@intel.com \
    --to=jianfeng.gao@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=yifan2.li@intel.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®