Skip to content

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

Open
satchlj wants to merge 1 commit into
mainfrom
satchlj/hdmi-dpms-link-park-20261119
Open

satchlj wants to merge 1 commit into
mainfrom
satchlj/hdmi-dpms-link-park-20261119

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

drm/apple: with the DCP firmware-27 interface, release the DPTX link of a fixed HDMI output on DPMS off, not only when its HPD says the display is gone. With that interface the link stays trained after the pipe is blanked, so the PHY cannot power down while the display is off. dcp_poweron() already retrains the link before it enables the pipe again.

Squashed into one clean, bisect-safe commit rebased onto integration/aurora (0bbe021a28bd):

  • dcp_poweroff() releases the DPTX link and sets hdmi_crtc_off = true on a fixed HDMI output (dcp->hdmi_hpd && !dcp_is_typec_output(dcp)) running DCP_FIRMWARE_V_27_0 when the display is still connected and no system sleep is in progress.
  • dcpep_cb_hotplug() and dcp_hotplug() suppress the synthetic firmware unplug while hdmi_crtc_off is set, mirroring typec_crtc_off.
  • Real physical unplugs while DPMS-off are handled via dcp_hdmi_observed() (clearing hdmi_crtc_off and reporting dcp_disconnected_hpd_event()) and dcp_hdmi_connect_fixed() (keeping 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 removed while parked, or retrains via dcp_dptx_connect() if still attached.
  • dcp_platform_suspend() clears hdmi_crtc_off when reporting disconnect; dcp_platform_resume() reports an unplug that occurred while parked across sleep (guarded by !dcp->active_typec_route).
  • Includes apple-dcp selftest coverage (stale-crtc-poweroff, publication-hpd, and new hdmi-crtc-off-hpd) and updates backlight-coldboot-tests.py.

Prerequisite for PHY off-0 power-down: #2760 (dptx-phy power-domain shutdown on disconnect) is required for the DPTX PHY itself to enter off-0 after this link release.

Selection: by output type (dcp->hdmi_hpd, non-Type-C fixed HDMI port) and DCP_FIRMWARE_V_27_0 (the firmware interface that keeps a trained HDMI link active after blanking). Other firmware and Type-C outputs are unchanged.

Testing

  • Rebased and squashed onto integration/aurora (0bbe021a28bd) at 0ac4bae486d3.
  • Built drivers/gpu/drm/apple/appledrm.o (W=1, ARM64 defconfig + asahi.config) with 0 warnings in touched files.
  • scripts/checkpatch.pl --strict --git HEAD~1..HEAD: 0 errors, 0 warnings, 0 checks.
  • Host selftests on 0ac4bae486d3: stale-crtc-poweroff, hdmi-crtc-off-hpd, fast-replug-bounce, physical-disconnect, rate (5/5 incl. publication-hpd), and tools/asahi/backlight-coldboot-tests.py --negative-controls (6/6) all PASS.
  • Prior J775c (M5 Max, DCP fw 27.0) hardware rows for DPMS-off link release, HDMI audio across blank/wake, and s2idle + DPMS-off→s2idle→DPMS-on are recorded in #issuecomment-7071289884 and #issuecomment-7073842652. Isolated idle-power delta and re-verification of 0ac4bae486d3 on J775c will follow in a trial-boot row.

Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown

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

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

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

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

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 <satya@benson.earth>
@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

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 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.

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants