Repository navigation
usb: typec: tipd: put an empty CD321x port to sleep, as macOS - #5
Closed
nekolyanich wants to merge 1 commit into
Closed
nekolyanich wants to merge 1 commit into
nekolyanich wants to merge 1 commit into
Conversation
On an M2 Pro (j416s), replugs of a USB-C to HDMI adapter in DP alt mode often never reach the display: 10 of 24 on integration/aurora under the m1n1 hypervisor, 26 of 56 natively. After the unplug of a session with DP, the controller keeps the cable power path "in" and the session's data status; the next plug gets no VBUS and never reaches PD (2 of 2 in a trace). Unplugging that plug clears the state, so plugs alternate. macOS, traced on the same port, puts the port into system power state 2 on every disconnect: 0x2000 to the undocumented register 0x50, SSPS 2, 0x2000 and 0 to 0x50 (8 of 8). It sends SSPS 0 as soon as STATUS shows the next plug, and puts the empty MagSafe controller to sleep at boot. Do the same from the cable work, on the CD321x only (port_sleep): when it finds no plug on a port not known to be asleep, the sequence above, after reading STATUS again (a plug skips it); when it sees a plug on a port not known to be awake, SSPS 0 before anything else. Removing the driver also restores S0. A failure only warns and leaves the state unknown, as do resume and the controller setup recovery, so the next pass tries again. Testing: MacBook Pro 16" M2 Pro (j416s), DCP firmware 13.5, a TV on the adapter and a Dell over Thunderbolt, under the m1n1 hypervisor. On integration/aurora, 8 of 8 TV replugs reached the display; an I2C trace showed the sleep (state 2 read back) at each unplug and SSPS 0 (state 0) at each plug. Unbinding on the empty port restored S0, rebinding slept it, a plug and a replug about 1.4 s after an unplug came back. No failed sleep or wake, no kernel warning. Earlier: 0 of 24 lost against 4 of 16 on aurora-wip, and 16 of 16 natively on a downstream tree. Assisted-by: Claude:claude-opus-5-5 checkpatch Signed-off-by: nekolyanich <me@nekolyanich.com>
nekolyanich
force-pushed
the
pr/cd321x-unplug-sleep-73
branch
from
October 24, 2026 14:41
2e84450 to
e1d066f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces aurora-silicon#296, which was opened on aurora-wip (since retired). Same change on integration/aurora, with the wake moved earlier, S0 restored when the driver is removed, and aurora's controller setup recovery taken into account.
On an M2 Pro (j416s), replugs of a USB-C to HDMI adapter in DP alt mode often never reach the display. On integration/aurora under the m1n1 hypervisor, 10 of 24 guided replugs were lost (6, 4 and 4 of 8 reached the display in three sessions), every other plug from some cycle on. Natively on our tree before this change, 26 of 56. A lost plug gets the Type-C partner, but nothing enumerates behind the adapter, the port gets no DP route and DCP no HPD.
Cause. After the unplug of a session with DP, the CD321x stays half-connected: a trace of its status showed the cable power path still "in" and the session's data status kept, and the next plug got no VBUS and never reached PD (2 of 2). Unplugging that plug clears the state, hence the alternation. macOS, traced on the same port with the same TV and adapter, puts the port into system power state 2 on every disconnect (
0x2000to the undocumented register 0x50,SSPS 2,0x2000and0to 0x50; 8 of 8) and sendsSSPS 0as soon as STATUS shows the next plug. At boot it also puts the empty MagSafe controller to sleep.The change (CD321x only,
port_sleepintipd_cd321x_data; the driver tracks the port as unknown, awake or asleep):SSPS 0, before any teardown or partner registration;SSPS 0;Testing: MacBook Pro 16" M2 Pro (j416s), DCP firmware 13.5, a TV on the adapter, a Dell over Thunderbolt on another port, under the m1n1 hypervisor (with a bench-only DT change):
SSPS 0(state read back 0) at each of the 8 plugs;SSPS 0, binding it again puts the port to sleep at probe, then a plug and a replug about 1.4 s after an unplug both bring the TV back;Not tested: