Skip to contentSkip to conversation

misc: rtsx_usb: reset chip on resume to restore card detection

PATCH In review Greg S 3 participants 5 messages Apr 7 – Jul 6

Subsystems (2)
lore
Share & tools
lore

Greg S

author
#0 lore raw

PATCH 1/1 misc: rtsx_usb: reset chip on resume to restore card detection

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.

---
 drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++

 1 file changed, 12 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +0 -0
index 2b3ae2914ec8..f1a3b5c7e912 100644
@@ -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

#1 lore raw

+ Ricky, Sean

Quoted 12 lines · Greg S

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.

Quoted 5 lines

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.

The patch looks reasonable to me, but perhaps we also need a fixes tag?

I have also looped in some of the relevant driver authors to get confirmation that the change makes sense.

Kind regards
Uffe

Quoted 31 lines
---
  drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +12 -0
index 2b3ae2914ec8..f1a3b5c7e912 100644
@@ -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

author
#2 lore raw

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

Quoted 1 line · Ulf Hansson

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")

---
Changes in v2:
 - Added Fixes tag (Ulf Hansson)

 drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++

 1 file changed, 12 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +0 -0
index 2b3ae2914ec8..f1a3b5c7e912 100644
@@ -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

#3 lore raw

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

Quoted 21 lines · Greg S
Quoted 1 line · Ulf Hansson

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.

Quoted 6 lines

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")

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

Kind regards
Uffe

Quoted 36 lines

---
Changes in v2:
- Added Fixes tag (Ulf Hansson)

  drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +12 -0
index 2b3ae2914ec8..f1a3b5c7e912 100644
@@ -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

#4 lore raw

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

In reply to Greg S
Quoted 21 lines · Greg S
Quoted 1 line · Ulf Hansson

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.

Quoted 6 lines

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")

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

Kind regards
Uffe

Quoted 35 lines

---
Changes in v2:
- Added Fixes tag (Ulf Hansson)

  drivers/misc/cardreader/rtsx_usb.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +12 -0
index 2b3ae2914ec8..f1a3b5c7e912 100644
@@ -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