Repository navigation
drm/apple: dcp: stop T6041 internal DCP during s2idle and runtime DPMS - #3861
Conversation
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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
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.
|
T6040 (M4 Pro) row and a proposal: the Hardware: T6040 has the same Row: J616s (16-inch M4 Pro), macOS 26.6.2 stub, kernel = main
Proposal: drop the clause here, or I open it as a follow-up once this merges: branch Evidence: |
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 durings2idleand runtime DPMS-off:847cdbe6e4bd3):drm/apple: dcp: stop T6041 internal DCP during s2idledcp_t6041_internal_capable()(gated onsleep_host_stop,!t6040,!dcp_s2r_capable(),main_chain, and fw-27dcpep_unnamed_500tag) anddcp_t6041_s2idle(bool down)hooks indcp_platform_suspend()/dcp_platform_resume()so T6041 internal DCP cleanly shuts down acrossPM_SUSPEND_TO_IDLEand cold-boots on resume without touching M4 Pro (t6040) or native S2R (hw.s2r) paths.b3c3dab2c9f5f):drm/apple: dcp: power-cycle T6041 internal DCP on runtime DPMSdcp_t6041_stop_dev()withbool dpmsso runtime DPMS-off powers down internal DCP cleanly without settingcrashed/ext_dead(keepingdcp_crtc_atomic_check()open for DPMS-on) and without flushingbl_update_wqundercrtc->mutex(avoiding ABBA deadlock withdrm_crtc_set_brightness()).dcp_v27_dpms_off_locked()against firing soft-off on an already powered-off DCP (dpms_powered_off || s2r_fw_down).dcp_comp_unbind()forsleep_host_stop && s2r_fw_down && system_state > SYSTEM_RUNNINGso shutdown/reboot while DPMS-off completes cleanly without touching powered-offDISP0.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-upscripts/checkpatch.pl --no-tree -: 0 errors, 0 warnings on both commits.LLVM=1 W=1build ofdrivers/gpu/drm/apple/dcp.oandapple_drv.o: 0 errors, 0 warnings.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.26B123) verification (7.3.0-j616c-272-ov1+, apples-to-applessddmHyprland greeter,hl.dsp.dpms({ action = "disable" / "enable" }),macsmc_hwmonTotal System PowerPSTR, 20 s × 0.5 s sampling):dpmsStatus=0):fb0136a9): 2,519.3 mW mean / 2,483.1 mW median (min 2,466.6 mW)b3c3dab2): 1,396.9 mW mean / 1,344.5 mW median (min 1,316.1 mW)bl=100): 4,428.8 mW mean / 4,380.4 mW median (unchanged vs baseline 4,392.9 mW).dpmsStatusverified0 -> 1on every cycle).s2idle(rtcwake -d /dev/rtc1 -m freeze -s 15) → DPMS-on: PASS (dpmsStatus=1).deep(rtcwake -d /dev/rtc1 -m mem -s 15) → DPMS-on: PASS (dpmsStatus=1).s2idle(15 s, confirmed internal DCP stop + cold-boot EDID/backlight on wake) →deep(15 s) → resume: PASS (dpmsStatus=1).dpmsStatus=0→systemctl reboot): PASS (clean reboot back online in 18 s).dmesgerrors/warnings/deadlocks/SErrors: 0.Risk
dcp_t6041_internal_capable()(T6041 fw-27 non-S2R internal DCP only; M4 Prot6040andhw.s2rchips untouched) and passing all 20× DPMS,s2idle,deep, combinedDPMS-off -> sleep -> DPMS-on, and reboot-while-DPMS-off hardware gates on J616C.Not yet
rmmod appledrmwhile DPMS-off.