Skip to content

drm/apple: dcp: stop T6041 internal DCP during s2idle and runtime DPMS - #3861

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
AxxzyWasTaken:pr/t6041-dcp-dpms-s2idle
Dec 2, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
AxxzyWasTaken:pr/t6041-dcp-dpms-s2idle

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What

Power-cycle the T6041 internal DCP (402e00000.dcp) when the internal panel is off instead of leaving the display coprocessor and link running continuously during s2idle and runtime DPMS-off:

  1. Commit 1 (847cdbe6e4bd3): drm/apple: dcp: stop T6041 internal DCP during s2idle
    • Adds dcp_t6041_internal_capable() (gated on sleep_host_stop, !t6040, !dcp_s2r_capable(), main_chain, and fw-27 dcpep_unnamed_500 tag) and dcp_t6041_s2idle(bool down) hooks in dcp_platform_suspend() / dcp_platform_resume() so T6041 internal DCP cleanly shuts down across PM_SUSPEND_TO_IDLE and cold-boots on resume without touching M4 Pro (t6040) or native S2R (hw.s2r) paths.
  2. Commit 2 (b3c3dab2c9f5f): drm/apple: dcp: power-cycle T6041 internal DCP on runtime DPMS
    • Extends dcp_t6041_stop_dev() with bool dpms so runtime DPMS-off powers down internal DCP cleanly without setting crashed/ext_dead (keeping dcp_crtc_atomic_check() open for DPMS-on) and without flushing bl_update_wq under crtc->mutex (avoiding ABBA deadlock with drm_crtc_set_brightness()).
    • Guards dcp_v27_dpms_off_locked() against firing soft-off on an already powered-off DCP (dpms_powered_off || s2r_fw_down).
    • Adds an early return in dcp_comp_unbind() for sleep_host_stop && s2r_fw_down && system_state > SYSTEM_RUNNING so shutdown/reboot while DPMS-off completes cleanly without touching powered-off DISP0.

Tested

J616C (M4 Max) passed 20/20 DPMS cycles at b3c3dab2c9f5, plus s2idle, deep sleep and reboot with the panel off. J616s passed 20/20 DPMS cycles, 4/4 s2idle cycles and deep sleep with the proposed head on main. J616s control and T6040 follow-up

  • Container checks:
    • scripts/checkpatch.pl --no-tree -: 0 errors, 0 warnings on both commits.
    • ARM64 LLVM=1 W=1 build of drivers/gpu/drm/apple/dcp.o and apple_drv.o: 0 errors, 0 warnings.
    • ARM64 QEMU KUnit apple-dcp-t6041-wake (CONFIG_WERROR=y, CONFIG_SUSPEND=y): 3/3 PASS (dcp_t6041_wake_shown_swap, dcp_t6041_s2idle_guards, dcp_t6041_dpms_policy).
    • tools/asahi/display-sleep-merge-tests.py: 17/17 PASS.
  • Physical J616C (Apple M4 Max, T6041, macOS 27.2 26B123) verification (7.3.0-j616c-272-ov1+, apples-to-apples sddm Hyprland greeter, hl.dsp.dpms({ action = "disable" / "enable" }), macsmc_hwmon Total System Power PSTR, 20 s × 0.5 s sampling):
    • DPMS-off power (dpmsStatus=0):
      • Baseline (fb0136a9): 2,519.3 mW mean / 2,483.1 mW median (min 2,466.6 mW)
      • Proposed (b3c3dab2): 1,396.9 mW mean / 1,344.5 mW median (min 1,316.1 mW)
      • Delta: -1,122.4 mW mean / -1,138.6 mW median (-44.6% total system power)
    • DPMS-on idle (bl=100): 4,428.8 mW mean / 4,380.4 mW median (unchanged vs baseline 4,392.9 mW).
    • 20× rapid DPMS off/on stress cycles: 20/20 PASS (dpmsStatus verified 0 -> 1 on every cycle).
    • DPMS-off → s2idle (rtcwake -d /dev/rtc1 -m freeze -s 15) → DPMS-on: PASS (dpmsStatus=1).
    • DPMS-off → deep (rtcwake -d /dev/rtc1 -m mem -s 15) → DPMS-on: PASS (dpmsStatus=1).
    • DPMS-on → s2idle (15 s, confirmed internal DCP stop + cold-boot EDID/backlight on wake) → deep (15 s) → resume: PASS (dpmsStatus=1).
    • Reboot while DPMS-off (dpmsStatus=0 → systemctl reboot): PASS (clean reboot back online in 18 s).
    • dmesg errors/warnings/deadlocks/SErrors: 0.

Risk

  • Two-way door. Medium (touches internal display power-down/bring-up lifecycle), mitigated by scoping strictly to dcp_t6041_internal_capable() (T6041 fw-27 non-S2R internal DCP only; M4 Pro t6040 and hw.s2r chips untouched) and passing all 20× DPMS, s2idle, deep, combined DPMS-off -> sleep -> DPMS-on, and reboot-while-DPMS-off hardware gates on J616C.

Not yet

  • Clamshell lid-close with an external display attached and rmmod appledrm while DPMS-off.

On T6041 (apple,sleep-host-stop), apple_platform_suspend() currently only
invokes dcp_t6041_s2r_all() for firmware-driven deep sleep, leaving the
internal DCP coprocessor and DISP0 power domains powered throughout
suspend-to-idle (s2idle).

Add dcp_t6041_s2idle() to stop only the internal DCP firmware and lower
the main_chain (DISP0) power words after drm_mode_config_helper_suspend()
completes during s2idle, and restart it in apple_drm_resume_outputs()
before drm_mode_config_helper_resume() (keeping it off across dark wakes):

- Track internal firmware and main_chain word state independently from the
  full deep-sleep state (dcp_t6041_down / dcp_t6041_words) so external
  dcpext0..3 stay untouched on their normal s2idle path and never get
  permanently shut down in s2idle.
- Skip only the internal DCP's own dcp_platform_suspend/resume when
  dcp_t6041_internal_down is set so its powered-off registers are never
  accessed and its power domains are not pinned by wakeup_path.
- Mark the internal display DART dark before lowering DISP0 power words
  and update pmc-dcp through dcp_pmc_set() so concurrent external DCP
  counts are preserved while full deep sleep still brings pmc-dcp to 0.
- Split dcp_t6041_display_poweron() from dcp_t6041_recommit_planes() so
  s2idle resume and stop-unwind paths never take DRM modeset locks inside
  s2r_prewarm_lock, and ensure s2idle -> deep (including from a dark wake)
  never double-stops or double-lowers the internal DCP.

Add KUnit coverage for the T6041 s2idle guard invariants in
dcp_t6041_wake_test.c.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
On T6041 (apple,sleep-host-stop), runtime DPMS off currently leaves the
internal DCP coprocessor and DISP0 power domains powered (blanking the
backlight and, when apple,t6041-handoff enables adopt_live_session on
firmware 27.x, at most soft-blanking via A484(0)).

Wire dcp_dpms_power_off() and dcp_dpms_power_on() for T6041 internal DCPs
using dcp_t6041_internal_stop_locked() / dcp_t6041_internal_start_locked():

- Gate runtime DPMS power cycling via dcp_t6041_dpms_capable() (requires
  sleep_host_stop, non-T6040, non-hw.s2r, mapped main_chain, and on
  firmware 27.x a method table providing dcpep_unnamed_500) when
  pm_suspend_target_state is PM_SUSPEND_ON.
- Pass dpms=true into dcp_t6041_stop_dev() to skip flushing bl_update_wq
  (avoiding a crtc->mutex deadlock with drm_crtc_set_brightness() during
  blocking DPMS commits) and keep crashed/ext_dead clear so
  dcp_crtc_atomic_check() permits DPMS-on without any transient window.
- Guard dcp_v27_dpms_off_locked() against running once dpms_powered_off or
  s2r_fw_down is set.
- Serialize against s2idle and deep sleep via s2r_prewarm_lock so
  suspending while DPMS-off does not double-stop firmware or double-lower
  DISP0 power words, and resuming from either s2idle or deep sleep while
  DPMS-off keeps the internal DCP and panel off until DPMS on.
- Power back on during live driver removal (SYSTEM_RUNNING) and return
  early in dcp_comp_unbind() during system shutdown while s2r_fw_down is
  set so reboot/poweroff never touches a powered-off DISP0 block.

Extend dcp_t6041_wake_test.c with KUnit coverage for T6041 DPMS gating,
T6040 exclusion, v27 soft-off suppression, and sleep serialization.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken
AxxzyWasTaken requested review from a team as code owners December 2, 2026 01:25
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at b3c3dab2: ready to merge

Check Detail
CI at head ok 12 checks passed
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at b3c3dab2
Conflicts ok none
PR text ok Risk: two-way · . Medium (touches internal display power-down/bring-up lifecycle), mitigated by scoping strictly to dcp_t6041_internal_capable() (T6041 fw-27 non-S2R internal DCP only; M4 Pro t6040 and hw.s2r chips untouched) and passing all 20× DPMS, s2idle, deep, combined DPMS-off -> sleep -> DPMS-on, and reboot-while-DPMS-off hardware gates on J616C.

Areas: area:display
Merge: gh pr merge 3861 --merge (Owners and Core through the bypass: add --admin).

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

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

The new internal stop state separates DPMS from system sleep, and startup restores the DCP before the resume commit. The J616C row covers repeated DPMS cycles, both sleep modes, and reboot while the panel is off.

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

Copy link
Copy Markdown
Contributor

T6040 (M4 Pro) row and a proposal: the !t6040 clause can go.

Hardware: T6040 has the same display-power block (same address, apple,t6041-display-power fallback) and the same apple,t6041-dcp internal DCP. Its deep sleep (#2215) already stops and cold-starts that DCP through dcp_t6041_stop_dev().

Row: J616s (16-inch M4 Pro), macOS 26.6.2 stub, kernel = main f53f2fe9 + this PR at b3c3dab2, main's t6040-j616s.dtb via a one-shot Stage 2 (the J616s's production Stage 2 predates #2215, so it has no apple,sleep-host-stop). A = this PR as posted. B = the same kernel with only the !dcp->t6041_power.t6040 clause dropped (appledrm swapped, build-ids ba42aeb4 / 3a59a7e1). GNOME, bl 359/600, Total System Power 20 s x 0.5 s.

A (as posted) B (T6040 admitted)
DPMS-on idle 10,830 mW 10,848 mW
DPMS-off 3,559 mW 3,567 mW
20x DPMS off/on 20/20 20/20
s2idle x3 + 1 entered DPMS-off 4/4, internal DCP stays up 4/4, internal DCP stopped + cold-started, panel back each time
deep x1 PASS PASS
s2idle suspend / resume devices 0.19 / 0.28 s 0.35 / 0.44 s
failed units, DCP fw syslog errors 0, same set 0, same set
  • A is a no-regression row for T6040: with the !t6040 clause the PR does nothing on M4 Pro.
  • B: the s2idle half works on T6040.
  • The DPMS half doesn't engage on 26.6 firmware. dcp_dpms_power_off() is reached only from the soft-DPMS route (dcp_uses_soft_dpms(): H17P / firmware 27). The 26.6 desktop instance takes _dcp_poweroff(), so DPMS-off power is unchanged. That is a firmware condition, not an SoC one: a T6041 on 26.6.2 doesn't get it either, and a T6040 on 27.2 should get it the same as your J616c. We have no 27.2 J616s to show that yet.

Proposal: drop the clause here, or I open it as a follow-up once this merges: branch fix/t604x-dcp-s2idle (13f8c2a2, one line + the KUnit expectation flipped to TRUE for T6040). Your call.

Evidence: traces/power/20261202-b7-t6040-j616s/{A,B} (lab store).

@github-actions github-actions Bot added door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 2, 2026
@DjDeveloperr
DjDeveloperr merged commit a7e01e0 into aurora-silicon:main Dec 2, 2026
14 of 15 checks passed
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) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) kunit-full ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants