The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sean Rhodes <sean@starlabs.systems>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ricky Wu <ricky_wu@realtek.com>,
	Sean Rhodes <sean@starlabs.systems>, Lee Jones <lee@kernel.org>,
	Roger Tseng <rogerable@realtek.com>,
	Dan Carpenter <error27@gmail.com>,
	Jisheng Zhang <jszhang@kernel.org>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] rtsx_usb: fix tray-reader false card detect and autosuspend
Date: Mon,  6 Jul 2026 16:40:42 +0100	[thread overview]
Message-ID: <cover.1783352430.git.sean@starlabs.systems> (raw)

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


             reply	other threads:[~2026-07-06 15:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 15:40 Sean Rhodes [this message]
2026-07-06 15:40 ` [PATCH v2 1/2] misc: rtsx_usb: avoid USB I/O in runtime autosuspend Sean Rhodes
2026-07-06 15:40 ` [PATCH v2 2/2] mmc: rtsx_usb_sdmmc: suppress false CD after init timeout Sean Rhodes

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=cover.1783352430.git.sean@starlabs.systems \
    --to=sean@starlabs.systems \
    --cc=arnd@arndb.de \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jszhang@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ricky_wu@realtek.com \
    --cc=rogerable@realtek.com \
    --cc=ulfh@kernel.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