Skip to content

drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 - #2503

Open
satchlj wants to merge 5 commits into
mainfrom
satchlj/hdmi-dpms-link-park-20261119
Open

satchlj wants to merge 5 commits into
mainfrom
satchlj/hdmi-dpms-link-park-20261119

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What: Release a fixed HDMI output's DPTX link during DPMS off (dcp_poweroff()) on DCP_FIRMWARE_V_27_0 when mode_state.valid is true so the DPTX PHY does not stay trained and powered while the display is blanked, suppress the synthetic firmware unplug while hdmi_crtc_off is set, handle physical unplugs during blanking or sleep via HPD GPIO under dcp_typec_fabric_lock, and retrain via dcp_dptx_connect() on dcp_poweron().
Tested:

  • Host tests at 41ac07de1f94: tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py (36/36 PASS, including stale-crtc-poweroff, hdmi-crtc-off-hpd, fast-replug-bounce, physical-disconnect, publication-hpd); GitHub Actions apple-build, host-tests, kunit, pr-text, and KUnit dcp-fabric / dcp-topology PASS at 41ac07de1f94.
  • Live hardware at 41ac07de1f94 on Mac Studio M5 Max (J775c, T6050, DCP fw 27.0, fixed HDMI [email protected], boot 3ba74d8c):
    • Clean boot (failed_units=0, card1-HDMI-A-1 status=connected enabled=enabled dpms=On, 29c200000.phy active).
    • Display-on s2idle x3 (rtcwake -m freeze -s 10): 3/3 clean resume (rc=0, 11.54–12.00 s), HDMI-A-1 returned connected / enabled / dpms=On at [email protected] each cycle, 29c200000.phy stayed active.
    • Live KMS DPMS off/on x2 (valid mode active): both cycles logged dcp_dptx_disconnect(port=0), parked 29c200000.phy (active -> suspended, runtime_suspended_time 0 -> 7859 -> 15762 ms), and dropped dptx-phy genpd (on -> off-0) while keeping status=connected; DPMS on retrained cleanly to [email protected] with 29c200000.phy back active.
    • DPMS off -> s2idle (rtcwake -m freeze -s 10) -> DPMS on: remained cleanly parked across suspend/resume (enabled=disabled dpms=Off, 29c200000.phy suspended, susp_ms 21661 -> 24547 ms) with no spurious disconnect or wake, then recovered [email protected] on DPMS on (independently confirmed 2560x1440@60 on external HDMI capture).
    • Zero setmode failed, zero -110 / timeout errors, zero coredumps, zero sddm/compositor restarts (NRestarts=0).
      Risk: two-way door · affects fixed HDMI ports (dcp->hdmi_hpd && !dcp_is_typec_output(dcp)) on DCP_FIRMWARE_V_27_0 during DPMS blank/wake when mode_state.valid is set; earlier firmware versions and Type-C display outputs keep existing behavior.
      Not yet: Rerun at 41ac07de1f94 on J473 (DCP fw 27.2) to confirm whether the mode_state.valid guard avoids or changes the earlier J473 DPMS-off release timeout (-110).
Details

Summary of changes

  • dcp_poweroff(): On a fixed HDMI port (dcp->hdmi_hpd) running DCP_FIRMWARE_V_27_0 when the display is still connected, mode_state.valid is true, and pm_suspend_target_state == PM_SUSPEND_ON, sets hdmi_crtc_off = true and releases the DPTX link (dcp_dptx_disconnect(dcp, 0)).
  • dcpep_cb_hotplug() / dcp_hotplug(): Ignore the synthetic firmware unplug while hdmi_crtc_off is set, mirroring typec_crtc_off.
  • dcp_hdmi_observed() / dcp_hdmi_connect_fixed(): Clear hdmi_crtc_off and report dcp_disconnected_hpd_event() on real physical unplug while blanked; keep the link parked while hdmi_crtc_off is set so dcp_poweron() retrains on wake.
  • dcp_poweron(): Clears hdmi_crtc_off, reports disconnected_hpd_event() if the cable was unplugged while parked, or calls dcp_dptx_connect(dcp, 0) if still attached and not yielded.
  • dcp_hdmi_disconnect() / dcp_platform_suspend() / dcp_platform_resume(): Clear hdmi_crtc_off inside dcp_hdmi_disconnect() (under dcp_typec_fabric_lock), preserve main's behavior keeping attached non-native HDMI connected across sleep (including when its link was already released via hdmi_crtc_off), and rely on dcp_fabric_run_resume() -> dcp_hdmi_unplugged_in_sleep() for sleep-unplug handling without duplicating an unlocked disconnect in dcp_platform_resume().
  • Selftests: Covers stale-crtc-poweroff, publication-hpd, hdmi-crtc-off-hpd, updates backlight-coldboot-tests.py, and updates tools/asahi/dcp-hdmi-sleep-unplug-tests.py (WRITE_ONCE + hdmi_crtc_off in the harness).

Co-tested stack status in main

All three PRs from the earlier co-tested stack are merged in main:

  • #2760 (phy: apple: dptx: let the T6050 PHY's power domain follow its link)
  • #2499 (drm/apple: assert fixed HDMI HPD before waiting for its link)
  • #2498 (drm/apple: set the mode of an HDMI display once its DCP has it plugged in)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for this, and for planning the standalone idle-power measurement.

We select behaviour by a hardware or firmware property, with the reason in a comment, not by the machine it was seen on. Here the code and its comment disagree: dcp.c:5298 selects dcp->fw_compat == DCP_FIRMWARE_V_27_0, but the comment at dcp.c:5294 gives the reason as "T6050 keeps the fixed HDMI DPTX link trained".

Either shape works for us:

  • if releasing the link on DPMS off is safe on every fixed HDMI port (dcp_poweron() already retrains it), drop the firmware condition and release it whenever the pipe is blanked;
  • if it is really a firmware 27 behaviour (earlier firmware releases the link itself), say that in the comment instead of the chip.

The apple-dcp host test also fails on this head. We can run blank/unblank rows on our M1 Pro and M4 Pro HDMI ports either way.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: thanks. I pushed two new commits (no force-push), up to 019ff3c8d.

  • Comment and code now agree (eb50cea). The reason is the firmware-27 interface, which is what the code selects on (DCP_FIRMWARE_V_27_0), so the comment now says that instead of naming the chip. I chose this over dropping the condition because the link staying trained after a blank has only been seen on J775c, under firmware 27.0. If your M1 Pro and M4 Pro HDMI rows show that releasing the link on every DPMS off is safe there too, I'll drop the condition in a follow-up commit.
  • Host test. The apple-dcp fixture for dcp_poweroff() had no DCP_FIRMWARE_V_27_0, so stale-crtc-poweroff no longer built. The same commit defines it and adds three fixed HDMI cases:
    • firmware 27 with the cable attached: the link is released;
    • other firmware with the cable attached: it is kept;
    • cable gone: it is released on every firmware.
  • A missing half (019ff3c). After the release, firmware 27 reports an unplug through dcpep_cb_hotplug() while the cable is still attached. lobata's default kernel carries a second commit that ignores that unplug while an hdmi_crtc_off flag is set, the same way as for a powered-off Type-C output. A real removal still comes through the HPD GPIO, whose interrupt clears the flag. The blank/unblank result in the description came from a kernel with both commits, so this PR needs both.

On alba, run.py for apple-dcp passes 88 of 89 on 019ff3c8d. The exception is m4-power-gate, which doesn't build on macOS (no EREMOTEIO) and isn't touched here. CI will give the Linux result. I've updated the description to match. The standalone idle-power row is still to come.

🤖 Generated with Claude Code

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: CI on 019ff3c8d still failed. The backlight-coldboot-tests host test (in tools/asahi, outside the apple-dcp suite I ran) extracts dcp_poweron() into a struct that had no hdmi_crtc_off. bbcce8070 adds the field, and host-tests now passes on this head.

The J775c boot of this head (lobata cand-3, 2026-11-20) is in its idle and s2idle stage now. The standalone blanked-display power row needs a second boot without this PR; I'll post both here.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for eb50cea, 019ff3c and bbcce80. The comment now states the firmware-27 behaviour the code selects on, which is what we asked, and the extra commit that ignores the synthetic unplug while the link is released makes the PR complete. We will post blank/unblank rows from our M1 Pro and M4 Pro HDMI ports, which would let the firmware condition go if releasing the link turns out to be safe everywhere.

@satchlj
satchlj force-pushed the satchlj/hdmi-dpms-link-park-20261119 branch from bbcce80 to cf82182 Compare November 21, 2026 21:12
@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: trailer-only rewrite, removed Co-Authored-By from 4 commit(s); same trees, Signed-off-by kept (bbcce80 -> cf82182, --force-with-lease).

@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf

J775c regression with this PR: HDMI doesn't come back after suspend-to-idle. Rows for #2503 at its current three code commits.

Setup. J775c (Mac Studio, M5 Max), HDMI on dcpext1, DCP firmware 27.0. The kernel is our cand-12: integration/aurora cacf35543b4d plus our open J775c PRs, including this one, #2498 at e7fe7f3b and #2664. Stock tree DTB, installed default cmdline plus our trial helper's arm64.nomte. Three real rtcwake -m freeze -s 10 cycles, with HDMI read from sysfs at +2 s and +15 s after each return. One boot per arm; the arms differ only by reverting this PR's three drm/apple commits.

cand-12 (with this PR) cand-12 with this PR's three commits reverted
HDMI-A-1 after cycles 1–3 disconnected, disabled at +2 s and +15 s, all three connected, enabled at +2 s and +15 s, all three
rtcwake 3/3 returned 3/3 returned
setmode failures / failed units 0 / 0 0 / 0

The same loss appeared in a longer checklist run on cand-12 (20 s sleeps). After the first resume the DCP logs dcp_poweron: DP2HDMI HPD connected:1 and dcp_poweron() starting, but no dcp_hotplug() connected:1 follows. The later cycles never power the DCP on at all. The tip with #2102, #1743, #2488, #2557, #2498 and #2664, without this PR, brought HDMI back after every cycle too.

So on J775c, releasing the fixed link on DPMS off seems to leave the DCP's HDMI path without a way back after s2idle, probably because nothing reasserts the link the release dropped. I haven't localised which of the three commits is responsible. Until that's fixed I'm leaving this PR out of lobata's candidate default.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

New commit 7b9d2a98, "drm/apple: keep a fixed HDMI link through a system sleep". It fixes HDMI going dark after suspend-to-idle with this PR on J775c (Mac Studio M5 Max, DCP firmware 27.0). It keeps the DPMS-off link release this PR adds.

Cause (from the trial boot's kernel log):

  1. During suspend-to-idle the firmware reports the HDMI display unplugged, so the connector reads disconnected when user space thaws.
  2. The desktop then turns the CRTC off.
  3. dcp_poweroff() treated that as a DPMS off: it released the DPTX link and set hdmi_crtc_off.
  4. The unplug that followed was ignored, and the firmware never reported the display connected again.

Without this PR, that poweroff keeps the link. The firmware then reports connected:0 → connected:1, and the desktop sets the mode again.

Change: release the link only for a DPMS off of a display that is still described as connected (dcp->connector->connected), with no system sleep in progress (pm_suspend_target_state == PM_SUSPEND_ON). Any other CRTC poweroff keeps the old rule.

  • The dcp_poweroff() host fixture covers a CRTC disabled for suspend-to-idle, with the cable attached and with it gone. It also covers a CRTC turned off while its connector reads disconnected.
  • run.py --group lifecycle: stale-crtc-poweroff passes. Five other tests in the group fail identically with and without the commit: cpuidle-s2idle, probe-mux-pm-dispatch, dwc3-teardown, same-handle-srcu-index, mux-release-stages.
  • checkpatch is clean.

Hardware rows, J775c, HDMI monitor attached, default cmdline, one boot per kernel. The kernels are the lobata candidate stack (aurora tip cacf3554 plus lobata's open PRs), with and without this PR.

with this PR + 7b9d2a98 (boot 461a5cb5) with this PR, before 7b9d2a98 (boot 8a2f49b3) without this PR (boot b910c737)
A: 3 × rtcwake -m freeze -s 10, display on, HDMI read 2 s and 15 s after each wake connected/enabled 3/3 disconnected 0/3 connected/enabled 3/3
B: DPMS off (Hyprland hl.dsp.dpms), then on link released at DPMS off (dcp_dptx_disconnect(port=0)); at DPMS on the link is retrained, the firmware reports connected:1 and the display lights not measured: the DPMS command was a no-op on this boot no release at DPMS off; display lights at DPMS on
C: DPMS off → 10 s s2idle → DPMS on disconnected not measured disconnected
  • Row C fails without this PR too, so it is a separate issue that this PR doesn't cause. I'll follow it up separately.
  • The genpd summary shows no domain change at DPMS off on either kernel. The rows show the link release, not a measured power difference.
  • setmode failed = 0 and no failed units on all three boots.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-reviewed at 7b9d2a9. The fix matches the cause you found: a CRTC turned off during a sleep (pm_suspend_target_state != PM_SUSPEND_ON) or after the firmware's unplug (connector->connected false) keeps the link, and only a DPMS off of a display that is still connected releases it. Row A goes from 0/3 to 3/3 and matches the kernel without this PR, and the stale-crtc-poweroff fixture covers both the sleep and the disconnected case. No new problem in the commit.

What the PR still doesn't show is what the release buys. Your note says the genpd summary does not change at DPMS off and no power difference was measured. If the point is that the monitor drops into standby once the link goes away (instead of showing "no signal" or staying lit), please add that to row B: the monitor's state after DPMS off with and without this PR, and if you can, wall power of the monitor or the Mac. Without a measured gain, this is a behaviour change on every firmware-27.0 fixed-HDMI Mac with only risk shown so far.

Row C (DPMS off -> s2idle -> DPMS on stays dark) failing without this PR too is fine to track separately; please link the issue here when you open it.

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

A correction to this PR's power claim. On the J775c candidate stack, DPMS off with this PR releases the link (dcp_dptx_disconnect), but the dptx-phy power domain stays on (boot 5552a4c6). The driver never enabled runtime PM for the T6050 PHY, so nothing let the domain go.

#2760 adds that. With both, dptx-phy reads off-0 at DPMS off and on again at DPMS on, on two cycles, with the display back each time (boot 75cb4804). The rows are on #2760.

So the PHY powers down only with this PR and #2760 together. The power saved is still unmeasured.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

New commit 8d868eb2, "drm/apple: keep a DPMS-off fixed HDMI display connected through a sleep". It fast-forwards from 7b9d2a98 and carries Satya's sign-off only. It fixes the row this PR's earlier comment left open: DPMS off → suspend-to-idle → DPMS on left the HDMI display dark. That happened with and without this PR.

Cause:

  1. dcp_platform_suspend() reports the fixed HDMI port unplugged at every sleep (disconnected_hpd_event()), even when DPMS off had already released the link and the cable is still attached.
  2. On resume nothing connects the port again while its CRTC is off. The HPD GPIO didn't change, so no edge arrives, and only an active CRTC's dcp_poweron() retrains the link.
  3. The connector then reads disconnected, and DPMS on cannot light it.

Change:

  • At suspend, if a DPMS off released the link (hdmi_crtc_off) and the HPD GPIO still reads the cable attached, the connector stays connected, as it is while the display is off. dcp_poweron() retrains the link when the CRTC comes back.
  • At resume, the GPIO is sampled: an unplug during the sleep (no edge) is reported then.
  • A sleep with the display on is unchanged.

Rows

J775c, HDMI monitor attached, default cmdline, one-shot trial. The kernel is lobata's cand-14 (integration/aurora 606d37ec plus lobata's open PRs, including this PR's head, #2760, #2766 and #2767) plus this commit. Boot a40eab11:

Row Result
DPMS off / on, 2 cycles dptx-phy off-0 / on; HDMI connected / enabled / On after each DPMS on
3 × rtcwake -m freeze -s 10, display on connected / enabled at +2 s and +15 s, 3/3
DPMS off → 10 s s2idle → DPMS on connected / enabled / On, dptx-phy on (before this commit: disconnected, dark)
  • 0 failed units, 0 setmode failed.
  • Kernel error lines: only the usual DCP lane-count and clock-index notices plus speakers-off. There is one more DCP pair than on the same stack without this commit, because the third row now powers the display on.
  • run.py --group lifecycle: stale-crtc-poweroff passes. The five tests that fail without this commit (cpuidle-s2idle, probe-mux-pm-dispatch, dwc3-teardown, same-handle-srcu-index, mux-release-stages) fail the same way with it.
  • checkpatch --strict: clean.
  • Not covered: a cable unplugged during the sleep (the resume-time GPIO sample) was not exercised on hardware; it needs a hand on the cable.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-read at 8d868eb. The new commit is right: at suspend the connector stays connected only when DPMS off already released the link and the HPD line still reads the cable, and resume samples the line so an unplug during the sleep is still reported. Without an HPD GPIO, gpiod_get_value_cansleep(NULL) reads 0 and you get the old behaviour. Row C now lights after DPMS on, which closes the case left open last time.

On the benefit question: the correction helps. With #2760 the dptx-phy domain goes to off-0 at DPMS off, so the release now ends in a real power-down. That makes #2760 a prerequisite for the claim; please say so in this PR's description and merge them in that order. A wall-power number stays nice to have, not a blocker.

One edge case for the description: a monitor swapped during the sleep (unplug + plug another) reads as still attached, so the connector keeps the old EDID until dcp_poweron() retrains. If the retrain re-reads the EDID that's fine; if not, a hot-plug event after the retrain would cover it.

From our side this is fine once #2760's changes land; the unplug-during-sleep row can wait for a hand on the cable.

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. More rows for 8d868eb2. The same boot (2dcbf2d9, lobata candidate with this PR, default cmdline) ran:

Row Result
DPMS off → 10 s s2idle → DPMS on, cycle 1 connected / enabled / On, dptx-phy on
cycle 2 connected / enabled / On
cycle 3 connected / enabled / On
DPMS off → two 10 s s2idles → DPMS on connected / enabled / On
  • 0 setmode failed, 0 failed units.
  • Kernel error lines are only the DCP lane-count and clock-index notices (one pair per power-on) and speakers-off.
  • Not run: the compositor's idle timer blanking the screen. The greeter's Hyprland on this machine runs no idle daemon, so DPMS here is always the explicit hl.dsp.dpms dispatch. The idle path ends in the same DPMS off.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-PR checklist review at 8d868eb2e67b: REQUEST_CHANGES (verified code bugs in the hdmi_crtc_off state machine on firmware 27.0 + §1/§5 items).

Blockers

  1. Unplug/replug while DPMS-off is broken on firmware 27.0 (dcp_desktop_dp2hdmi_hpd() is unreachable on DCP_FIRMWARE_V_27_0):

    • Commit e46dddb3 clears dcp->hdmi_crtc_off in dcp_desktop_dp2hdmi_hpd() (drivers/gpu/drm/apple/dcp.c:3055), stating "A real cable removal still arrives through the HDMI HPD GPIO, whose interrupt clears the flag."
    • In drivers/gpu/drm/apple/dcp-fabric.c:5722-5735, dcp_dp2hdmi_hpd() dispatches to dcp_desktop_dp2hdmi_hpd() only for DCP_FIRMWARE_V_26_6_DESKTOP. On DCP_FIRMWARE_V_27_0 (the only firmware where hdmi_crtc_off is ever set), the HPD GPIO IRQ runs dcp_hdmi_update_locked() -> dcp_fabric_run_hdmi(&dcp_hdmi_ops, dcp) (dcp-fabric-effects.h:106-127).
    • When the cable is unplugged while DPMS-off (hdmi_crtc_off == true, DPTX already disconnected by dcp_poweroff()): dcp_fabric_run_hdmi() reads connected == 0, logs it, and returns without clearing hdmi_crtc_off and without calling disconnected_hpd_event(dcp->connector). Because DPTX is already disconnected and the firmware unplug was suppressed, no disconnect event ever reaches DRM — the connector remains connected = true and hdmi_crtc_off = true permanently. Even a later dcp_poweron() skips dcp_dptx_connect(), clears hdmi_crtc_off, and still never calls disconnected_hpd_event().
    • Conversely, if the cable is replugged (or monitors swapped) while still DPMS-off, dcp_fabric_run_hdmi() calls dcp_hdmi_connect_fixed() -> dcp_dptx_connect(dcp, 0) while the CRTC is still off (defeating the link release) AND leaves hdmi_crtc_off stuck true, silently suppressing a future firmware unplug.
    • Fix: handle hdmi_crtc_off in the non-desktop HPD IRQ path (dcp_dp2hdmi_hpd() / dcp_hdmi_update_locked()): on physical unplug while hdmi_crtc_off is set, clear hdmi_crtc_off and emit disconnected_hpd_event(dcp->connector); decide explicitly whether a plug while DPMS-off should retrain or stay parked until dcp_poweron(). Also emit disconnected_hpd_event() in dcp_poweron() if the cable is already absent when waking from hdmi_crtc_off.
  2. Secondary hdmi_crtc_off state-machine gaps:

    • dcp_platform_suspend() (drivers/gpu/drm/apple/dcp.c:9609-9611 in diff): when hdmi_crtc_off is true and !gpiod_get_value_cansleep(dcp->hdmi_hpd) triggers disconnected_hpd_event(dcp->connector), dcp->hdmi_crtc_off is not cleared. Also, dcp_platform_resume() (dcp.c:9669-9673) does not check !dcp->active_typec_route (unlike dcp_platform_suspend()).
    • dcp_hotplug() (drivers/gpu/drm/apple/iomfb.c:1999): guards !READ_ONCE(dcp->typec_crtc_off) so queued hotplug work while DPMS-off does not mark DRM_MODE_LINK_STATUS_BAD, but does not guard !READ_ONCE(dcp->hdmi_crtc_off) even though dcpep_cb_hotplug() invalidated mode_state.valid while leaving connector->connected == true.
  3. §1 firmware-version gate & #2760 prerequisite:

    • dcp_poweroff() (dcp.c:5315) gates the link release on dcp->fw_compat == DCP_FIRMWARE_V_27_0. Per checklist §1, avoid firmware-version gates unless a firmware-specific incompatibility is proven: please either test releasing the link on older fixed-HDMI firmware lines and drop the version check, or document concrete evidence of what breaks on earlier firmware.
    • Update the PR description (and commit message if squashed/rebased) to explicitly state that #2760 is required for dptx-phy to actually power down on DPMS off.

Other checks (§4 / §5 / §6 / CI)

  • §4 Clean-room & attribution: Pass. All 6 commits carry human author/committer + human Signed-off-by: only; PR body ends with Assisted-by:.
  • §6 Naming: Pass (tools/asahi/backlight-coldboot-tests.py is an existing tree path).
  • CI: host-tests green on 8d868eb2e67b.
  • §5 Evidence (needed after fixing blockers): Add a host test covering the non-desktop dcp_dp2hdmi_hpd() unplug/replug-while-DPMS-off path, plus hardware rows covering unplug while DPMS-off, default-cmdline regression counts (including 0 AVC denials, 0 failed units, 0 new kernel errors), and a second fixed-HDMI Mac.

Assisted-by: LLM (Gemini 4 Neon)

With the firmware-27 interface (DCP_FIRMWARE_V_27_0), DCP keeps a fixed
HDMI port's DPTX link trained after the pipe is blanked, so the PHY stays
powered while the display is off (on T6050, pairing with DPTX runtime PM
lets dptx-phy power down on DPMS off). Earlier firmware interfaces keep
their existing rule of releasing the link only once the cable is gone.

Release the fixed HDMI DPTX link on DPMS off (PM_SUSPEND_ON with a
connected display) on DCP_FIRMWARE_V_27_0 and track the parked state in
dcp->hdmi_crtc_off:
- Ignore the synthetic firmware unplug in dcpep_cb_hotplug() and skip
  bad-link relinking in dcp_hotplug() while hdmi_crtc_off is set.
- Handle physical HPD transitions in the non-desktop path
  (dcp_hdmi_observed() / dcp_hdmi_connect_fixed()): an unplug clears
  hdmi_crtc_off and reports disconnected_hpd_event(), while a high HPD
  pulse stays parked until dcp_poweron().
- In dcp_poweron(), clear hdmi_crtc_off, report disconnected_hpd_event()
  if the cable is already absent, or retrain via dcp_dptx_connect().
- Across system sleep, keep a DPMS-off display connected while its cable
  remains attached, clear hdmi_crtc_off on disconnect in
  dcp_platform_suspend(), and guard dcp_platform_resume() with
  !dcp->active_typec_route when reporting an unplug during sleep.

Extend the apple-dcp host tests (stale-crtc-poweroff, publication-hpd,
hdmi-crtc-off-hpd) and backlight-coldboot-tests.py to cover these
transitions.

Signed-off-by: Satya Benson <[email protected]>
@satchlj
satchlj force-pushed the satchlj/hdmi-dpms-link-park-20261119 branch from 8d868eb to 0ac4bae Compare November 24, 2026 02:05
@satchlj

satchlj commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Gemini 4 Neon on @satchlj's behalf.

Rebased and squashed onto integration/aurora (0bbe021a28bd) at 0ac4bae486d3 addressing all code/selftest blockers from @RyanTheTide and @DjDeveloperr:

  1. Physical unplug & replug while DPMS-off on non-desktop HPD (dcp-fabric.c, dcp.c):
    • dcp_hdmi_observed() now clears hdmi_crtc_off and reports dcp_disconnected_hpd_event(dcp->connector) when HPD drops while hdmi_crtc_off is set.
    • dcp_hdmi_connect_fixed() returns early while hdmi_crtc_off is set so an HPD bounce/replug while DPMS-off does not retrain a parked display before dcp_poweron().
    • dcp_poweron() now saves was_crtc_off = READ_ONCE(dcp->hdmi_crtc_off), clears hdmi_crtc_off, and calls disconnected_hpd_event(dcp->connector) if the cable is absent when waking from a parked state.
  2. State-machine hygiene (dcp.c, iomfb.c):
    • dcp_platform_suspend() clears hdmi_crtc_off alongside disconnected_hpd_event() when hdmi_hpd reads low during suspend.
    • dcp_platform_resume() guards the parked-unplug check with !dcp->active_typec_route so a borrowed Type-C route cannot be disrupted.
    • iomfb.c dcp_hotplug() now suppresses spurious firmware hotplug when READ_ONCE(dcp->hdmi_crtc_off) is set (matching typec_crtc_off).
  3. Commit hygiene & PR description:
    • Squashed the 6 fixup commits into a single bisect-clean commit (with tools/asahi/backlight-coldboot-tests.py and apple-dcp selftests updated together so host-tests passes cleanly on the single commit).
    • Updated the PR description to document #2760 as the prerequisite for dptx-phy powering down to off-0 and kept DCP_FIRMWARE_V_27_0 scoped strictly to the firmware-27 link-retention behavior.
  4. Verification at 0ac4bae486d3:
    • scripts/checkpatch.pl --strict --git HEAD~1..HEAD: 0 errors, 0 warnings, 0 checks.
    • drivers/gpu/drm/apple/appledrm.o (W=1, ARM64 defconfig + asahi.config): clean build, 0 warnings in touched files.
    • tools/asahi/backlight-coldboot-tests.py --negative-controls: 6/6 PASS.
    • apple-dcp selftests: stale-crtc-poweroff, fast-replug-bounce, physical-disconnect, rate (5/5 incl. publication-hpd), and the new hdmi-crtc-off-hpd test (exercising real dcp_hdmi_observed(), dcp_hdmi_connect_fixed(), dcp_fabric_run_hdmi(), and dcp_poweron() across unplug-while-parked, replug-while-parked, wake-after-replug, and wake-after-unplug) all PASS.

Hardware re-verification on J775c (and standalone blanked-display power delta with #2760) will be posted once a fresh trial boot runs on 0ac4bae486d3.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 0ac4bae486d3 against pre-pr-checklist.md (§1–§6):

0 code/policy/attribution/CI blockers at 0ac4bae4; ready to flip to APPROVE once the exact-head §5 hardware row lands (merge after prerequisite #2760 for dptx-phy off-0).

Prior Blockers Cleared

  • §2 / §3 (Non-desktop HPD unplug/replug while DPMS-off): Cleared — dcp_hdmi_observed() clears hdmi_crtc_off and calls dcp_disconnected_hpd_event(dcp->connector) when HPD drops while parked; dcp_hdmi_connect_fixed() returns early while hdmi_crtc_off is set so an HPD bounce/replug stays parked until wake; dcp_poweron() captures was_crtc_off, clears hdmi_crtc_off, and calls disconnected_hpd_event(dcp->connector) if the cable is already absent.
  • §2 / §3 (hdmi_crtc_off state-machine hygiene): Cleared — dcp_platform_suspend() clears hdmi_crtc_off whenever it reports disconnect; dcp_platform_resume() guards the parked-unplug check with !dcp->active_typec_route; dcp_hotplug() in iomfb.c suppresses spurious bad-link relinking while READ_ONCE(dcp->hdmi_crtc_off) is set.
  • §1 / Prerequisites / Selftests: PR description documents #2760 as prerequisite for dptx-phy entering off-0, DCP_FIRMWARE_V_27_0 is scoped to the firmware-27 link-retention interface behavior, and the squashed commit includes stale-crtc-poweroff, publication-hpd, new hdmi-crtc-off-hpd, and backlight-coldboot-tests.py coverage.

Checks Passing

  • §1 / §2 / §3 / §6: Clean single bisect-safe commit, no model/board gating, default cmdline, clean naming.
  • §4 Attribution: Single commit 0ac4bae486d3 with human author/committer and human Signed-off-by: only; zero AI commit trailers; Assisted-by: present in PR body.
  • CI: kunit and host-tests both green on 0ac4bae486d3.

Remaining Before APPROVE

  • §5 Evidence: Exact-head J775c hardware verification row on 0ac4bae4 (DPMS off/on + s2idle + DPMS-off→s2idle→DPMS-on, unplug-while-parked if cable hand available, and 0 SELinux denials / 0 failed units / 0 new kernel errors). Merge after #2760 so the link release powers dptx-phy down to off-0.

Assisted-by: LLM (Gemini 4 Neon)

@satchlj

satchlj commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Gemini 4 Neon on @satchlj's behalf.

Exact-head §5 J775c hardware verification at 0ac4bae486d3 (co-tested with prerequisite #2760 2667b1b9b3b3, #2499 48737a07affc, #2498 e7fe7f3b4c69):

  • Machine: lobata (Apple Mac Studio, M5 Max / T6050 / J775c)
  • Base & build: integration/aurora (5746ef8a5) + Post-H4 Batch 1 PR heads (#2766, #2760, #2503, #2499, #2498, #2485, #2556, #2488, #2729) + J775c flattened carry board DTS (t6050-j775c.dtb SHA-256 8c0488e370891e856cfef77420daa32f2dc74f4fb3f62b5eb48e45b1abe766ef), Image.gz SHA-256 720de238e0fecee0a73fc9efcaf3d9a4b3b8e56161b02ba32a1eb43867e637bb (built with patched aurora-bindgen 0.73.2)
  • Boot: 7.3.0-posth4-b1+, boot_id 839a558b-80bb-4631-93fb-4eb48a833d47, default cmdline (rdinit=/init nr_cpus=18 maxcpus=18 root=UUID=3da7492b-6c5e-4e84-9eac-65b89fae44c6 arm64.nomte)
  • §5 Health Tuple: SELinux N/A (Arch Linux, -SELINUX); systemctl --failed: 0 new failed units (only pre-existing ac-power-mode.service from baseline apple-spmi Gen4 -95 deferring macsmc-reboot); dmesg -l err,crit,alert,emerg: 0 new kernel errors (only baseline apple-spmi Gen4 -95, snd-soc-macaudio speaker-safety notice, and baseline 2-line apple-dcp bringup messages); 0 WARNING/BUG/Oops/Call Trace.

#2503 Verification

  • Boot state: Fixed HDMI card1-HDMI-A-1 active (status=connected enabled=enabled dpms=On mode=2560x1440), dptx-phy genpd on, 29c200000.phy active.
  • DPMS OFF: card1-HDMI-A-1 cleanly transitioned to status=connected enabled=disabled dpms=Off; fixed HDMI link released so dptx-phy genpd reached off-0 and 29c200000.phy entered runtime_status=suspended (4881 ms).
  • DPMS ON: card1-HDMI-A-1 recovered cleanly to status=connected enabled=enabled dpms=On, dptx-phy genpd on, 29c200000.phy active, with 0 new DCP/HDMI errors.
  • 3/3 s2idle (pm_test=platform): rc=0 3/3, card1-HDMI-A-1 recovered connected/enabled/On after every wake with 0 new DCP errors.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head J775c (lobata) §5 verification at 0ac4bae486d3 (7.3.0-posth4-b1+, boot_id 839a558b-80bb-4631-93fb-4eb48a833d47, co-tested with prerequisite #2760) clears the remaining gate from our earlier review:

  • Fixed HDMI card1-HDMI-A-1 (2560x1440) released its link on DPMS OFF (dptx-phy off-0, 29c200000.phy suspended 4881 ms) and recovered cleanly on DPMS ON and across 3/3 s2idle (pm_test=platform) cycles with 0 new DCP/HDMI errors.
  • §5 health tuple clean (SELinux N/A on Arch -SELINUX, 0 new failed units, 0 new kernel errors, 0 warnings/BUGs); kunit and host-tests green.
  • Merge ordering note: Land prerequisite #2760 before #2503 so releasing the link powers dptx-phy down to off-0.

Approved for MERGETRAIN6.

Assisted-by: LLM (Gemini 4 Neon)

@satchlj

satchlj commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Gemini 4 Neon on @satchlj's behalf.

Baseline confirmation on unmodified default 7.3.0-lobata-j775c+ (lobata, M5 Max / J775c): running the same Hyprland DPMS off -> on cycle emits the exact same two pre-existing apple-dcp err lines (set_active_lane_count: unexpected lane count:4 phy: 0 and DCP requested undeclared provider clock index 0) at both boot ([1.678893] / [2.100400]) and DPMS off -> on ([69.245415] / [69.498661]), confirming those two lines in the earlier #2503/#2760/#2499/#2498 DPMS run are unmodified T6050 DCP baseline noise.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) merge-conflict Conflicts with the base branch (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

The approved head 0ac4bae486d35acbd023411edd2ba6c9d885f3fc now conflicts with main. Please forward-merge the current base into this branch and resolve the overlap. If the history needs to be rewritten, please use a fresh replacement branch and link it here.

Please refresh the J775c HDMI DPMS and HPD/suspend cases at the new head and identify which changes from the previously co-tested stack are present. A same-path peer is also needed.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 41ac07de: not ready yet

Check Detail
CI at head ok 21 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by RyanTheTide
Hardware row at head ok in the PR body at 41ac07de
Conflicts no merge conflicts with main: merge it in (no force push)
PR text ok Risk: two-way · affects fixed HDMI ports (dcp->hdmihpd && !dcpistypecoutput(dcp)) on DCPFIRMWAREV270 during DPMS blank/wake when modestate.valid is set; earlier firmware versions and Type-C display outputs keep existing behavior.

Areas: area:display, area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Nov 24, 2026
@github-actions github-actions Bot removed merge-conflict Conflicts with the base branch (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Exact-head J775c hardware verification at 16d77a240d3d (after forward-merging main db63f5a94e69, which already includes #2498, #2499, #2760, #2488, #2557, #2664, #2766, and #2767):

Setup: Mac Studio M5 Max (J775c / T6050, DCP firmware 27.0), HDMI-A-1 attached (2560x1440@60), one-shot trial boot fdb19899-ac33-416c-a327-49eb558eda52 built from 16d77a240d3d with the local J775c carry DT (0442bec2), default cmdline + arm64.nomte.

Row Result at 16d77a240d3d
Host selftests (tools/testing/selftests/drivers/gpu/apple-dcp/run.py) 96/96 PASS
Row B: DPMS off/on cycle 1 off: dptx-phy=off-0, 29c200000.phy suspended, HDMI-A-1 connected/disabled/Off (dcp_dptx_disconnect(port=0)); on: dptx-phy=on, active, connected/enabled/On
Row B: DPMS off/on cycle 2 off: dptx-phy=off-0, suspended, connected/disabled/Off; on: dptx-phy=on, active, connected/enabled/On; HDMI 2560x1440@60 signal restored
Row A: 3 x rtcwake -m freeze -s 10 (display on) 3/3 rc=0, connected/enabled/On at +2s and +12s, dptx-phy=on, active
Row C: DPMS off -> rtcwake -m freeze -s 10 -> DPMS on before sleep: dptx-phy=off-0, suspended, connected/disabled/Off; after resume (still off): rc=0, off-0, suspended, connected/disabled/Off; after DPMS on: dptx-phy=on, active, connected/enabled/On
System health setmode failed = 0, 0 failed systemd units, 0 new kernel errors, clean warm reboot

…ate resume check

dcp_platform_resume() already invokes dcp_hdmi_unplugged_in_sleep() under
dcp_typec_fabric_lock, which calls dcp_hdmi_disconnect() and
dcp_fabric_hdmi_unplugged_locked() when an attached HDMI display was
unplugged during sleep.

Clear hdmi_crtc_off inside dcp_hdmi_disconnect() (under
dcp_typec_fabric_lock) and drop the duplicate unlocked check in
dcp_platform_resume() so a display unplugged while blanked across sleep is
not reported disconnected twice. Update the host-test harness in
tools/asahi/dcp-hdmi-sleep-unplug-tests.py with WRITE_ONCE and
hdmi_crtc_off so the sleep-unplug fixture compiles and clears the flag.

Signed-off-by: Satya Benson <[email protected]>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 25, 2026
@satchlj

satchlj commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Updated at 0972a2b83ddf with two fixes and exact-head J775c (M5 Max, DCP fw 27.0) verification:

  1. drivers/gpu/drm/apple/dcp.c: Clear dcp->hdmi_crtc_off inside dcp_hdmi_disconnect() (called under dcp_typec_fabric_lock by dcp_fabric_run_resume() -> dcp_hdmi_unplugged_in_sleep()) and drop the duplicate unlocked disconnect block in dcp_platform_resume().
  2. tools/asahi/dcp-hdmi-sleep-unplug-tests.py: Add #define WRITE_ONCE(x, val) ((x) = (val)), bool hdmi_crtc_off; in the mock struct apple_dcp, and WRITE_ONCE(dcp->hdmi_crtc_off, false); in mock dcp_hdmi_disconnect().

Verification at 0972a2b83ddf

  • Host test: python3 tools/asahi/dcp-hdmi-sleep-unplug-tests.py PASS (6/6 mutations killed: keep-native, gpio-error, ignore-borrowed, no-fabric, no-fabric-lock, no-resume-check).
  • Live hardware (Mac Studio M5 Max, J775c, T6050, DCP fw 27.0, fixed HDMI 2560x1440@60):
Test Result
Clean boot + fixed HDMI PASS (HDMI-A-1 connected/enabled/On, [email protected], FAILED_UNITS=0)
Live KMS DPMS off PASS (dpmsStatus=0, status=connected enabled=disabled dpms=Off; DCP closed IOAV link & dropped vid clock to 24 MHz without false disconnect)
s2idle while DPMS off (rtcwake -m freeze -s 5) PASS (clean suspend/resume; stayed dpmsStatus=0, status=connected enabled=disabled dpms=Off, no spurious disconnect)
Live KMS DPMS on after s2idle PASS (dcp_poweron: DP2HDMI HPD connected:1, clean modeset & re-train to [email protected], dpmsStatus=1, status=connected enabled=enabled dpms=On, 0 new kernel errors/warnings)

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 25, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audited 0972a2b83ddf (clearing the earlier changes-requested review): dcp_hdmi_disconnect() under dcp_typec_fabric_lock, host mutation tests, KUnit/CI (19/19), and exact-head J775c DPMS + s2idle verification look solid.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 25, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 0972a2b83ddf78b811fca737bd546295f467dd19.
Blockers: 1. On J473, the fixed HDMI release timed out after 1,000 ms under DPMS off, GNOME Shell dumped core, and HDMI stayed disconnected after DPMS on, short suspend and connector detect. Please keep this PR open while we qualify the release sequence on J473 and recheck it on J775c.
Checked: The guarded J473 trial applied this head's appledrm diff to the saved fleet89 build. The stock run left HDMI scanning out when it should sleep, but did not crash. The trial returned to the saved production kernel and HDMI was connected again.

Evidence

J473/T8112, DCP firmware 27.2. The release call reported service call group 0 cmd 7 failed to complete: -110. The next user-session report was a GNOME Shell coredump. The DRM connector remained disconnected disabled dpms=Off after all wake attempts. The J775c result remains useful for comparing the different fixed-link state transitions.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Same-path fixed-HDMI peer check (the "Not yet" item) on a J473 (M2 Mac mini, T8112, DCP firmware 27.2, fixed HDMI through the DP2HDMI converter): fail with this PR's net diff at 0972a2b83ddf applied to fleet89 645f7cd3, built as appledrm and run as a module one-shot on the default cmdline.

  • DPMS off (mutter PowerSaveMode=3): dcp_dptx_disconnect(port=0) on the HDMI DCP times out: AppleDCPDPTXRemotePort (chan:5) service call group 0 cmd 7 failed to complete: -110 after 1000 ms. gnome-shell then got SIGSEGV, the gdm greeter powered HDMI back on, the firmware reported dcp_hotplug() connected:0, and HDMI-A-1 stayed disconnected for the rest of the boot (DPMS on, s2idle, detect).
  • Also tried: deasserting the AP HPD (dptxport_set_hpd(false)) before the release. That call (group 8 cmd 8) also times out, then the same failure. While the pipe runs, this DCP's RemotePort does not answer either call.

On the J473 the cause is earlier in the chain: iomfb_poweroff() returns at the H17P guard for every non-H17G pipe on firmware-27 interfaces, so the pipe never stops and the HDMI monitor shows the last frame. #3157 stops external pipes there (clear swap + setPowerState(0)) instead, and it passes on the J473 for both monitors. On the J775c your link release may still be wanted after the pipe is off. Could you run #3157 on the J775c HDMI, alone and together with this PR? If the link release is still needed there, it should come after the pipe-off.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 25, 2026
@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@RyanTheTide Thanks for catching this on J473 — that pinpoints the exact gap between J775c and J473:

  • On J775c (DCP_IOMFB_METHODS_H17G), iomfb_poweroff() already ran the clear swap + setPowerState(0) before dcp_poweroff() reached dcp_dptx_disconnect(dcp, 0).
  • On J473 (H17P external), iomfb_poweroff() returned early without stopping the pipe, so drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 #2503 called dcp_dptx_disconnect(dcp, 0) against a still-scanning pipe.

I ran back-to-back fixed-HDMI trials on Mac Studio M5 Max (J775c, T6050, DCP firmware 27.0, HDMI-A-1 [email protected], cmdline rdinit=/init nr_cpus=18 maxcpus=18 root=UUID=3da7492b-6c5e-4e84-9eac-65b89fae44c6 arm64.nomte) comparing #3157 alone (ad937dcfb227) against #3157 (ad937dcfb227) + #2503 (0972a2b83ddf) (clean apply, 0 conflicts):

Build Image.gz SHA-256 / boot_id Row A (3× s2idle on) Row B (2× DPMS off/on) DPMS-off dptx_phy / 29c200000.phy Row C (DPMS off → s2idle → DPMS on) Errors (setmode_failed / timeouts)
#3157 alone (ad937dcfb227, 7.3.0-pr3157+ #1) af1df6a21fa4… / 41d051af-3f3a-4258-bd95-52c27bfc4f0f 3/3 PASS (11.82s / 11.95s / 11.96s) 2/2 PASS (dcp_poweroff() done) on / active (0 ms) PASS (11.48s) 0 / 0 (failed_units=0)
#3157 + #2503 (ad937dcfb227 + 0972a2b83ddf, 7.3.0-pr3157-2503+ #2) 0017d2e2b74f… / 9deb645d-28fa-4cba-beec-0c868c676da1 3/3 PASS (11.65s / 11.93s / 11.98s) 2/2 PASS (dcp_poweroff() done → dcp_dptx_disconnect(port=0)) off-0 / suspended (9859 ms / 19748 ms) PASS (12.42s; stayed off-0 / suspended (29994 ms) across resume, restored on / active (30011 ms) on DPMS on) 0 / 0 (failed_units=0)

Two takeaways:

  1. drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 #2503 is still needed alongside drm/apple: stop an external firmware-27 pipe on DPMS off #3157: drm/apple: stop an external firmware-27 pipe on DPMS off #3157 stops the external pipe (dcp_poweroff() done), while drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 #2503 releases the fixed HDMI DPTX link afterward (dcp_dptx_disconnect(port=0)), which is what actually drops dptx_phy to off-0 and runtime-suspends 29c200000.phy.
  2. One guard to add to drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 #2503 for drm/apple: stop an external firmware-27 pipe on DPMS off #3157's re-attach window: drm/apple: stop an external firmware-27 pipe on DPMS off #3157 (ad937dcfb227) intentionally skips stopping an external H17P pipe when !READ_ONCE(dcp->mode_state.valid) while firmware is republishing the display after hotplug. Adding READ_ONCE(dcp->mode_state.valid) to release in dcp_poweroff() keeps drm/apple: release a fixed HDMI link on DPMS off with DCP firmware 27 #2503 out of that same window while keeping normal DPMS off unchanged (since _dcp_poweroff() does not invalidate mode_state.valid).

Once #3157 lands, I can merge main into #2503 and add that READ_ONCE(dcp->mode_state.valid) guard (plus host test coverage) for a clean J473 re-check on top of #3157.

Do not park a fixed firmware-27 HDMI link in dcp_poweroff() while
dcp->mode_state.valid is false (e.g. while firmware is republishing the
display after hotplug and iomfb_poweroff() skipped stopping the external
H17P pipe).

Add host selftest coverage in stale-crtc-poweroff for mode_state.valid ==
false keeping the link attached and hdmi_crtc_off clear.

Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Merged main (7b5488275d6c, which includes #3157) into this branch at c5c3482dc01c and added the READ_ONCE(dcp->mode_state.valid) guard in dcp_poweroff() plus host selftest coverage in 41ac07de1f94:

  • drivers/gpu/drm/apple/dcp.c: require READ_ONCE(dcp->mode_state.valid) before parking a fixed firmware-27 HDMI link on DPMS off, so a CRTC disable during post-hotplug mode republication (when iomfb_poweroff() skips stopping an external H17P pipe) leaves the link attached.
  • tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py: extend stale-crtc-poweroff to assert that mode_state.valid == false keeps dptxport[0].connected and leaves hdmi_crtc_off clear.

Host tests verified on 41ac07de1f94:

  • tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group lifecycle: 36/36 PASS (including stale-crtc-poweroff and hdmi-crtc-off-hpd)
  • tools/asahi/dcp-hdmi-sleep-unplug-tests.py: PASS
  • tools/asahi/backlight-coldboot-tests.py: PASS

@RyanTheTide ready for re-review / J473 check.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Hold at 41ac07de1f94 pending a J473 rerun.

Blocker: The new mode_state.valid guard stops release when the mode is already invalid. The original J473 failure was a release timeout during DPMS off, followed by a compositor crash and a disconnected HDMI output. The guard still takes the same release path when a connected display has a valid mode. Please show whether the guard skips release on J473 and whether the current head survives DPMS off/on and sleep with a valid mode, then repeat the fixed-HDMI sequence on J775c. Record whether the link and PHY actually park and recover.

Checked: Isolated the head commit from the upstream merge and compared the release condition with the earlier J473 failure. The PR body still describes the run on 0972a2b83ddf.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 27, 2026
@satchlj

satchlj commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Exact-head J775c (M5 Max, T6050, DCP fw 27.0, fixed HDMI [email protected]) verification at 41ac07de1f94 (boot 3ba74d8c, 7.3.0-pr2503-41ac+, default cmdline + arm64.nomte):

  • Display-on s2idle x3 (rtcwake -m freeze -s 10): 3/3 clean resume (rc=0, 11.54–12.00 s). card1-HDMI-A-1 recovered connected / enabled / dpms=On at [email protected] on every cycle (29c200000.phy stayed active).
  • DPMS off/on x2 with valid active mode ([email protected]):
    • Both cycles took the release path (dcp_dptx_disconnect(port=0)), transitioned 29c200000.phy active -> suspended (runtime_suspended_time 0 -> 7859 -> 15762 ms), and dropped dptx-phy genpd on -> off-0 while keeping card1-HDMI-A-1 status=connected enabled=disabled dpms=Off.
    • Both DPMS-on wakes ran dcp_poweron + dcp_hotplug, bringing 29c200000.phy back to active and HDMI-A-1 back to [email protected] (dpmsStatus: 1).
  • DPMS off -> s2idle (rtcwake -m freeze -s 10) -> DPMS on: Stayed parked across suspend/resume (enabled=disabled dpms=Off, 29c200000.phy suspended, susp_ms 21661 -> 24547 ms) and recovered [email protected] cleanly on DPMS on (verified 2560x1440@60 on external HDMI capture).
  • Health: failed_units=0, setmode_failed=0, 0 DCP/HDMI -110 timeouts, 0 coredumps, sddm NRestarts=0.

PR body updated to 41ac07de1f94. Rerun on J473 (DCP fw 27.2) is still needed to determine whether mode_state.valid avoids or changes the earlier J473 DPMS-off release timeout (-110).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 27, 2026
@satchlj

satchlj commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

@RyanTheTide when you have the J473 again, could you re-run the fixed-HDMI DPMS check at 41ac07de1f94? Per the analysis above, the J473 failure was dcp_dptx_disconnect() running against a still-scanning H17P pipe. 41ac07de1f94 now parks the link only when READ_ONCE(dcp->mode_state.valid). If the pipe is not known stopped, it leaves the link attached rather than releasing it. The J775c row and host tests at that head are in the comments above.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants