Skip to content

pmdomain: apple-pmc: restore display interface enables after deep sleep - #3452

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
stango-git:fix/apple-pmc-interface-resume
Nov 30, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
stango-git:fix/apple-pmc-interface-resume

Conversation

@stango-git

@stango-git stango-git commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Tested: J713 M4 Air (T8132) at ecfd0f1: BWR/boost enables restored across deep sleep, clean 165 Hz external output; J613 M3 Air (T8122) at ecfd0f1: 3/3 mem/deep cycles, 0 failed units.
Risk: two-way · M4 (T8132); a plain revert undoes it, no-op on other SoCs.

What: Restore powered non-consumer_switched PMC display BWR (0x2020) and boost (0x2028) interface enable bits in apple_pmc_resume_early() after firmware deep sleep so external display pipes do not stay stuck at minimum display clocks on resume.

Tested:

  • ecfd0f11 on J713 (M4 MacBook Air 13", T8132, Mac16,12) + Dell AW3926QW (5120x2160@165 Hz over USB-C DP Alt Mode): PASS — bwr enable: 0x00000018 and boost enable: 0x00000007 restored cleanly across deep sleep + wake cycles with 0 apple-pmc errors and clean full-screen 165 Hz output (tested on 7.3.0-dualpipe-s2+, byte-identical PMC diff to ecfd0f11).
  • ecfd0f11 on J613 (MacBook Air 13" M3, T8122, macOS 26.6.2 / 25G83 firmware, tested by satchlj): PASS — 3/3 consecutive real mem/deep suspend/resume cycles (boot object resumes 0 -> 1 -> 2 -> 3), clean internal DCP warm-restart, systemctl --failed == 0.
  • Build: drivers/pmdomain/apple/pmc.o built with LLVM=1 W=1 both with and without CONFIG_APPLE_PMC_KUNIT_TEST=y (0 new warnings); scripts/checkpatch.pl --strict --no-tree 0 errors / 0 warnings.

Risk: two-way door · M4 (T8132) — cleanly revertible kernel-only change with no bootloader, DT, or persistent state changes; bwr_enable/boost_enable are only populated on apple_pmc_hw_t8132 (clean no-op elsewhere), and consumer_switched interfaces (internal disp0) remain managed by their consumer.

Not yet: Non-J713 T8132 Macs with high-pixel-rate external displays; running apple_pmc_test_interface_resume KUnit live in-kernel (compile-verified with LLVM=1 W=1).

Details

Deep sleep on T8132 clears the PMC display BWR interface enable register (0x2020) to 0x0 and resets the boost interface enable register (0x2028) to BIT(0) (internal display only), while genpd continues to track powered external display interface domains (pmc-dispext0-interface, pmc-dispext1-interface) as on. Because apple_pmc_resume_early() previously restored only rail_enable, rail floors, and the AP DCS vote, external display pipes remained stuck at their lowest display clock after deep sleep — causing immediate scanout underrun on high-pixel-rate modes (e.g. 5120x2160@165 Hz).

  • Track powered state in dom->on for genpd display interface domains (apple_pmc_interface_init() from boot register state, updated in apple_pmc_interface_set() under pmc->lock).
  • Extract lock-held apple_pmc_interface_apply() and call apple_pmc_interfaces_restore() from apple_pmc_resume_early() to restore powered non-consumer_switched interface domains' BWR and boost enable bits after firmware sleep.
  • Leave consumer_switched interfaces (internal disp0) untouched, as their consumer manages their bits.
  • Add apple_pmc_test_interface_resume KUnit test in drivers/pmdomain/apple/pmc-test.c.
Evidence
  • Live T8132 (Mac16,12, J713, 5120x2160@165 Hz external display over USB-C DP Alt Mode):
    • Before fix: /sys/kernel/debug/apple-pmc/382800000.power-management/status dropped from bwr enable: 0x00000018, boost enable: 0x00000007 before sleep to 0x00000000 / 0x00000001 after deep sleep, causing scanout underrun below the top ~40 lines at 165 Hz.
    • After fix: bwr enable: 0x00000018, boost enable: 0x00000007 are restored cleanly across deep sleep + wake cycles with zero apple-pmc errors and clean full-screen 165 Hz output.
  • Peer hardware regression (satchlj): J613 (MacBook Air 13" M3, T8122) at exact head ecfd0f11 — 3/3 mem/deep suspend/resume cycles passed, systemctl --failed == 0.
  • Build & style: LLVM=1 W=1 build of drivers/pmdomain/apple/pmc.o with and without CONFIG_APPLE_PMC_KUNIT_TEST=y (0 new warnings); scripts/checkpatch.pl --strict --no-tree (0 errors, 0 warnings, 0 checks).

Deep sleep on T8132 clears the PMC display BWR interface enable word
(0x2020) and resets the boost interface enable word (0x2028) to BIT(0)
(internal display only), while genpd continues to track powered external
display interface domains (pmc-dispext0-interface, pmc-dispext1-interface)
as on. Because apple_pmc_resume_early() previously restored only rail
enables, floors, and the AP DCS vote, external display pipes remained
stuck at their lowest display clock after resume, causing scanout
underrun on high-pixel-rate modes such as 5120x2160@165 Hz.

Track powered state in dom->on for genpd interface domains (initialized
from the boot register state and updated on successful power_on/power_off),
extract lock-held apple_pmc_interface_apply(), and restore powered
non-consumer-switched interface domains in apple_pmc_resume_early() via
apple_pmc_interfaces_restore(). Consumer-switched interfaces remain
managed by their consumer.

Add KUnit coverage in pmc-test.c verifying that powered genpd interface
domains (both runtime-enabled and boot-inherited) are restored after
simulated register loss while off and consumer-switched domains are left
alone.

Signed-off-by: Joe Stango <[email protected]>

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed at exact HEAD ecfd0f1138d0:

  • Code review: tracking dom->on for @interface domains under pmc->lock (initialized from boot-saved BWR/boost state in apple_pmc_interface_init() and updated only on successful apple_pmc_interface_apply()) and restoring powered non-consumer-switched domains in apple_pmc_resume_early() is clean and lock-safe, with a clean no-op when bwr_enable/boost_enable are absent and solid KUnit coverage in apple_pmc_test_interface_resume.
  • scripts/checkpatch.pl --strict --no-tree: 0 errors, 0 warnings, 0 checks.

@github-actions github-actions Bot added area:power Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at ecfd0f11: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, pr-text / pr-text
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok in the PR body at ecfd0f11
Conflicts ok none
PR text ok Risk: two-way · M4 (T8132); a plain revert undoes it, no-op on other SoCs. · M4 (T8132) — cleanly revertible kernel-only change with no bootloader, DT, or persistent state changes; bwrenable/boostenable are only populated on applepmchwt8132 (clean no-op elsewhere), and consumerswitched interfaces (internal disp0) remain managed by their consumer.

Areas: area:power

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

@satchlj

satchlj commented Nov 28, 2026

Copy link
Copy Markdown
Member

Hardware row at exact head ecfd0f11 on J613 (MacBook Air 13" M3, T8122, macOS 26.6.2 / 25G83 firmware): PASS.

  • Tested as part of the full J613 deep-sleep kernel stack (7.3.0-m3-s2r, byte-identical diff to ecfd0f11) across 3/3 consecutive real mem/deep (pm_test=none) suspend/resume cycles (boot object resumes 0 -> 1 -> 2 -> 3).
  • Internal display DCP warm-restarted cleanly after every deep-sleep wake (345–348 ms, failed 0, swaps advancing, backlight and CTM restored) with display interface enables intact and systemctl --failed == 0.

(Looks like only adding the Tested: and Risk: lines to the PR description remains for pr-readiness.)

satchlj added a commit to satchlj/linux that referenced this pull request Nov 28, 2026
Keep .untested = true and .display_no_restart = true on t8122_sleep_soc
so /sys/power/mem_sleep remains [s2idle] by default until all T8122
deep-sleep prerequisites (aurora-silicon#3425, aurora-silicon#3504, aurora-silicon#3445, aurora-silicon#3452) have landed and
27.2-firmware T8122 boards (J615) have a matching display sleep path.

With .untested and .display_no_restart preserved, default s2idle and
apple_sleep.deep=1 dry runs stay intact on both 26.6.2 (J613) and 27.2
(J615), while committed J613 deep sleep runs via apple_sleep.deep=1
apple_sleep.untested_commit=1.

Signed-off-by: Satya Benson <[email protected]>
@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot) ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 28, 2026
@RyanTheTide
RyanTheTide merged commit 87f8dd6 into aurora-silicon:main Nov 30, 2026
6 of 8 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged, thank you @stango-git. Your J713 run plus satchlj's J613 deep-sleep row at ecfd0f11 covered it. Sorry the CI took so long: the fork runs had been waiting for maintainer approval since 11-27.

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

Labels

area:power Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants