public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg S <grigoryya@gmail.com>
To: ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	rogerable@realtek.com
Subject: [PATCH] misc: rtsx_usb: reset chip on resume to restore card detection
Date: Tue, 7 Apr 2026 14:56:39 +0300	[thread overview]
Message-ID: <964d54a3-90ce-475e-952f-342bb383f878@gmail.com> (raw)

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

             reply	other threads:[~2026-04-07 11:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 11:56 Greg S [this message]
2026-04-09 15:45 ` [PATCH] misc: rtsx_usb: reset chip on resume to restore card detection Ulf Hansson
2026-04-09 19:41   ` [PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3 Greg S

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=964d54a3-90ce-475e-952f-342bb383f878@gmail.com \
    --to=grigoryya@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rogerable@realtek.com \
    --cc=ulf.hansson@linaro.org \
    /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