rtsx_usb: fix tray-reader false card detect and autosuspend
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest2 patches 9 repliesIn review
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | misc: rtsx_usb: avoid USB I/O in runtime autosuspenddrivers/ include/ | +23 | 7 replies | |
| 2/2 | mmc: rtsx_usb_sdmmc: suppress false CD after init timeoutdrivers/ | +12 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Greg Kroah-Hartman |
|---|---|
| Series | A-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/2] rtsx_usb: fix tray-reader false card detect and autosuspend
This series fixes the empty-tray detect loop seen on a Realtek RTS5129 USB SD reader, while also avoiding USB register accesses from the USB runtime autosuspend callback.
Compared with the previous RFC, this no longer qualifies media by issuing SD/MMC commands from ->get_cd(). The rtsx_usb_sdmmc child still reports the raw card-detect state initially, then lets the normal MMC rescan path probe the media. If an initialization command times out before a card is attached, the SD child suppresses the raw SD_CD signal until the tray/card detect line drops again.
The parent rtsx_usb change removes USB I/O from runtime autosuspend and keeps only the existing Memory Stick autosuspend deferral based on cached card-status bits. Raw SD_CD is not used as a parent autosuspend blocker, because this reader can assert it for an empty tray.
Runtime-tested on a StarLite Mk V with Realtek RTS5129 (0bda:0129), using these changes as a matched rtsx_usb/rtsx_usb_sdmmc/rtsx_usb_ms module set on Linux 7.0.0-27-generic.
Device enumeration:
Bus 001 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller /: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 004: Dev 003, If 0, Class=Vendor Specific Class, Driver=rtsx_usb, 480M
Card inserted:
mmc0: new UHS-I speed SDR50 SDXC card at address 544c
mmcblk0: mmc0:544c LX2TB 1.82 TiB
mmcblk0: p1
Deep S3 with the card inserted:
PM: suspend entry (deep)
ACPI: PM: Waking up from system sleep state S3
PM: suspend exit
After resume, the card remained visible:
NAME SIZE TYPE FSTYPE MOUNTPOINTS mmcblk0 1.8T disk `-mmcblk0p1 1.8T part exfat
Empty tray:
mmc0: card 544c removed /sys/bus/usb/devices/1-4/power/control=auto /sys/bus/usb/devices/1-4/power/runtime_status=suspended /sys/bus/usb/devices/1-4/power/runtime_usage=0
With the empty tray left inserted for about three minutes, no repeated MMC detect attempts, command timeouts, or USB reset churn were observed.
Sean Rhodes (2):
misc: rtsx_usb: avoid USB I/O in runtime autosuspend
mmc: rtsx_usb_sdmmc: suppress false CD after init timeout
drivers/misc/cardreader/rtsx_usb.c | 26 ++++++++++++++++++++------ drivers/mmc/host/rtsx_usb_sdmmc.c | 13 ++++++++++++- include/linux/rtsx_usb.h | 3 +++ 3 files changed, 35 insertions(+), 7 deletions(-)