Repository navigation
usb: typec: tipd: Wait for the power role swap to settle - #1402
Merged
Merged
Conversation
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>
This was referenced Nov 11, 2026
Merged
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.
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:
echo sink > /sys/class/typec/port1/power_rolefailed with "Protocol error" after 109 ms, and the port read sink about 0.8 s later.🤖 Generated with Claude Code