Repository navigation
drm/apple: dcp: rearm Type-C IOMFB HPD completion on deep-sleep DPTX release - #4013
Conversation
…release Commit ab187c4 ("drm/apple: dcp: keep firmware 27 Type-C DPTX connected across DPMS off") returns early from dcp_poweroff() on firmware 27 direct Type-C DP outputs, leaving DPTX connected across CRTC power-off and skipping reinit_completion(&dcp->typec_iomfb_hpd_ready) and dcp->typec_crtc_off. During deep sleep on s2r_ext hosts such as T8142 (J813), dcp_s2r_ext_suspend() then tears the DPTX link down via dcp_external_disconnect(dcp, false) -> dcp_external_stop_locked(). That path lowered HPD and released DPTX without reinitializing typec_iomfb_hpd_ready, and only set typec_crtc_off after lowering HPD. Consequently: 1. Firmware's synthetic unplug during suspend arrived while typec_crtc_off was still false, marking the still-attached connector disconnected. 2. On resume, dcp_poweron() saw typec_crtc_off && typec_cable_connected, reconnected DPTX, and immediately returned from wait_for_completion_timeout(&dcp->typec_iomfb_hpd_ready, ...) because the completion was still signaled from before sleep. It then called iomfb_poweron_v27() and set_digital_out_mode() ~100-150 ms before firmware published the new IOAVVideoInterface and hotPlug_notify, causing IOAVVideoInterface prepareLink() to fail with 0xe00002ec (set_digital_out_mode returned 0x80000104) and firmware to drop the sink permanently. Prepare the same handoff to dcp_poweron() inside dcp_external_stop_locked() before lowering HPD on non-retained Type-C outputs: reinitialize typec_iomfb_hpd_ready and set typec_crtc_off when a cable is attached, leaving retained H17P/ext26 external pipes unchanged. Add KUnit regression tests in dcp_s2r_test.c covering both the T8142 V27 Type-C stop handoff and the unchanged retained H17P stop path, and update tools/asahi/dcpext26-lifecycle-tests.py for the extracted helper. Fixes: ab187c4 ("drm/apple: dcp: keep firmware 27 Type-C DPTX connected across DPMS off") Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed at 2a8d808. The fix is right. Non-retained Type-C pipes that keep DPTX up across DPMS off only release the link in the deep-sleep external stop, so they skipped dcp_poweroff()'s handoff. Re-initialising typec_iomfb_hpd_ready there makes dcp_poweron() wait for IOMFB's fresh VideoInterface/HPD before the modeset, which matches the prepareLink() 0xe00002ec symptom. Marking the CRTC off before lowering HPD keeps the synthetic unplug from dropping the still-attached connector. The guard is limited to !retained && typec_output, so retained externals and HDMI keep their current path.
On error handling: if the withdraw fails after the re-init, the function still goes to the 'failed' path, which sets external_error and holds the session. The re-armed completion therefore can't strand a later poweron, because no poweron proceeds on that session. Moving the withdraw into a KUNIT_STATIC_STUB_REDIRECT helper is a clean way to assert the ordering (completion reset and crtc_off set before the withdraw), and the new S2R KUnit case covers it. Approve, pending your J813 EIZO exact-head row in the PR.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Hardware row at
|
|
Post-merge check of Code. Only
Ran on the merge tree: W=1 |
What: Fix a deep-sleep resume regression on firmware 27 direct Type-C DP outputs (
apple,t8142-dcpext, J813) introduced byab187c40d66a. Becausedcp_poweroff()keeps DPTX connected across DPMS off (dcp_typec_keep_dptx_on_dpms()), it skipsreinit_completion(&dcp->typec_iomfb_hpd_ready)anddcp->typec_crtc_off; deep sleep then releases DPTX indcp_s2r_ext_suspend()->dcp_external_stop_locked()without reinitializingtypec_iomfb_hpd_readyand setstypec_crtc_offonly after lowering HPD. On resume,dcp_poweron()immediately returned fromwait_for_completion_timeout(&dcp->typec_iomfb_hpd_ready, ...)and raniomfb_poweron_v27()+set_digital_out_mode()~100–150 ms before firmware published the newIOAVVideoInterfaceandhotPlug_notify, causingIOAVVideoInterface prepareLink()to fail with0xe00002ec(set_digital_out_mode returned 80000104) and firmware to permanently drop the sink. This change reinitializestypec_iomfb_hpd_readyand setstypec_crtc_off(when a cable is connected) before lowering HPD on non-retained Type-C outputs indcp_external_stop_locked(), adds two KUnit regression tests indcp_s2r_test.c, and updatestools/asahi/dcpext26-lifecycle-tests.py.Tested:
J813, M5 Air, external Eizo EV2780 on Type-Cport0/506e00000.dcp, exact head2a8d8087827fonmainb902937859ec,7.3.0-aurora-dp-resume+):apple-dcp-s2r: 5/5 PASS (including both new testsdcp_s2r_t8142_dcpext_stop_rearms_hpd_readyanddcp_s2r_t8140_retained_ext_stop_unchanged).rtcwake -d /dev/rtc0 -m mem -s 15,boot object resumes 0 -> 1 -> 2 -> 3,wake source: NUB.SPMI0.SW3):card1-DP-1returnedstatus=connected enabled=enabled dpms=Onon every wake with 0prepareLinkerrors, 0setmode failed, and 0hotplug not readywarnings (cycles 1–2 at2560x1440@59 Hz, cycle 3 at1680x1050@60 Hz).dcp_s2r_ext_cycle):card1-DP-1returned2560x1440@59 Hzcleanly.s2idle(rtcwake -d /dev/rtc0 -m freeze -s 10):card1-DP-1returnedconnected/enabledcleanly.wlp1s0f0) and 64 MiB direct NVMe read OK; 0 kernel oops/warnings.2a8d8087827f:W=1 drivers/gpu/drm/apple/(LLVM 19): 0 warnings indcp.canddcp_s2r_test.c.scripts/checkpatch.pl --strict --git aurora/main..HEAD: 0 errors, 0 warnings, 0 checks.tools/testing/selftests/drivers/gpu/apple-dcp/run.sh: 101/101 PASS.tools/asahi/dcpext26-lifecycle-tests.py: PASS.Risk: two-way · Only runs inside
dcp_external_stop_locked()when!dcp_is_retained_external(dcp) && dcp_is_typec_output(dcp)anddptxport[0].connectedis true (specificallys2r_extnon-retained Type-C DP pipes whosedcp_poweroff()kept DPTX up, such asapple,t8142-dcpext). Retained external pipes (H17P / native26) and fixed-HDMI / internal panels are untouched (verified bydcp_s2r_t8140_retained_ext_stop_unchangedanddcpext26-lifecycle-tests.py).Not yet: Second-board
J815/J704row, unplug-during-sleep row, and DPMS-off-before-deep-sleep row.