public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: rtsx_usb: reset chip on resume to restore card detection
@ 2026-04-07 11:56 Greg S
  2026-04-09 15:45 ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Greg S @ 2026-04-07 11:56 UTC (permalink / raw)
  To: ulf.hansson; +Cc: linux-mmc, linux-kernel, rogerable

After S3 suspend the Realtek RTS5129 USB card reader loses its internal
state, but rtsx_usb_resume() does not reinitialize it — it only wakes up
child devices.  As a result, the first command sent to the chip after
resume times out with -ETIMEDOUT and the mmc subsystem never re-detects
the card.  The SD card (mmcblk0) disappears and does not come back until
the next full reboot.

rtsx_usb_reset_resume() already handles this correctly by calling
rtsx_usb_reset_chip() before waking children.  Apply the same logic to
the regular resume path.

Tested on a laptop with an RTS5129 (0x0bda:0x0129) built-in card reader
and a 128 GB SDXC card.  Before the patch, mmcblk0 was lost after every
S3 cycle; after the patch, the card is reliably re-detected on resume.

Signed-off-by: Greg S <grigoryya@gmail.com>
---
  drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/drivers/misc/cardreader/rtsx_usb.c 
b/drivers/misc/cardreader/rtsx_usb.c
index 2b3ae2914ec8..f1a3b5c7e912 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -732,6 +732,18 @@ static int rtsx_usb_resume_child(struct device 
*dev, void *data)

  static int rtsx_usb_resume(struct usb_interface *intf)
  {
+    struct rtsx_ucr *ucr =
+        (struct rtsx_ucr *)usb_get_intfdata(intf);
+
+    /* After S3 suspend the chip loses its internal state and needs a full
+     * reset, identical to what reset_resume already does.  Without this
+     * the first command sent to the chip after resume times out
+     * (-ETIMEDOUT) and the mmc subsystem never re-detects the card
+     * (mmcblk0 disappears until the next reboot).
+     *
+     * Affected: at least RTS5129 on several laptop models.
+     */
+    rtsx_usb_reset_chip(ucr);
      device_for_each_child(&intf->dev, NULL, rtsx_usb_resume_child);
      return 0;
  }
--
2.43.0

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

end of thread, other threads:[~2026-04-09 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 11:56 [PATCH] misc: rtsx_usb: reset chip on resume to restore card detection Greg S
2026-04-09 15:45 ` Ulf Hansson
2026-04-09 19:41   ` [PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3 Greg S

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