* [PATCH] misc: rtsx: Avoid wakeup events from runtime resume during system sleep
@ 2026-11-27 6:49 Adrian Hunter
0 siblings, 0 replies; only message in thread
From: Adrian Hunter @ 2026-11-27 6:49 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arnd Bergmann
Cc: Rafael J. Wysocki, Ulf Hansson, Ricky Wu, Tabby Kitten,
WisdomWebMan, linux-pm, linux-mmc, linux-kernel
Userspace such as KDE Plasma writes /sys/power/wakeup_count before
entering system sleep, so that the kernel aborts the transition if a
wakeup event is reported. On machines with a Realtek PCIe card reader,
suspend then fails:
PM: Wakeup pending, aborting suspend
PM: active wakeup source: mmc0
During a system sleep transition, the card reader gets runtime resumed,
for example by mmc_claim_host() in mmc_queue_suspend(), or by
pci_pm_suspend() and pci_pm_freeze(). rtsx_pci_runtime_resume() then
calls the SD slot card_event() callback, which calls mmc_detect_change(),
which reports a wakeup event that aborts the transition. Plasma writes
wakeup_count before hibernation too, so hibernation is affected as well.
The rescan is not needed then, because the mmc host class .complete()
callback always triggers a rescan at the end of the transition,
including when it is aborted.
Skip card_event() while dev->power.is_prepared is set. The PM core sets
it after the PCI device is prepared and clears it before the device is
completed. The PCI device is prepared before, and completed after, its
mmc host descendant, so every skipped card_event() is followed by that
rescan.
Fixes: 5b4258f6721f ("misc: rtsx: rts5249 support runtime PM")
Reported-by: Tabby Kitten <nyanpasu256@gmail.com>
Closes: https://lore.kernel.org/linux-mmc/a242799a-d427-48e1-85ef-923f34df843a@gmail.com/
Reported-by: WisdomWebMan <wisdomwebman@proton.me>
Closes: https://lore.kernel.org/linux-mmc/MiymQuzpi87stsM7XA5bfyMV6n_W41wNq15OMA_RnicheHtlyXzpdRw6_hg8wwrkFdSclRgrh6ZqKLg1xpBSUA7cBxO6sX0eIPHg3Mx2tw0=@proton.me/
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Note, this patch has not been tested at all, however WisdomWebMan
offered to do testing.
drivers/misc/cardreader/rtsx_pcr.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index c6e602523538..4b9585c961df 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1800,7 +1800,13 @@ static int rtsx_pci_runtime_resume(struct device *device)
rtsx_pci_init_hw(pcr);
- if (pcr->slots[RTSX_SD_CARD].p_dev != NULL) {
+ /*
+ * card_event() triggers a rescan to catch card changes made while
+ * runtime suspended, but mmc_detect_change() reports a wakeup event
+ * that can abort a system sleep transition. Skip it then: the mmc host
+ * class .complete() callback rescans anyway.
+ */
+ if (pcr->slots[RTSX_SD_CARD].p_dev != NULL && !device->power.is_prepared) {
pcr->slots[RTSX_SD_CARD].card_event(
pcr->slots[RTSX_SD_CARD].p_dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-27 6:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 6:49 [PATCH] misc: rtsx: Avoid wakeup events from runtime resume during system sleep Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox