Repository navigation
usb: typec: tipd: fix coalesced HPD drop recovery on dcp-fabric ports - #3439
Conversation
erikwb
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at bc4852dd7098
The direction is right: restoring the "displayport"-only lookup in cd321x_register_port() fixes the regression from d769aaf5b389 that disabled hpd_pulse on every dcp-fabric port, and replaying HPD low before HPD high for a coalesced >2 ms HPD drop matches the DisplayPort spec, cd321x_dp_teardown(), and cd321x_dp_sid_replay(). Three items need to be fixed before merge.
Blockers:
drivers/usb/typec/tipd/core.c:926-936anddrivers/usb/typec/tipd/core.c:1346-1362:cd321x_update_work()does not clearcd321x->dp_statuswhen placing the mux inTYPEC_STATE_SAFE(on unplug it returns at:1376without callingcd321x_typec_update_mode()). On CD321x (wherecd321x_dp_release_first()does not run), unplugging a DP monitor leavescd321x->dp_status & DP_STATUS_HPD_STATEset. On the next plug-in,st->data_status_changed & CD321X_DATA_STATUS_HPD_LEVELanddp_data.status & DP_STATUS_HPD_STATEare both set, sohpd_pulsebecomes true even thoughcd321x->state.altisNULL(just came fromSAFE). With the updatedelsebranch at:936, that sendsCD321X_DP_SEND_EDGE(HPD=0first). If another port holds the only external display pipeline (e.g., M1/M2 Air),dcp_typec_route_apply()(drivers/gpu/drm/apple/dcp-fabric.c:2190,2241) recordsport->dp_hpd = falseand returns-ENOSPC;core.c:956-959sets*display_busy = trueand skips theHPD=1call, and:1453does not retry. Becauseport->dp_hpdstaysfalse,dcp_typec_route_waiting()(dcp-fabric.c:1629) skips the port when the first display is later unplugged, so the waiting display never lights up on its own. Fix: gatehpd_pulseoncd321x->state_valid && cd321x->state.alt == cd321x->port_altmode_dp, and clearcd321x->dp_status = 0andcd321x->dp_conf = 0afterTYPEC_STATE_SAFEsucceeds incd321x_update_work()at:1361.drivers/usb/typec/tipd/core.c:926,4032,4382:tps->h17_displayis only initialized intipd_resume()(:4382), never intipd_init()(:4032), so it staysfalsefrom boot until the first suspend/resume. Previously, the unconditionalconnector_fwnodefallback masked this on T8140/T8142 by keeping!(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode)false. Removing that fallback exposes T8140 (J700) tohpd_pulsefiring before the first suspend/resume and tearing down the retained H17P external pipeline viadcp_dptx_disconnect_oob()->dcp_external_disconnect(dcp, true). Fix: initializetps->h17_displayintipd_init()(moving the existing assignment out oftipd_resume(), or setting it in both).- PR body format and hardware rows:
- The PR body uses
## Summary/## Testingand is missing the required**Tested:**and**Risk:**lines (pr-textwill fail on both). Add**What:**,**Tested:**(naming the Mac, head SHA, and regression check result: 0 SELinux denials, 0 failed units, 0 new kernel errors, default cmdline),**Risk:**(two-way door · all Macs with tipd USB-C DP ports), and**Not yet:**. - Re-run the J313 hardware row at the updated head SHA after fixing blockers 1 and 2. Because
drivers/usb/typec/tipd/core.cis shared across Mac generations (CD321x and SN201202x), also add a no-regression row on one other Mac generation with a USB-C DP display (or request one via a regression request), and wait for CI (host-tests,pr-text,readiness) to turn green.
- The PR body uses
Checked: no Apple material, no AI attribution, no new model/chip/board/firmware gates, no new cmdline/module parameters or sleeps, human author and Signed-off-by on both commits, Fixes: SHAs verified against main, diff traced across tipd, phy-apple-atc, dcp-fabric, apple_drv, and t8152_typec.
Evidence
- Verified all callers of
cd321x->connector_fwnodeindrivers/usb/typec/tipd/core.c(:927,:1132,:1466,:3027,:3075,:3106) and confirmeddrivers/gpu/drm/apple/apple_drv.conly attachesdcp->dev.fwnodeinapple_connector_create()(:1347), never the USB-C connector fwnode (apple_probe_typec_ports(),:1679-1744). - Traced
CD321X_DP_SEND_EDGE(HPD=0->HPD=1) throughatcphy_mux_set()(drivers/phy/apple/atc.c:6326, ignoresDP_STATUS_HPD_STATE, no-op),dcp_typec_route_apply()(drivers/gpu/drm/apple/dcp-fabric.c:2079,2251, runsdcp_dptx_disconnect_oob()thendcp_dptx_connect_oob()),cd321x_dp_sid_replay()(core.c:1015-1038, realIRQ_HPDon SN201202x still replays cleanly), andt8152_typec_set()(drivers/gpu/drm/apple/t8152_typec.c:74-101). - Checked interaction with #2879: complementary (#2879 forwards true
IRQ_HPDwith HPD high todcp_dptx_sink_irq(); this PR handles coalesced >2 ms HPD level drops as HPD low -> high). - Checked
pr-text.shagainst the current PR body structure: fails for missingTested:andRisk:fields. GitHub CI runs (host-tests,pr-text,readiness) were still queued at review time. - Non-blocking nit:
drivers/gpu/drm/apple/dcp-fabric.c:2054-2056still comments thatcd321x_dp_send()clearsIRQ_HPDfirst for a repeatedIRQ_HPD; that comment can be updated here or in a follow-up.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
… exists Commit d769aaf ("usb: typec: tipd: reconcile firmware-entered J616s DP mode") added a fallback in cd321x_register_port() that sets cd321x->connector_fwnode to the USB-C connector fwnode itself whenever no "displayport" reference property is present in the device tree. On Apple Silicon systems using dcp-fabric, no DRM connector registers with the USB-C connector fwnode (apple_connector_create() only attaches dcp->dev.fwnode for non-fabric external pipelines). Consequently, drm_connector_oob_hotplug_event() with the fallback fwnode silently matches no connector, while making cd321x->connector_fwnode unconditionally non-NULL breaks the !(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode) guard in cd321x_typec_update_mode(). That disabled coalesced HPD pulse handling on every dcp-fabric port. Restore the original lookup so cd321x->connector_fwnode is only set when a "displayport" reference actually exists, and remove the now-unused fwnode_property_present()/fwnode_handle_get() stubs from the apple-dcp host selftest. Also move tps->h17_display initialization from tipd_resume() into tipd_init() so T8140/T8142 have h17_display set from boot rather than staying false until the first suspend/resume once the connector_fwnode fallback no longer masks it. Fixes: d769aaf ("usb: typec: tipd: reconcile firmware-entered J616s DP mode") Signed-off-by: Thomas Glanzmann <[email protected]>
When a DisplayPort sink drops HPD and raises it again within the 500 ms debounce window of cd321x_update_work() — for example an EIZO EV2780 waking from standby and dropping HPD for ~248 ms about 3 s after plug — cd321x_typec_update_mode() previously synthesized DP_STATUS_IRQ_HPD. On a dcp-fabric port, DP_STATUS_IRQ_HPD routes to dcp_retrain_oob(), which only requests a modeset for the active mode without toggling DPTX HPD. On DCP firmware 27.2.1 (M1 MacBook Air J313), the firmware still considers the link up for that timing/color ID and short-circuits the modeset as a no-op, skipping DisplayPort link training so the monitor reports "No Signal" and returns to standby. A >2 ms HPD drop is a hot-unplug/hot-plug event rather than an IRQ_HPD. Replay HPD low first and then HPD high to the Type-C mux on a coalesced HPD drop/rise, matching what cd321x_dp_sid_replay() already does on SN201202x and what an uncoalesced (>500 ms) HPD drop produces. Gate hpd_pulse on the port already being in DP altmode (state_valid && state.alt == port_altmode_dp) and clear dp_status/dp_conf after placing the mux in TYPEC_STATE_SAFE on disconnect so a fresh plug-in after unplug cannot trigger a spurious HPD=0 edge. Update cd321x_dp_send() and its KUnit test accordingly. Fixes: 836f05b ("usb: typec: tipd: report a coalesced sink HPD pulse as IRQ_HPD") Fixes: b905751 ("usb: typec: tipd: send each IRQ_HPD request to the display route once") Signed-off-by: Thomas Glanzmann <[email protected]>
bc4852d to
a590df6
Compare
|
@erikwb Thanks for the thorough review! Addressed all code/CI items at
Fresh USB-C DP monitor hardware rows at |
There was a problem hiding this comment.
Verdict: FINISH, then merge at a590df61
Blockers:
- Missing exact-head
a590df61J313 USB-C DP hotplug/replug row (and a second-generation no-regression USB-C DP hotplug row), as listed underNot yet:. - Re-run the cancelled
readinesscheck (3/3 build/host/pr-textchecks are green).
Checked:
drivers/usb/typec/tipd/core.c,cd321x-pm.h,cd321x-pm-test.c:a590df61cleanly resolves the prior review blockers by gatinghpd_pulseoncd321x->state_valid && cd321x->state.alt == cd321x->port_altmode_dp, clearingdp_status/dp_confonTYPEC_STATE_SAFE, and replaying HPD low before HPD high (CD321X_DP_SEND_EDGE) on coalesced drops with updated KUnit coverage.- Checked for Apple material, tool attribution, private serials, and board gating: clean;
MERGEABLEonmain.
Evidence
- Head:
a590df619dd7(base: main,mergeable: MERGEABLE,+26/-30across 5 files).
|
Hardware verification at exact head
@erikwb Both prior review items are addressed at |
erikwb
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at a590df619dd7
Blockers:
drivers/usb/typec/tipd/core.c:948: the J313 run at this head shows that replaying HPD low on the EIZO's standby pulse can wedge the active external display pipe. The low edge reachesdisconnected_hpd_event()before the mode is invalidated, and a CRTC disable during that window submits a clear swap that never completes. Land #3523 first or together with this change and record the combined result in the Tested section.
Checked: The earlier code and PR text fixes are in. Host tests, PR text and readiness passed, and the branch has no conflicts. J313 and J813 hardware results are in the comments. The clean hotplug results on both machines include #3523.
Evidence
Earlier review at bc4852dd7098:
- Fixed in
a590df619dd7. The replay requires a valid DP altmode state. A successful transition to SAFE clears both cached DP fields. - Fixed in
68c8317cc5fb. The existing H17 display exception is initialized at probe, before the first hotplug or resume. - The PR format is fixed in the description.
68c8317cc5fbupdates the host test fixtures. The current-head hardware runs report the display failure above, and the combined J313 run restored picture and USB in 569 ms. On J813 the combined build passed live replug and both DPMS cycles.
There was a problem hiding this comment.
Verdict: MERGE at a590df619dd7
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - drivers/usb/typec/tipd/core.c, cd321x-pm.h, cd321x-pm-test.c: a590df61 cleanly resolves the prior review blockers by gating hpd_pulse on cd321x->state_valid && cd321x->state.alt == cd321x->port_altmode_dp, clearing dp_status / dp_conf on TYPEC_STATE_SAFE, and replaying HPD low before HPD high (CD321X_DP_SEND_EDGE) on coalesced drops with updated KUnit coverage.
- Checked for Apple material, tool attribution, private serials, and board gating: clean;
MERGEABLEonmain.
Follow-ups (not blocking): J313 USB-C DP hotplug row, rerun readiness
erikwb
left a comment
There was a problem hiding this comment.
Verdict: MERGE at a590df619dd7
Blockers: none. My earlier blocker was to land #3523 first; it is merged on main (b32acf0b7844) at a5af61d67c3e, the same commit used for the combined J313 and J813 runs.
Checked: the combined J313 (picture and USB back in 569 ms, no wedged pipe) and J813 (live replug, both DPMS cycles) results at this head with #3523 are in the Tested section; host tests, PR text and readiness pass at this head; no conflicts.
Evidence
- Nit: the Not yet: line still says to land #3523 first; it can say
nothingnow.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verified that coalesced HPD drops replay low then high on an active DP route, that a successful SAFE transition clears the cached DP state, and that H17 starts with the right display path before resume. Host tests passed at this head, and the J313 and J813 results cover the display path with the companion DCP fix now on main.
|
Merging at |
What:
Fix two issues preventing external DisplayPort monitors that wake from standby with a short HPD drop (e.g. EIZO FlexScan EV2780 dropping HPD for ~248 ms ~3 s after plug) from lighting up on Apple Silicon
dcp-fabricports:usb: typec: tipd: only set connector_fwnode when displayport property existsd769aaf5b389added anelse connector_fwnode = fwnode_handle_get(fwnode)fallback incd321x_register_port(). Ondcp-fabricplatforms no DRM connector registers with the USB-C connector fwnode, so makingconnector_fwnodeunconditionally non-NULL silently broke the!(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode)guard incd321x_typec_update_mode()."displayport"-only lookup, movetps->h17_displayinitialization fromtipd_resume()intotipd_init()so T8140/T8142 have it set from boot, and update theapple-dcphost selftest mocks (pm.py,transaction.py).usb: typec: tipd: replay HPD low before high on coalesced HPD dropsHPD=0thenHPD=1(CD321X_DP_SEND_EDGE) to the Type-C mux instead of synthesizingDP_STATUS_IRQ_HPD(which DCP firmware 27.2.1 short-circuits when the timing/color ID is already active).hpd_pulseoncd321x->state_valid && cd321x->state.alt == cd321x->port_altmode_dpand cleardp_status/dp_confafterTYPEC_STATE_SAFEsucceeds incd321x_update_work()so a fresh plug-in after unplug cannot emit a spuriousHPD=0edge.Tested:
a590df619dd7:tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group lifecycle: 35/35 passed (includingtypec-probe,probe-mux-pm-dispatch,probe-transaction-rollback,physical-disconnect,fast-replug-bounce).tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group quiesce: 19/19 passed.scripts/checkpatch.pl --strict --git origin/main..HEAD: 0 errors, 0 warnings, 0 checks on both commits.a590df619dd7+#3523(a5af61d67c3e, approved):J313,T8103, macOS 27.2.1 firmware, EIZO FlexScan EV27802560x1440@60 Hz, default cmdline, 0 failed units, 0 new kernel errors): unplug -> monitor standby -> replug replayedHPD=0->HPD=1without wedging the active external display pipe and restored picture + USB cleanly in 569 ms; deep sleep (rtcwake -d rtc1 -m mem -s 8) resumed display and USB hub/HID cleanly.J813,T8142, SN201202x, second-family no-regression row): combined build passed live USB-C DP replug and both DPMS off/on cycles cleanly with 0 failed units and 0 new kernel errors.#3523(fix/dcp-unplug-mode-invalidate, approved) landing first or together so the HPD-low edge invalidates the active mode before any CRTC disable swap.Risk: two-way · all Macs with
tipdUSB-C DP ports (CD321x and SN201202x).Not yet: nothing (
#3523is now onmain).