Skip to content

usb: typec: tipd: Wait for the power role swap to settle - #1402

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
tipd/pr-swap-settle
Nov 10, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
tipd/pr-swap-settle

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

tps6598x_pr_set() read STATUS right after the SWSk/SWSr task completed and returned -EPROTO unless the port role had already changed. The task completes when the PR_Swap is accepted; the role changes only after the power transition. The swap now polls STATUS for the new role (10 ms steps, at most 1400 ms: tPSSourceOff 920 ms + tPSSourceOn 480 ms) and reports -EPROTO only if it never changes.

Tested on a MacBook Air (M2, J413) linked over Thunderbolt to a MacBook Pro (J616s), fleet46 base + this commit:

  • before: echo sink > /sys/class/typec/port1/power_role failed with "Protocol error" after 109 ms, and the port read sink about 0.8 s later.
  • after: four swaps (source, sink, source, sink) all returned 0 in 98-116 ms, the port role followed each one, and the Thunderbolt link stayed up (no host disconnect, 0-1 and 0-1.0 present throughout).
  • kernel errors 0, SELinux denials 0, failed units 0.

🤖 Generated with Claude Code

tps6598x_pr_set() reads STATUS as soon as the SWSk or SWSr task
completes and returns -EPROTO unless the port role has already changed.
The task completes when the PR_Swap has been accepted, but the port role
changes only after the power supply transition that follows. On a
MacBook Air (M2) with its port linked to another Mac,

  echo sink > /sys/class/typec/port1/power_role

fails with "Protocol error", yet the swap completes: a moment later the
port reads sink, the battery charges again and the link stays up.

Poll STATUS until the port role matches, for at most the time the
PR_Swap timers allow the two PS_RDY messages, and report -EPROTO only
if it never does.

Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
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.

1 participant