Skip to content

usb: typec: tipd: Take a partner identity that arrives late on CD321x - #883

Merged
erykwieliczko merged 1 commit into
aurora-silicon:integration/aurorafrom
erikwb:j713/tipd-late-identity
Nov 4, 2026
Merged

erykwieliczko merged 1 commit into
aurora-silicon:integration/aurorafrom
erikwb:j713/tipd-late-identity

Conversation

@erikwb

@erikwb erikwb commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

With a USB4 dock on the M4 MacBook Air's front port, every s2idle resume tore the dock down and set it up again: the USB4 link, the PCIe tunnel and the dock's Ethernet all dropped for several seconds, even though the dock never moved.

The CD321x code registers the partner as soon as the PD contract is reported, and reads its identity only with a power status update. After a hotplug the dock's Discover Identity response can arrive later than that, so the partner gets an identity of all zeros. On resume the identity is read again, it no longer matches, and the update decides a new partner was plugged in.

This reads the identity again with each data status update under a PD contract. A mode such as USB4 is entered only after Discover Identity, so the stored identity is right shortly after plug-in. An identity that was never received also no longer counts as a partner change, and the one read later is stored instead. A dock swapped during sleep is still caught, by a real compare.

Tested on a J713 with a CalDigit TS5 on the front port:

  • after a hotplug the identity used to stay all zeros; it now reads as the dock's (also in sysfs) within a second
  • s2idle with the dock attached resumes with no partner change and no teardown; Ethernet is back about 3 s after wake
  • the back port and plain USB devices behave as before

This was developed and tested by Claude (Anthropic), working with me on the J713.

The partner is registered when its PD contract is reported, and its
identity is read only with a power status update. A partner whose
Discover Identity response comes later, such as a USB4 dock after a
hotplug, is registered with an identity of all zeros. The identity read
again on resume then differs, and the update takes the same dock for a
new partner: it tears the connection down and sets it up again, which
drops a running USB4 link.

Read the identity again with each data status update under a PD
contract, as a mode is entered only after Discover Identity. Do not
count an identity that was never received as a partner change, and
store the one read later instead.

Signed-off-by: Erik Bourget <[email protected]>
[eryk: the apple-dcp selftests compile cd321x_update_work(), and three
 units no longer built: extract cd321x_identity_known() with it and give
 the fixture a memchr_inv(); 85/85 units pass again]
Signed-off-by: Eryk Wieliczko <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@erykwieliczko

Copy link
Copy Markdown
Member

Merging with one test fix. This comment is from Claude Opus 5.5, working for Eryk, not from Eryk himself.

Rebased onto integration/aurora 0cfb3017e8a5 and force-pushed, as Erik agreed. The driver change is unchanged.

Changes

  • tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py: its disconnect fixtures copy cd321x_update_work(), which now calls cd321x_identity_known(), so three units stopped building. The fixture now extracts that helper and adds a memchr_inv() shim.

Left alone

On a data status update the identity is read whenever the cached power status says PD. That cache only refreshes on power status updates, so an unplug can cost one extra RX_IDENTITY read.

Testing

  • KUnit: the CD321x suites pass. Host tests: apple-dcp 85/85.
  • It ran in Eryk's J713 test kernels, but the late identity case itself was not checked on hardware.
  • Built together with the rest of this batch on integration/aurora (arm64: Image, modules, DTB).

🤖 Written by Claude Opus 5.5 (in Claude Code) for Eryk.

@erykwieliczko
erykwieliczko force-pushed the j713/tipd-late-identity branch from e771782 to 474af78 Compare November 4, 2026 08:42
@erykwieliczko
erykwieliczko merged commit 8379bc2 into aurora-silicon:integration/aurora Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants