Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] platform: arm64: lenovo-thinkpad-t14s: Keep the interrupt off while suspended
@ 2026-11-18 15:39 Abel Vesa
  2026-11-18 16:10 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Abel Vesa @ 2026-11-18 15:39 UTC (permalink / raw)
  To: Sebastian Reichel, Hans de Goede, Ilpo Järvinen,
	Bryan O'Donoghue
  Cc: platform-driver-x86, stable, Abel Vesa

The interrupt handler reads the event from the EC over I2C. Nothing
keeps it from running while the system is suspending or resuming, when
the I2C controller cannot be used.

On resume the interrupts are enabled again after the noirq phase, while
runtime PM of the I2C controller stays disabled until its early resume.
An EC interrupt that is pending by then fails, and so does every further
one until the controller is back. On the ThinkPad T14s Gen 7 that showed
up as more than a thousand of these in a few milliseconds when resuming
from hibernation:

  geni_i2c a84000.i2c: error turning SE resources:-13
  thinkpad-t14s-ec 7-0028: Failed to read event

Disable the interrupt when suspending and enable it at the end of
resume, once the EC can be talked to. An event that arrives in between
is handled then.

Fixes: 60b7ab6ce030 ("platform: arm64: thinkpad-t14s-ec: new driver")
Cc: stable@vger.kernel.org
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
---
The EC interrupt handler talks to the EC over I2C, and nothing stops it
from running while the I2C controller is not usable during a system
sleep transition.

This was found on the ThinkPad T14s Gen 7 while getting hibernation to
work there. The support for the EC of that machine is not upstream yet,
but the interrupt handler and the suspend and resume callbacks are the
ones the X1E based ThinkPad T14s uses.

Resuming from hibernation failed the read of the EC event more than a
thousand times in a few milliseconds there. That many, because the
interrupt was level triggered in the GIC at that point, as the SPI
configuration is not restored after hibernation [1]. With that fixed,
the handler still runs once before the I2C controller is back.

With this patch there are no failed reads on the ThinkPad T14s Gen 7
when resuming from hibernation. It was not tested on the X1E based
ThinkPad T14s.

[1] https://lore.kernel.org/r/20261024144720.113165-2-zhuling2709@phytium.com.cn

Prepared with help from an LLM-based assistant.
---
 drivers/platform/arm64/lenovo-thinkpad-t14s.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/platform/arm64/lenovo-thinkpad-t14s.c b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
index 873747838a4f..a291daba0577 100644
--- a/drivers/platform/arm64/lenovo-thinkpad-t14s.c
+++ b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
@@ -616,6 +616,12 @@ static int t14s_ec_suspend(struct device *dev)
 {
 	struct t14s_ec *ec = dev_get_drvdata(dev);
 
+	/*
+	 * The handler needs the I2C controller, which is not available
+	 * again until this device is resumed.
+	 */
+	disable_irq(to_i2c_client(dev)->irq);
+
 	led_classdev_suspend(&ec->kbd_backlight);
 
 	t14s_ec_write_sequence(ec, T14S_EC_REG_MODERN_STANDBY,
@@ -633,6 +639,8 @@ static int t14s_ec_resume(struct device *dev)
 
 	led_classdev_resume(&ec->kbd_backlight);
 
+	enable_irq(to_i2c_client(dev)->irq);
+
 	return 0;
 }
 

---
base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
change-id: 20261118-platform-arm64-t14s-ec-irq-suspended-5fd6892d7e26

Best regards,
--  

Abel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 15:39 [PATCH] platform: arm64: lenovo-thinkpad-t14s: Keep the interrupt off while suspended Abel Vesa
2026-11-18 16:10 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox