Re: [PATCH] usb: typec: tipd: cd321x: replay the plug on resume
From: Sven Peter
Date: Tue Nov 17 2026 - 07:03:11 EST
On 17.11.26 12:08, Heikki Krogerus wrote:
On Thu, Nov 12, 2026 at 12:30:05PM +0100, Jacob Procee wrote:
On Apple Silicon the Type-C PHY and the dwc3 controller behind a CD321x
port lose their state during s2idle while the plug stays connected, and
the CD321x does not raise an interrupt on resume. xhci notices the lost
state and re-initializes the host controller:
xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit
usb usb1: root hub lost power or was reset
usb 1-1: USB disconnect, device number 2
but the PHY is only ever programmed from typec_mux_set(), so a device
left plugged in (here a FIDO2 security key) never comes back until it is
unplugged and plugged in again.
Re-initializing only dwc3 after resume does not work: tearing dwc3 down
also powers off the PHY, and nothing turns it back on, so xhci then
times out ("Host halt failed, -110", "can't setup: -110").
Instead, make cd321x replay the plug on resume when a partner was
connected: mark the plug as changed and queue the update work, which
then goes through the same sequence as a real replug (role none, mux
safe, mux back to the partner's mode, role back on). Queue it on
system_freezable_wq so it runs only after all devices have resumed.
Tested on a 14" MacBook Pro (M1 Pro, j314s) with a backport of this
change to the Asahi 7.3.3 kernel: a USB-C security key left plugged in
re-enumerates right after "PM: suspend exit", where it previously stayed
gone until replugged. Unplugging the device while the system is asleep
also works: after resume the role goes to none, nothing is brought back
up, and replugging it later enumerates normally. This mainline version
was build-tested only (W=1, checkpatch --strict clean).
Fixes: 82432bbfb9e8 ("usb: typec: tipd: Handle mode transitions for CD321x")
Assisted-by: LLM
Signed-off-by: Jacob Procee <sn125164@xxxxxxxxx>
Looks okay to me, but as this is a fix, you should CC stable:
https://docs.kernel.org/process/submitting-patches.html#select-the-recipients-for-your-patch
So I really don't think it's a good idea to work around a symptom here and effectively fake a unplug/plug on each suspend.
XHCI is already capable of putting individual ports into a low power state and it should already try to do that during suspend. Resume just doesn't seem to work correctly for some reason on this platform.
I suspect we're just missing the proper suspend/resume work in the PHY itself to put it into a low power state. Or maybe we need to keep an additional power domain enabled so that the PHY doesn't lose all state and keeps working in a lower power mode.
When using XNU it's possible to wake the machine with e.g. a usb keyboard and it doesn't re-enumerate everything on resume and that should be possible here on Linux as well. And I really don't think that's going to be more complex than this patch here.
Sven, would you be interested, or would you have time, to maintain
this driver?
Sure, I can help.
Thanks,
Sven