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

Ulf Hansson <[email protected]> Mon, 6 Jul 2026 12:33:59 +0200
Newsgroups org.kernel.vger.linux-mmc,org.kernel.vger.linux-kernel
Message-ID <CAPx+jO_5gH3378yPrWPiF_sDJMxW2Eg23JEgpKRiPiXhajMaOA@mail.gmail.com>
On Thu, Apr 9, 2026 at 9:41 PM Greg S <[email protected]> wrote:
>
> On Tue, 7 Apr 2026 at XX:XX, Ulf Hansson <[email protected]> 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 <[email protected]>

Please re-send this to include Greg/Arnd, who is responsible for drivers/misc.

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