[PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3

Greg S posted 1 patch 2 months ago
drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
[PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3
Posted by Greg S 2 months ago
On Tue, 7 Apr 2026 at XX:XX, Ulf Hansson <ulf.hansson@linaro.org> wrote:
 > The patch looks reasonable to me, but perhaps we also need a fixes tag?

Good point, thanks. Here is v2 with the Fixes tag added.

---

[PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3

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.

Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
Signed-off-by: Greg S <grigoryya@gmail.com>
---
Changes in v2:
  - Added Fixes tag (Ulf Hansson)

  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

Re: [PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3
Posted by Ulf Hansson 1 month ago
On Thu, 9 Apr 2026 at 21:42, Greg S <grigoryya@gmail.com> wrote:
>
> On Tue, 7 Apr 2026 at XX:XX, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>  > The patch looks reasonable to me, but perhaps we also need a fixes tag?
>
> Good point, thanks. Here is v2 with the Fixes tag added.
>
> ---
>
> [PATCH v2] misc: rtsx_usb: reset chip on resume to re-detect card after S3
>
> 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.
>
> Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
> Signed-off-by: Greg S <grigoryya@gmail.com>

Please re-submit and to add char/misc maintainers so they can pick up
or ack this patch.

Kind regards
Uffe

> ---
> Changes in v2:
>   - Added Fixes tag (Ulf Hansson)
>
>   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
>