Repository navigation
usb: typec: tipd: enable DP_SID_UPDATE and replay coalesced HPD drops on polled T8142 - #3649
Conversation
… on polled T8142 On Apple T8142 (M5) systems, the SN201202x Type-C controllers on nub_spmi_a0 run in polled mode (500 ms poll interval). Two issues combine to drop short sink HPD low pulses such as an EIZO EV2780 waking from standby (~250 ms HPD low while switching its internal hub from USB 2.0 to USB 3.0): 1. cd321x_uses_dp_sid() excluded apple,t8142 alongside apple,t8140, masking out SN201202X_INT_DP_SID_UPDATE. Unlike T8140 (J700), T8142 external DCP is not a retained display pipe (dcp_is_retained_external() is false for dcp_t8142_ext()) and tears down and retrains cleanly on HPD replay. 2. When a sink drops HPD and raises it again between two 500 ms polls, SN201202X_INT_DP_SID_UPDATE latches, but DP_SID_STATUS.status_rx has already returned to the previously applied HPD-high status by the time the poll reads it. Enable DP_SID_UPDATE on apple,t8142 (keeping apple,t8140 excluded) and add cd321x_dp_sid_coalesced_hpd_low() so that a polled SN201202x seeing an unchanged HPD-high DP_SID_UPDATE without IRQ_HPD on an already-active DP route replays HPD low via cd321x_dp_sid_replay(). Update the cd321x-pm KUnit suite and the apple-dcp host selftest header shim accordingly. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at 4747d512bd54
Blockers:
- Merge dependency on
#3523:#3523(drm/apple: invalidate mode state on disconnected HPD event) is still open; as noted in the PR'sRisksection,#3523must land before or alongside this PR to avoid swallowed swaps during firmware-27 external HPD teardown (#3157). - Hosted CI & PR metadata: Hosted CI at
4747d512bd54is still queued (1passed,0failed,3queued); also addone-wayortwo-wayto### Risksopr-textpasses. - No-regression hardware row: Awaiting the second-generation
SN201202xno-regression check (e.g. IRQ-driven T604x/T8132 port) noted inNot yet.
Checked:
- Verified
drivers/usb/typec/tipd/core.c(cd321x_uses_dp_sid(),cd321x_dp_sid_event()):- Re-enables
SN201202X_INT_DP_SID_UPDATEonapple,t8142while keepingapple,t8140excluded. - Both callers of
cd321x_dp_sid_event()(cd321x_wake_events()andcd321x_interrupt()) andcd321x_update_work()hold&tps->lock, so reads ofdp_sid_valid,state_valid,state.alt, anddp_statusare properly serialized.
- Re-enables
- Verified
drivers/usb/typec/tipd/cd321x-pm.h(cd321x_dp_sid_coalesced_hpd_low()): tightly gated on polled mode (!tps->irq), valid/active DP state (dp_sid_valid && state_valid && in_dp), HPD high in bothappliedandrx, no activeDP_STATUS_IRQ_HPD, and unchanged non-IRQ status bits, so IRQ-driven ports, initial attach,IRQ_HPD, and non-HPD status changes (e.g.DP_STATUS_PREFER_MULTI_FUNC) are unaffected. - Verified KUnit coverage (
cd321x_dp_sid_coalesced_hpd_low_test,122/122cd321x*passing),tools/testing/selftests/drivers/gpu/apple-dcp/common.pyhost-header shim (DP_STATUS_HPD_STATE+__attribute__((unused))),checkpatch.pl --strict0/0/0, DCO sign-off, and J813 live EIZO EV2780 standby-wake HPD recovery (635 ms, 0 swallowed swaps, 0 errors).
Evidence
drivers/usb/typec/tipd/core.c: verifiedlockdep_assert_held(&tps->lock)atL2259,mutex_lock(&tps->lock)atL2295, andguard(mutex)(&tps->lock)incd321x_update_work()atL1187.drivers/usb/typec/tipd/cd321x-pm.hL410-423 &cd321x-pm-test.cL115-139: positive and negative branches all covered by unit assertions.#3523status at review time:OPEN(mergedAt: null).
|
Second-generation IRQ-driven
Also added |
Pick up unrelated CI harness fixes on main; no changes to PR files. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
Forward-merged Hardware row at |
There was a problem hiding this comment.
Verdict: HOLD at 768a654
Blockers: #3523 remains open. Please verify the IRQ-driven peer on the integrated tree, or document why the new probe-time kept-attach replug cannot affect that hardware row.
Checked: Hosted checks completed successfully. The J813 and IRQ-driven J873g results were carried from 4747d51. The PR patch is unchanged, but the landed base adds a replug at probe in the same TIPD core file. The replay remains confined to the polled path.
There was a problem hiding this comment.
Verdict: MERGE at 768a654e1307
Blockers:
- None.
Checked:
- Audited the full 4-file diff (
drivers/usb/typec/tipd/core.c,cd321x-pm.h,cd321x-pm-test.c,tools/testing/selftests/drivers/gpu/apple-dcp/common.py,+63/-4,MERGEABLEagainstmain):cd321x_uses_dp_sid()enablesDP_SID_UPDATEstrictly forapple,t8142(M5), leavingT8140and every other SoC unchanged.cd321x_dp_sid_coalesced_hpd_low()is strictly gated on!cd321x->tps.irq(polled ports only) plusdp_sid_valid,state_valid,in_dp, unchanged HPD-high status, and clearDP_STATUS_IRQ_HPD, so IRQ-driven ports (J873g/T8152) are provably unaffected.- Unit test
cd321x_dp_sid_coalesced_hpd_low_testcovers polled vs IRQ-driven, initial attach, prior HPD-low, activeIRQ_HPD, and non-HPD bit transitions.
- Hosted CI is completely green at
768a654e1307(5/5passed:host-tests,pr-text,readiness). - Hardware verified on both
J813(M5 AirT8142, polled path) andJ873g(M6 Mac miniT8152, IRQ-driven control), with no runtime delta in the768a654emainmerge.
Evidence
- Head:
768a654e13078609a9b6268761652936fbc8cb45(basemain,MERGEABLE). - Status checks:
host-testsSUCCESS,pr-text / pr-textSUCCESS,readiness / readinessSUCCESS. - Related
#3523is already approved;#3649is cleanlyMERGEABLEonmainand scoped strictly to polledT8142.
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed at 768a654. The coalesced-HPD replay only runs on polled ports with a valid DP_SID route already in DP and an unchanged HPD-high status, and the KUnit cases cover each guard. The only change for other code is enabling DP_SID on T8142, which the J813 row covers; J873g (T8152) is the second family. Better than before for T8142 standby-wake, and nothing changes for IRQ-driven ports.
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Enable
SN201202X_INT_DP_SID_UPDATEonapple,t8142incd321x_uses_dp_sid()and replay coalesced HPD-low pulses on polledSN201202xports (!tps->irq) viacd321x_dp_sid_coalesced_hpd_low(), with KUnit coverage (cd321x_dp_sid_coalesced_hpd_low_test) andapple-dcpselftest shim updates.Tested: MacBook Air 13-inch (M5, J813 /
apple,t8142) at4747d512bd54— PASS (cold boot + active-Sway physical unplug/standby/replug with EIZO EV2780 USB 2.0 -> USB 3.0 hub wake HPD bounce: 635 ms end-to-end recovery, 0 swallowed swaps, 0 kernel errors, 0 failed units); Mac mini (M6, J873g /apple,t8152, IRQ-drivenSN201202xsecond-generation peer check) at4747d512bd54— PASS (see comment below); KUnitcd321x*122/122 passed;apple-dcpselftestslifecycle35/35 +quiesce19/19 passed;checkpatch.pl --strict0 errors/warnings/checks.Risk: two-way · T8142 (M5) polled
SN201202xports (a plain revert undoes it). IRQ-drivenSN201202xports (tps->irq != 0) andapple,t8140are unchanged. Merge#3523before or alongside this PR.Not yet: T8142 J815 confirmation.
Details
SN201202X_INT_DP_SID_UPDATEonapple,t8142incd321x_uses_dp_sid()(keepingapple,t8140excluded for J700's retained external H17P display pipe). On T8142,dcp_is_retained_external()is false fordcp_t8142_ext(), so the external DCP tears down and retrains cleanly on HPD replay.cd321x_dp_sid_coalesced_hpd_low()incd321x-pm.hand call it fromcd321x_dp_sid_event(): on polledSN201202xports (!tps->irq, 500 ms poll interval on T8142nub_spmi_a0), a short sink HPD-low pulse (~250 ms when an EIZO EV2780 wakes from standby and switches its internal hub from USB 2.0 to USB 3.0) latchesSN201202X_INT_DP_SID_UPDATEwhileDP_SID_STATUS.status_rxhas already returned to the previously applied HPD-high status by the next poll. Treat that unchanged HPD-high status update (withoutDP_STATUS_IRQ_HPD) on an already-active DP route as a coalesced HPD drop socd321x_dp_sid_replay()tears down and retrains the link instead of dropping the event.cd321x_dp_sid_coalesced_hpd_low_testtocd321x-pm-test.ccovering all positive and negative cases, and addDP_STATUS_HPD_STATEplus the unused-helper shim intools/testing/selftests/drivers/gpu/apple-dcp/common.py.#3523: Like#3439, replayingHPD=0on an active firmware-27 external CRTC requires#3523(drm/apple: invalidate mode state on disconnected HPD event) so the compositor does not submit a swallowed swap during teardown (#3157).Evidence
apple,t8142) with EIZO EV2780 USB-C display (2560x1440@60, USB 2.0 -> USB 3.0 hub wake switch) onaurora/main+#3523+#3439+#3567+4747d512bd54:card1-DP-2: connectedatt=2.4 s, real 256-byte EDID (ENC 0x2811), 18 modes,2560x1440@60, USB 2 + USB 3 hubs + EIZO HID + Billboard all enumerated cleanly.t=73.12 s) -> 3.86 s later EIZO dropped HPD (~260 ms):sn201202x 1-0a: DP partner reported its display gone and back: HPD low, then high(t=77.218 s) ->DCPDPServicere-admitted on channel 9 ->set_digital_out_mode finished:2060(t=77.853 s, 635 ms end-to-end recovery inside Sway, 0 swallowed swaps, 0 timeouts, 0 DART/DCP/kernel errors, 0 failed units).ARCH=um):cd321x*122/122 passed (cd321x-pm: 50/50 includingcd321x_dp_sid_coalesced_hpd_low_test,cd321x-tbt: 10/10,cd321x-irq: 11/11,cd321x-mux: 21/21,cd321x-dp: 20/20,cd321x-dp-sequence: 10/10).apple-dcphost selftests:lifecycle35/35 passed,quiesce19/19 passed.ARCH=arm64 LLVM=-19clean build ofdrivers/usb/typec/tipd/;./scripts/checkpatch.pl --strict --git HEAD~1..HEAD0 errors, 0 warnings, 0 checks.