Skip to content

soc: apple: add T6020 (M2 Pro) suspend-to-RAM and DCP S2R power layouts - #3999

Merged
DjDeveloperr merged 15 commits into
mainfrom
feat/t6020-s2r-sleep
Dec 3, 2026
Merged

DjDeveloperr merged 15 commits into
mainfrom
feat/t6020-s2r-sleep

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What

T6020 (M2 Pro, J414s) suspend-to-RAM: the sleep profile, the PMP's and AIC's part of it, the T6020 display coprocessor power layouts, and the device tree.

  1. dt-bindings: soc: apple: Add the T6020 sleep controller
  2. irqchip/apple-aic: Keep the T6020 AIC's state across a firmware sleep
  3. soc: apple: pmp: Keep the T6020 PMP's data and stop it in suspend_late
  4. soc: apple: sleep: Add an untested T6020 (M2 Pro) profile: offered only with apple_sleep.deep=1, and a dry run unless apple_sleep.untested_commit=1; the J414s sequence from J414s (T6020) suspend-to-RAM: PSCI-via-EFI series vs sleep.c, which way should it land? #3336 and patatman's ref/t6020-s2r-j414s
  5. arm64: dts: apple: t6020: Add the sleep controller
  6. dt-bindings: display: apple,t8140-display-power: add T6020
  7. drm/apple: add T6020 DCP and external DCP S2R power layouts (behind appledrm.s2r_untested)
  8. arm64: dts: apple: t602x: wire apple,display-power for DCP S2R
  9. soc: apple: sleep: Let the profile say when SEP and the SMC are done
  10. soc: apple: sleep: Bring T6020's commit closer to macOS's entry
  11. soc: apple: sleep: Set SIO's AXI2AF idle settings on T6020 (values from JJRPF's public T6020 port)
  12. soc: apple: sleep: Save and restore T6020 MCA audio clock muxes across sleep

main (536a613c0abe) is merged in at b4038743451e. The only conflicts were the T6030 (#4067) and T6020 lines added side by side in sleep.c and sleep-test.c, and both are kept.

Tested

Hardware, J414s, OS firmware 27.2 (mBoot-20457.41.3), with rtcwake -d rtc0 -m mem ([deep]) sleeps.

Exact-head full-desktop row

This row ran on the pre-merge head 38a2359dad3d. The later merge at b4038743451e only brings in main.

  • Heads: main 35bfbf3875a7 + drm/asahi: start the M2 Pro GPU (T6020, G14S) on GPU firmware 27.2 #3998 51e809cf3c3d + soc: apple: add T6020 (M2 Pro) suspend-to-RAM and DCP S2R power layouts #3999 38a2359dad3d + clk: apple-nco: put the probe-time registers back for a firmware sleep #4200 ae343b883fba (7.3.0-j414s-ship-38a2359d+, boot_id=b3bd8ab6-6349-4319-be17-73e095979c4d, Fedora 45 graphical.target, zero module_blacklist, aurora, appledrm, audio, SEP, MTP keyboard all active).
  • Result: woke 2/2 consecutive deep sleeps in one boot (100 s + 30 s, suspend_stats success 2 / fail 0, boot object resumes 0 -> 1 -> 2, 194/252 AP pins restored, halted 0x19, held/macOS-off/clusters stuck 0).
    • Audio (timed-playback.sh, 2.0 s silence on plughw:AppleJ414,0): pre-sleep 2.165 s @ 48 kHz / 2.039 s @ 44.1 kHz -> post-wake 1 2.142 s / 2.033 s -> post-wake 2 2.203 s / 2.044 s (rc=0).
    • Display (programmatic): apple-panel-bl 117/500 (bl_power=0), eDP-1 connected/enabled/dpms=On, kwin_wayland active 3024x1964 AR30 framebuffer after both wakes.
    • GPU (aurora G14S B1): firmware 27.2 back in 3565 us / 3700 us (pending=0); dEQP-VK.api.smoke.* 8/8 PASS and clpeak single-precision float4 5.64 / 5.64 / 5.60 TFLOPS (pre / wake 1 / wake 2), 0 GPU/MMU/RTKit faults.
    • Keyboard (programmatic): /dev/input/by-path/platform-2a9b30000.input-event-kbd (Apple MTP keyboard) open/ioctl + Caps Lock LED round-trip 00 -> 02 -> 00 after both wakes, 0 MTP/dockchannel errors.
    • PCIe / Wi-Fi / BT: both root ports restored, lspci -nn intact, Wi-Fi 3/3 ping after both wakes, BT Powered: yes.

Prior test-kernel isolation & bring-up rows

The rows below ran on test kernels (linux#3998 + commits 1 to 8 + the content of 9 to 12 with diagnostics, not the exact head 38a2359dad3d). Each row names what was left out or added.

Left out / configuration Boots Result
aurora, apple_sio, apple_admac, snd_soc_macaudio, snd_soc_apple_mca, snd_soc_aop, aop, aop_als, aop_las, aop_temp, aop_devmotion, apple_isp, apple_avd, ane_t6021, macsmc_hwmon, macsmc_input, macsmc_power, leds_pwm, hci_bcm4377, sdhci_pci, thunderbolt_apple (appledrm needs apple_sio, so it was not loaded either; SEP services masked in the first boot only) 3 woke 3/3
the list above without apple_sio and apple_admac (so appledrm was loaded; SIO_CPU off at the sleep) 1 woke 1/1
aurora, macsmc_hwmon, macsmc_input, macsmc_power, snd_soc_macaudio, snd_soc_apple_mca 1 woke 1/1
aurora, snd_soc_macaudio, snd_soc_apple_mca 1 woke 1/1
aurora, snd_soc_macaudio 1 woke 1/1
aurora, with speakerguardd-v2* and alsa-state masked and no PCM opened 2 woke 2/2
aurora 5 did not wake (one with the keyboard backlight off, two with extra codec device-tree properties, one with a test clk-apple-nco module)
aurora, thunderbolt_apple, aop, aop_als, aop_las, aop_temp, aop_devmotion, snd_soc_aop 1 did not wake
aurora, apple_isp, apple_avd, ane_t6021 1 did not wake
aurora, macsmc_hwmon, macsmc_input, macsmc_power 1 did not wake
aurora, masked services as above, one headphone PCM prepared or played (1 s) 2 did not wake
the row above, with clk-apple-nco CTRL_ENABLE / loader-state restore (including #4200) 3 woke 3/3 (2x loader-state restore, 1x CTRL_ENABLE bit 31 only; 1x loader DIV/INC with CTRL_ENABLE cleared did not wake)
B21b (test kernel c6g t6020_dev_crumbs=0 + #4200 v2 ae343b883fba): aurora only, speakerguardd-v2* and alsa-state unmasked, 3 consecutive sleeps in one boot (100 s, 300 s, 30 s) 1 woke 3/3 (boot_id=28551004, suspend_stats success 3 / fail 0, resumes 0 -> 1 -> 2 -> 3, Cycle 3 wake source NUB.SPMI0Sw3IRQ, post-wake RTC alive, Wi-Fi 3/3 ping, lspci -nn intact)
B22 (test kernel Image-mca-c6g 313368850e84 + #4200 v2 ae343b883fba): aurora only, speakerguardd-v2* and alsa-state unmasked, MCA clock mux save/restore (commit 12 content), 100 s sleep + timed 2.0 s silence playback (plughw:AppleJ414,0) 1 woke 1/1 (boot_id=702cadff, resumes 0 -> 1, mca clk mux 0 restored 85100100 -> 80100100 -> 85100100, stuck 0; pre-sleep 2.348 s @ 48 kHz / 2.058 s @ 44.1 kHz -> post-wake 2.166 s @ 48 kHz / 2.043 s @ 44.1 kHz, vs 0.311 s / 0.272 s without commit 12)

A wake: boot object resumes increment, 194 of 252 AP pins lost and put back, same boot id, suspend_stats fail 0, SSH and Wi-Fi back. Not waking: the machine resets about 94 to 97 s after the sleep starts (WD2), at the last stage before the memory quiesce.

Build: every commit 9 to 12 compiles on its own tree (arm64, LLVM, W=1, sleep.o, macsmc.o, pm_shim.o, 0 warnings); checkpatch.pl --strict 0 errors, 0 warnings, 0 checks on commit 12.

On the merge head b4038743451e, each check matches main:

  • W=1 LLVM builds of sleep.o (also with sleep-test.c compiled in), dcp.o, AIC, macsmc.o, pm_shim.o, pmp.o and pmp-export.o: 0 warnings.
  • dt_binding_check of both yamls: clean.
  • CHECK_DTBS on the 8 T602x DTBs: the same warnings as main.
  • Host tests display26 and sep-suspend-errors: pass.

The receipt is in the comments.

Risk

Two-way. T6020 deep sleep stays behind apple_sleep.deep=1 and apple_sleep.untested_commit=1. Shared code: macsmc.c and pm_shim.c read two new profile fields that only T6020 sets. dcp.c layouts stay behind appledrm.s2r_untested. By default, two DCP changes apply on every T602x on firmware 27: map_reg goes through the DART, and the external DCPs echo RTKit log counters. T6021 dcpext2/3 have no apple,display-power and stay untouched.

Not yet

  • A row on T6021/T6022 (M2 Max/Ultra). They share the apple,t6020-* compatibles; by default only the two DCP changes in Risk apply there. No second-generation row is owed (code read on the merge b4038743451e): no other generation's device tree includes t602x-die0/dieX. Every shared hunk (AIC, PMP, DCP, macsmc.c, pm_shim.c, sleep.c) is behind an apple,t6020-* compatible or a profile field only T6020 sets.
  • Physical keypress / visual screen inspection after wake (display and keyboard above were verified programmatically over SSH).
  • J414s on OS firmware 13.5 (patatman's J414s on 13.5 did not wake with the first 8 commits; dry run passes).

Describe the registers the EL2 sleep driver uses on the M2 Pro: the
PMGR's four power-state blocks, its CPM power gates, CPU start, cluster
and commit words, the watchdog, both nub SPMI controllers, the wake
controller, and the SoC clock, PLL and always-on words the commit reads.
Every range comes from the ADT's /arm-io/pmgr, wdt, nub-spmi0 and
nub-spmi1. Boards list their ADT's wake sources in apple,wake-enable.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The M2 Pro's AIC2 loses its configuration with the SoC's power in a
deep sleep, as T8112's does. Match "apple,t6020-aic" with the T8112
settings, so the syscore save and restore run around a firmware
suspend. Nothing changes for s2idle: the hooks only act when the sleep
driver suspends through firmware.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Give T6020 its own configuration: over a sleep the PMP keeps only its
__DATA segment, 0xa4000 bytes at 0x58000 in the J414s 27.2 ADT's
segment-ranges, its offset read from the SRAM header as on T8132.
apple,sram-keep still overrides both. Everything else stays at the
defaults T6020 runs with today.

On T6020 the firmware answers no idle request at the sleep's commit:
with interrupts off, SET_AP_PWR_STATE(IDLE) went unanswered for 200 ms
on two J414s units, and the commit after it never reached the sleep
(#3336). The same stop in suspend_late, interrupts
on, idles it in about 22 ms, and both units slept and woke with it. So
on T6020 the PMP's stop stays in suspend_late. A dry run leaves the
firmware running, since only a real sleep restarts it, and checks the
SRAM range the stop would keep. A sleep refused after a real stop
leaves the firmware stopped until the next real sleep, as before the
commit stop existed.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Add suspend-to-RAM for T6020 on the T8112 profile's operations, with
T6020's own register map, commit and wake. Like T8112 it is untested:
deep sleep is offered only with apple_sleep.deep=1, and a sleep is a
dry run that refuses after every check unless
apple_sleep.untested_commit=1.

The commit and wake are the J414s sequence that two J414s units slept
and woke with (#3336): macOS's sleep entry as
traced under a hypervisor in the Aurora-DeepIdle runs, replayed in its
order, as carried by Pim Jeursen's J414s provider (patatman/linux
ref/t6020-s2r-j414s at b274e09). Where T6020 differs from T8112:

- The PMGR keeps its power words in four blocks. The profile keeps its
  own books of all 213 ADT power words, and of which ones macOS has off
  at its commit.
- Three CPU clusters at MPIDR affinity 1, up to four cores each.
- The GPU, ANS, SIO and internal display (firmware 13.5) have no stop of
  their own at the commit: it halts each CPU whose domain is still
  fully on, lowers the display and USB domains left on, then every
  word macOS has off.
- The SoC fabric goes under AUTO_ENABLE, the complexes, clocks and PLL
  are parked, and the memory side is quiesced by macOS's writes.
- WD0 and WD1 go off before the commit word, which arms WD2.
- Each core cleans its L1 and arms CYC_OVRD. The last core of each
  cluster arms its ACC_OVRD, whose L2 flush the hardware does.

The commit stops the held cores itself, after the memory side, so the
shared commit gains commit_stops_cpus. As on T8112, the AIC masks and
everything the wake reads are saved before the RAM is cleaned past the
caches. A dry run reads, and only reads, every always-on word the commit
would write, and reports them.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Describe the T6020 sleep registers, disabled by default, and enable
them on J414s with its ADT's ap-wake-sources: the AOP, the NUB (the
PMU's RTC alarm is 54), the SMC, the four ATC ports and the MTP. The
other T6020 boards stay disabled until their own ADT's sources are
listed.

The profile is untested: deep sleep stays off unless
apple_sleep.deep=1, and a sleep is a dry run unless
apple_sleep.untested_commit=1.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Allow apple,t6020-display-power with the apple,t8103-display-power fallback (single "ps" PMGR power-state window, no retention or pmc-dcp words), matching T8112.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Add dcp_s2r_t6020 (pmgr_east disp0_cpu0/fe/sys at 0x1d8/0x1d0/0x1b0) and dcp_s2r_t6020_ext (pmgr dispext0 at 0x2d8/0x2c0/0x258 and dispext1 at 0x2b8/0x2b0/0x248), with DART streams BIT(5) and BIT(0)|BIT(4) matching T8112.

Wire apple_dcp_hw_t6020 (.s2r) and apple_dcp_hw_t6020_dcpext (.s2r_ext) behind .s2r_untested = true (gated by appledrm.s2r_untested) and bounds-check dcp->index against dcp_s2r_t6020_ext so T6021 dcpext2/3 stay untouched.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Add display-power@290280000 (pmgr_east) for internal dcp and display-power@28e080000 (pmgr) for dcpext0 and dcpext1 so appledrm can stop and restart firmware 27.2 display coprocessors across S2R.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@patatman

patatman commented Dec 3, 2026

Copy link
Copy Markdown

Confirmed — please feel free to use:

Co-developed-by: Pim Jeursen <pim@jeursen.nl>
Signed-off-by: Pim Jeursen <pim@jeursen.nl>

I'm pulling #3999 onto my J414s (10-core M2 Pro, system-fw 26.6.2 / os-fw 13.5) next to run hardware S2R wake testing and report back.

@patatman

patatman commented Dec 3, 2026

Copy link
Copy Markdown

Tested #3999 (05a4e717dccabb49966188c89460d15ebca4e780) rebased onto origin/main (c09b61228) on my J414s (10-core M2 Pro, system-fw 26.6.2 / os-fw 13.5, Aura Stage-2 ae08762a with the #3999 t6020-j414s.dtb spliced in, plus a small local 13.5 G14S GPU + internal DCP warm-restart patch and #3811, dock unplugged).

1. Dry run (apple_sleep.deep=1, apple_sleep.untested_commit=0): PASS

Every pre-commit check passed cleanly:

apple_pmp 28e700000.pmp: dry run: firmware left running, 671744 bytes of SRAM to keep
apple-sleep 28e080000.sleep-controller: 3 coprocessors up and stopped
apple-sleep 28e080000.sleep-controller: dry run: every check passed; refusing before the first stop and the commit (untested SoC, apple_sleep.untested_commit=1 lets it through)
apple-sleep 28e080000.sleep-controller: T6020 dry run: clusters P0 0x2f P1 0x2f ANE 0x2f AVE 0x2f DISP 0x2f E 0xf, cpm 0x80000000 0x80000000 0x80000000, commit 0x1, sep 0x1000030f pmp 0x1f0f03ff apcie_gp_sys 0x1f0000ff afr 0xf040300 aon_cfg 0x0 pll 0x239 clk 0x85100000; would halt 0xc, lower 0 held and 24 macOS-off words

2. Real deep sleep (apple_sleep.deep=1 apple_sleep.untested_commit=1, rtcwake -d rtc0 -m mem -s 10): FAIL (does not wake; cold boot)

  • On unmodified #3999 (#1), the machine stayed dark past 10 s and ended in a cold boot (boot object resumes 0).
  • To pinpoint where it stopped, I ran a second build (#2) with:
    • a 1-byte Maverick PMU scratch breadcrumb at 0x600c (0x70 at t6020_sleep_commit_regs() entry, 0x72 right before t8132_clean_ram() / t6020_mem_writes(), 0x80 at t6020_sleep_wake() entry, 0x84 at t6020_sleep_wake() exit),
    • 500 ms settle delay after gen-1 SMC slpa + AP_POWER(false) (matching my working J414s branch, vs SMC_SLEEP_IDLE_MS = 30),
    • dcache_clean_poc() and post-commit aic_sleep_mask_all() + dsb(sy) after writel(1, s->commit).
  • #2 reproduced the exact same failure (cold boot, boot object resumes 0), and spmi_nvmem0 read 0x600c = 0x72 on the next boot.

So t6020_sleep_commit_regs() completed all PMGR, cluster, clock, PLL, and AMCC teardown steps cleanly (0x72), and t6020_sleep_wake() was never entered (0x80 never written) — even with the 500 ms SMC settle, dcache_clean_poc(), and post-commit AIC masking restored.

Remaining differences vs my working J414s tree (same machine + Aura ae08762a, sleeps & wakes cleanly)

The failure is narrowed to the window between 0x72 (t8132_clean_ram() -> t6020_mem_writes() -> spin_table_stop_parked() -> writel(1, s->commit) -> deep WFI) and 0x80 (t6020_sleep_wake()), or to one of the remaining deltas on origin/main + #3999:

  1. rtc0 is now apple-pmu-rtc (#3933) instead of macsmc-rtc, with spmi@29e114000 IRQ active (apple_spmi_suspend_noirq parks notifications).
  2. apple_pmp HW_CFG_T6020 uses sram_backup = (0x58000, 0xa4000) + sram_backup_data = true (27.2 ADT size) instead of apple,sram-keep = <0x0 0x100000> on os-fw 13.5 (though t6020_sleep_wake() wasn't reached yet, so this would only matter if stopping PMP in suspend_late behaved differently).
  3. t8103_resume_stub / t8103_pac_saved vs t6020_resume_stub, or origin/main changes in sleep.c / smp_spin_table.c / apple_sep since the Nov 23 base.

Flagging this before merge so #3999 isn't marked verified yet — happy to bisect the exact 0x72 -> 0x80 delta (e.g. t6020_wfi_wait / t6020_cpu_off / rtc0 / apple_sep) and report back.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Thanks for the trailers and for the crumbs. Your 0x72 then nothing at 0x80 is what our J414s (OS firmware 27.2) showed too, with the 500 ms SMC settle, the AIC mask order and the cache clean all in.

At 10:40 UTC our J414s woke from a real deep sleep for the first time: boot object resumes went 0 to 1, 194 of 252 pin words had to be put back, 105 s on the wall clock with a 100 s alarm, and SSH answered after the wake. It is one cycle and it isn't narrowed down. That kernel is 05a4e717dcca plus local changes to the commit and the steps before it (not pushed yet), and the boot differed from the failing ones in four ways at once:

  1. the SEP userspace services were masked (the apple_sep module itself was loaded),
  2. a local selector for the commit steps had one more bit set,
  3. apple_sio was blacklisted,
  4. appledrm wasn't loaded as a result, because it depends on apple-sio, so all three DCPs were left to the commit.

We're splitting these one per boot now. If you want a cheap data point on 13.5: the same #3999 build, multi-user.target, with apple_sio and appledrm blacklisted and the SEP services masked. If that wakes and your normal boot doesn't, the display stop is the first suspect. The branch gets the functional parts as plain commits on top of 05a4e717dcca once the split shows which ones matter, with your Co-developed-by and Signed-off-by lines on the sequence. #3999 stays a draft and unverified until then.

DjDeveloperr and others added 4 commits December 3, 2026 05:58
T6020's enclave sets DEV_DISABLE in its power word once it is down, and
under AUTO_ENABLE the actual state may read 0 before that. The sequence
that woke J414s also waits 500 ms after the SMC answers slpa, as the
entry in Aura does. Both are facts of the profile; the other SoCs keep
what they have.

Co-developed-by: Pim Jeursen <pim@jeursen.nl>
Signed-off-by: Pim Jeursen <pim@jeursen.nl>
Signed-off-by: DjDeveloperr <hey@djdev.me>
 - GFX goes off before AFR, and nothing touches the GPU's power block
   after AFR is written 0.
 - PCIe's GP words are raised before the root complex's teardown: with
   ASPM L1 they are gated by then and the teardown was skipped.
 - The ANE's, ISP's and encoder's child words, which macOS has off at
   its S2R timer, go off with their parents. An external display
   coprocessor left running is halted.
 - SEP's floor gets up to 500 ms to drop before its word goes under
   AUTO_ENABLE.
 - The cleans before the memory side's quiesce go to the PoC, and the
   AIC's lines are masked after the commit word.

Co-developed-by: Pim Jeursen <pim@jeursen.nl>
Signed-off-by: Pim Jeursen <pim@jeursen.nl>
Signed-off-by: DjDeveloperr <hey@djdev.me>
Without them AFNC2 stays on at the commit. The 22 values are those of
JJRPF/linux 64564ace30be, drivers/soc/apple/sleep-t6020.h
(t6020_axi2af_tunables), compared entry by entry.

Signed-off-by: DjDeveloperr <hey@djdev.me>
sep_ps_down() reads apple_sleep_sep_dev_disable() and
apple_pmp_suspend_late() reads apple_sleep_dry_run(), so the SEP
suspend-error and the display26 bridge harnesses no longer build. Define
both, and cover the new branch: an enclave that sets DEV_DISABLE is not
down on its actual state alone.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@muness

muness commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

J414c (M2 Max, T6021, 13.5 firmware) data point: this draft, with a T6021 extension of the profile on top, completes deep sleep and wake from a full Hyprland desktop. Menu and lid-close entries, keyboard and lid-open wakes, through Aura's reset path into t8103_resume_stub.

What it took beyond this branch:

  • clk: apple-nco: put the probe-time registers back for a firmware sleep #4200. Without it the commit completes and the SoC never powers down; with it, it sleeps. Details there.
  • 13.5 firmware only, not for this PR: the G14 GPU's sleep is refused (genpd_prepare returns -16) until its firmware is idled, and the internal display coprocessor, halted cold by the commit, does not come back (wait for power timed out, connector will be broken) unless it is idled and stopped before the sleep and restarted warm after. Both are carried on the test branch, from JJRPF's work and the PSCI-entry kernel this machine runs daily.

Checked and not needed on this machine, each switched off for a sleep that still woke: a dsb and AIC mask-all between the two commit words (as ref/t6020-s2r-j414s has it), IRQ/FIQ mode 2 on the boot core's last WFI, and unbinding the PCIe endpoints before the freeze. The commit sequence works as written here.

Two things in the profile itself:

  • no_pmu_notes: the scratch at 0x8308 takes the step notes fine on J414c (PMU at USID 0xb on nub-spmi0), and having them off is why the missing NCO handling took five boots to find. With them on, the first failing sleep showed the commit had completed.
  • After every wake: PS prores: resync after sleep failed: -5, 17 words back (3 left), sep 0x1000030f (-110), and some key wakes reported as ATC0.USBWakeup with nothing on USB (others, and the lid wake, read MTP.DOCK.CHANNELS.AP0.IRQ). None of them stopped a wake.

T6021 needs, on top of the T6020 tables: the second display's cluster word, eight memory controllers, the two extra IOAs' error enables, the third and fourth external display's power words in the south PMGR block, and five words macOS zeroes. That is a branch on this one's head (t6021-s2r/on-3999 in the test tree's history); I'll open it against this branch once this is hardware-confirmed on T6020 or when you say.

Test tree: muness/linux wip/t6021-s2r-test-stack; Aura muness/aura wip/t6021-s2r-wake-notes (main plus aurora-silicon/aura#639 and a one-line T6021 change).

…s sleep

Deep sleep parks the T6020 MCA clock muxes (clk-mux +0x7c..+0x90, whose
sources are configured by the boot loader) back on the 24 MHz bypass,
causing audio playback after wake to run at ~375 kHz frame rate instead
of the programmed NCO rate.

Save the six MCA clock mux words and the five NCO channels before the
SoC clocks are parked, and restore them at the end of wake: start the
NCO channels first so each changed mux can complete its switch and clear
T6020_CLK_BUSY, then stop any NCO channel that was stopped before sleep.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware verification (J414s / M2 Pro, exact-head shipping row, n=2 deep sleeps in one boot)

  • Target: MacBook Pro 14-inch M2 Pro (J414s, Mac14,9, SoC T6020, chip-id=0x6020, board-id=0x04), OS firmware 27.2 (mBoot-20457.41.3), Fedora 45 (graphical.target, plasmalogin + kwin_wayland).
  • Exact merged heads tested (release 7.3.0-j414s-ship-38a2359d+):
    • main: 35bfbf3875a752fd38db108b8e6f603c98a17a93
    • #3998: 51e809cf3c3d0cf52192290c1a1a90b253b210bc
    • #3999: 38a2359dad3d7187d5361415bd325e14d0f168c9
    • #4200: ae343b883fbac21117d3faa2eef66de4293a4eab
    • vmlinuz sha256: 9bb7ff23864f544274916d395b8f5007e0211c567beceb5550e7c01b52001459
    • t6020-j414s.dtb sha256: b6bc377b5e1794228784c79a663f55b1b9adb5c8ec15978209af9e9b27922413 (in boot.bin 196da4c690882ac64a70932e2dbb5affa0828e533117c975633e1b6705a9bd38)
  • Configuration: full desktop, zero module_blacklist, speakerguardd-v2 and alsa-state unmasked, aurora, appledrm, snd_soc_macaudio, snd_soc_apple_mca, clk_apple_nco, apple_sep, dockchannel_hid, hid_apple_mtp_haptic all loaded. Cmdline additions: apple_sleep.deep=1 apple_sleep.untested_commit=1 appledrm.s2r_untested=1 no_console_suspend. mem_sleep set to [deep].
  • Boot ID: b3bd8ab6-6349-4319-be17-73e095979c4d (single boot across both sleeps).

Results (2/2 committed deep sleeps PASS)

Stage Sleep / Wake Timed 2.0 s audio (plughw:AppleJ414,0) Display & Backlight GPU 3D & Compute (aurora G14S B1) Keyboard (Apple MTP keyboard) PCIe / Wi-Fi / BT / Faults
Pre-sleep resumes 0, success=0 fail=0 48 kHz: 2.165 s, 44.1 kHz: 2.039 s (rc=0) apple-panel-bl 117/500 (bl_power=0), eDP-1 connected/enabled/On, kwin_wayland active 3024x1964 AR30 fb dEQP-VK.api.smoke.* 8/8 PASS; clpeak float4: 5.64 TFLOPS /dev/input/event3 open/ioctl + Caps Lock LED round-trip 00 -> 02 -> 00 lspci 5/5 devices, Wi-Fi 3/3 ping, 0 GPU/MMU/RTKit faults
Post-wake 1 (rtcwake -s 100) WOKE_RC=0, resumes 0 -> 1, success=1 fail=0, 194/252 AP pins put back, halted 0x19, held/macOS-off/clusters stuck 0, RTC 1796313583 -> 1796313706 48 kHz: 2.142 s, 44.1 kHz: 2.033 s (rc=0) apple-panel-bl 117/500 (bl_power=0), eDP-1 connected/enabled/On, kwin_wayland active 3024x1964 AR30 fb GPU fw 27.2 back in 3565 us (pending=0); dEQP-VK.api.smoke.* 8/8 PASS; clpeak float4: 5.64 TFLOPS /dev/input/event3 open/ioctl + Caps Lock LED round-trip 00 -> 02 -> 00 pci@0,0 & pci@1,0 links/bridges restored, lspci identical, Wi-Fi 3/3 ping, 0 GPU/MMU/RTKit/MTP/SPMI faults
Post-wake 2 (rtcwake -s 30) WOKE_RC=0, resumes 1 -> 2, success=2 fail=0, 194/252 AP pins put back, halted 0x19, held/macOS-off/clusters stuck 0, RTC 1796313802 -> 1796313850 48 kHz: 2.203 s, 44.1 kHz: 2.044 s (rc=0) apple-panel-bl 117/500 (bl_power=0), eDP-1 connected/enabled/On, kwin_wayland active 3024x1964 AR30 fb GPU fw 27.2 back in 3700 us (pending=0); dEQP-VK.api.smoke.* 8/8 PASS; clpeak float4: 5.60 TFLOPS /dev/input/event3 open/ioctl + Caps Lock LED round-trip 00 -> 02 -> 00 pci@0,0 & pci@1,0 links/bridges restored, lspci identical, Wi-Fi 3/3 ping, BT Powered: yes, 0 GPU/MMU/RTKit/MTP/SPMI faults

Notes

  • Audio playback rate stayed at 1.0x across both deep-sleep wakes (~2.14–2.20 s @ 48 kHz and ~2.03–2.04 s @ 44.1 kHz for 2.0 s of silence), confirming both the clk-apple-nco sleep fix (#4200) and T6020 MCA clock mux save/restore (#3999).
  • Display and keyboard checks were verified programmatically over SSH (backlight sysfs, DRM connector/DPMS state, kwin_wayland active 3024x1964 framebuffer, and Apple MTP keyboard EVIOCGNAME/EVIOCGLED + Caps Lock LED round-trip); no human physically pressed keys or visually inspected the screen.

@DjDeveloperr
DjDeveloperr marked this pull request as ready for review December 3, 2026 16:19
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 3, 2026 16:19
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) labels Dec 3, 2026
@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Merge readiness at b4038743: ready to merge

Check Detail
CI at head ok 17 checks passed
Review ok approved by RyanTheTide, sithglan
Requested changes ok none
Hardware row at head ok in the PR body at b4038743
Conflicts ok none
PR text ok Risk: two-way · . T6020 deep sleep stays behind apple_sleep.deep=1 and apple_sleep.untested_commit=1. Shared code: macsmc.c and pm_shim.c read two new profile fields that only T6020 sets. dcp.c layouts stay behind appledrm.s2r_untested. By default, two DCP changes apply on every T602x on firmware 27: map_reg goes through the DART, and the external DCPs echo RTKit log counters. T6021 dcpext2/3 have no apple,display-power and stay untouched.

Areas: area:display, area:gpu, area:platform, area:power
Merge: gh pr merge 3999 --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.

Main gained the T6030 sleep profile (#4067) at the same places this
branch adds T6020: keep both includes and both match-table entries in
sleep.c, and both compatibles in sleep-test.c's profile list.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged main (536a613c0abe) in. New head: b4038743451e, a merge commit (no rebase, no force-push).

Conflicts. The only ones were with #4067 (T6030 sleep), where both sides add a line in the same place. sleep.c keeps both the sleep-t6030.h and sleep-t6020.h includes and both match-table entries. sleep-test.c keeps both compatibles in its profile list. The merge's diff against main has the same added and removed lines as this branch's diff against its old base (21 files, +2472/−11).

Checks on the merge. Each one also ran on main for comparison: arm64, LLVM, warm tree on an x86_64 build host.

Check Merge b4038743451e main 536a613c0abe
make LLVM=1 ARCH=arm64 W=1 drivers/soc/apple/sleep.o drivers/soc/apple/pmp.o drivers/soc/apple/pmp-export.o drivers/soc/apple/pm_shim.o drivers/mfd/macsmc.o drivers/irqchip/irq-apple-aic.o drivers/gpu/drm/apple/dcp.o all 7 rebuilt, 0 warnings 0 warnings
The same sleep.o with KCFLAGS=-DCONFIG_APPLE_SOC_SLEEP_KUNIT_TEST=1. This compiles sleep-test.c, the other conflicted file; this config has KUNIT=m. 0 warnings; T6030 and T6020 both in the list 0 warnings
make dt_binding_check DT_SCHEMA_FILES=soc/apple/apple,t6020-sleep.yaml, then DT_SCHEMA_FILES=display/apple,t8140-display-power.yaml rc 0, 0 warnings each (the first yaml is new)
make CHECK_DTBS=y on all 8 T602x DTBs (t6020-j414s, -j416s, -j474s, t6021-j414c, -j416c, -j475c, t6022-j180d, -j475d) 411 schema lines, 0 dtc warnings 411 lines, 0 dtc warnings
tools/asahi/run-host-tests.py --only display26, then --only sep-suspend-errors 1/1 and 22/22 pass 1/1 and 22/22 pass

The CHECK_DTBS warnings are the same on both sides. The one difference is a phandle number in an existing t6022-j180d reset-gpios line (468 vs 470), because the merge adds nodes.

Second generation (code read on the merge): no row owed.

  • t602x-die0.dtsi and t602x-dieX.dtsi are included only by the T6020, T6021 and T6022 device trees. t6050-dieX.dtsi only mentions them in a comment.
  • Every shared hunk is behind an apple,t6020-* compatible:
    • AIC;
    • the PMP: pmp.rs, and the pmp-export.c stop in suspend_late, whose else branch is main's code unchanged;
    • DCP hw data and layouts.
  • Or it sits behind a profile field that only sleep-t6020.h sets: smc_settle_ms in macsmc.c, sep_dev_disable in pm_shim.c, commit_stops_cpus in sleep.c. T6030's profile and every other profile leave these at 0/false.

Same generation, no row covers it. T6021 and T6022 (M2 Max/Ultra) share those compatibles.

  • AIC's save and restore and the PMP's stop run only in a firmware sleep, and those SoCs have no sleep node.
  • The DCP stop stays off without appledrm.s2r_untested.
  • Two DCP changes do apply there by default on firmware 27: map_reg maps the register windows through the DART (map_reg_dart), and the external DCPs echo RTKit log counters (s2r_ext with the new apple,display-power).

Hardware. The exact-head J414s ship row in the body (M2 Pro, 16:05Z) ran on the pre-merge stack, head 38a2359dad3d. This merge only brings in main: no T6020 line changed.

Merge order: #4200, then #3998, then this PR. The audio fix (commit 12) depends on #4200.

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

@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: MERGE at b403874

Checked: The merge keeps both T6020 and T6030 includes, match entries and KUnit entries. The T6030 implementation is byte-identical to main and none of its profile fields opt into the new T6020 behavior. All 21 feature files preserve their blobs or the same added and removed lines against their respective main parents. The T6020 physical commit still requires explicit opt-in, and the two changed bindings pass dt-doc-validate. The exact SEP host C controls and all seven Rust cases passed. The J414s two-cycle receipt covers the preceding byte-equivalent feature stack. Land #4200 and #3998 first.

Follow-ups: Please split independently mergeable driver and DT changes into separate PRs where practical for changes of this size.

@sithglan sithglan 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: MERGE at b4038743451e04f60dba2364ce681c869d90378a (in the planned order #4200 -> #3998 -> #3999 once CI finishes green)

Blockers: none

Checked:

  • Verified the merge resolution b4038743451e onto main (536a613c0abe): cleanly retains both T6030 (#4067) and T6020 in drivers/soc/apple/sleep.c (include + match table) and drivers/soc/apple/sleep-test.c (profile list + expectations).
  • Reviewed all shared-driver hunks (dcp.c, irq-apple-aic.c, macsmc.c, pm_shim.c, pmp-export.c, pmp.rs, sleep.c): every behavior change is strictly scoped behind apple,t6020-* compatibles or T6020-only profile fields (smc_settle_ms, sep_dev_disable, commit_stops_cpus), leaving all other SoCs invariant.
  • Checked aurora-silicon-review approval at b4038743451e, apple-build/source/readiness/pr-text green, and the J414s 2/2 desktop deep-sleep row.

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

Approving at b403874. The review-lane App approval at this head covers the code review (merge resolution with #4067 keeps both T6020 and T6030 entries); this adds the code-owner approval the branch rules need.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review at b4038743451e: no blocking findings

I read the whole diff against current main (c43014f079f5, which now has #3998) and checked it against the hardware evidence.

Merge onto current main

  • merge-tree onto c43014f079f5 (base 536a613c0abe) is clean, tree 675342246b87; everything below ran on that tree. main has since moved to fcd7a7423d4b (#1851: mailbox.c, a T8152 DT, G18 boot). The merge onto it is still clean and differs from the checked tree only in those three files. Six files changed on both sides (t602x-die0.dtsi, dcp.c, pmp-export.c, sleep.c, sleep.h, display26-tests.py), and the hunks don't touch each other.
  • What main gained beyond the tree the J414s ran:
    • #3300 (DCP PMC interface) has no effect on T602x. No T602x node has apple,pmc-interface or a BWR/boost bit, so the lookup returns -ENODEV and dcp_s2r_domains_off/on() take the old path.
    • #4162's sleep.c hunk splits sleep_apcie_port_clock() without changing what it does.
    • #4060 (SEP enrolment) and #3524 (T6050 DT) don't touch this path.

Register layouts vs the device tree. The DCP layouts match t602x-pmgr.dtsi:

  • disp0 SYS/FE/CPU0 at 0x1b0/0x1d0/0x1d8 in pmgr_east (0x290280000)
  • dispext0 at 0x258/0x2c0/0x2d8 and dispext1 at 0x248/0x2b0/0x2b8 in pmgr (0x28e080000)
  • apple,dcp-index 1 and 2 select dcp_s2r_t6020_ext[0] and [1].

The T6020_PS* defines in sleep-t6020.h match the same file.

Local checks on the merge tree (arm64, LLVM, W=1, warm tree on an x86_64 host)

Check Result
sleep.o, pmp.o (Rust), pmp-export.o, pm_shim.o, macsmc.o, irq-apple-aic.o, dcp.o, and all of drivers/gpu/drm/apple/ (84 units, including #3300's DCP KUnit files) rc 0, 0 warnings
sleep.o with sleep-test.c compiled in (-DCONFIG_APPLE_SOC_SLEEP_KUNIT_TEST=1) 0 warnings; T6030 and T6020 both in the profile list
dt_binding_check of apple,t6020-sleep.yaml and apple,t8140-display-power.yaml rc 0 each
CHECK_DTBS=y on all 8 T602x DTBs rc 0, no dtc warnings. 350 schema lines, all older ones (sio, opp tables, gpu and dptx-phy compatibles); none mention the new nodes or properties
checkpatch.pl --strict on the 13 commits 0 errors (nits below)
Host tests, every tools/asahi family that reads a touched file afk-compact 11/11, apple-wdt 10/10, backlight-coldboot 2/2, dcp- 76/76, dcpaud 22/22, dcpext26 23/23, display26 1/1, neo-stability 11/11, sep-suspend 22/22, sio-engine 1/1, t6030-pmp-supplier 2/2, t6030-sleep 2/2, t8122-apcie 1/1, t8132-sleep 1/1. t6030-pmp-dt didn't run: the build host has no fdtget. It reads only T6030 device trees, which this PR doesn't touch, and passed in CI at this head.

Hardware: exact head. J414s boot b41e00af (7.3.0-j414s-pr3811+, receipt in #3811 (comment)):

  • Heads in the build: main 35bfbf3875a7, #3998 845b4ad4e079 (the head that merged), this PR's head b4038743451e, #4200 ae343b883fba and #3811 b8c8bb060a4b. Cmdline adds appledrm.s2r_untested=1, the default.
  • Sleep: full desktop, 2/2 committed deep sleeps (100 s + 30 s). Resumes 0 -> 1 -> 2, 194 of 252 AP pins put back, held, macOS-off and cluster words stuck 0.
  • Display: in the full dmesg, the internal DCP goes off and comes back with a 3024x1964 modeset and connected:1 after both wakes. dcpext0/1 restart.
  • GPU: in use throughout (2814 -> 3382 jobs, pending=0 at each sleep, firmware back in about 3.2 ms).
  • Audio and Wi-Fi: audio clean, Wi-Fi 3/3.
  • Faults: none from GPU, MMU or RTKit; no WARN or Oops.

The 38a2359dad3d row in the body has the same #3999 diff and adds dEQP smoke 8/8 and clpeak 5.6 TFLOPS before and after both wakes.

Non-blocking, for follow-ups

  1. The SEP wake poll always times out. After every wake the report reads sep 0x1000030f (-110) (J414s here, and J414c in the comments). t6020_sleep_wake() writes the SEP word back with the AUTO_ENABLE it had at the commit. Under AUTO_ENABLE the actual state reads 0, so the 500 ms poll with interrupts off times out on every wake: about 0.5 s of wake latency, and a -110 that looks like an error. Fix: skip the poll, or accept actual 0, when AUTO_ENABLE is set.

  2. The Risk text understates the defaults on firmware 27. appledrm.s2r_untested defaults to 1, so on T602x firmware 27.x the new layouts are on by default:

    • internal-panel DPMS off now stops the DCP firmware and lowers the display domains (dcp_dpms_power_cycles());
    • USB-C dcpext outputs take the ext-idle path on every suspend, s2idle included.

    J414s 27.2 hardware covers the power cycle: 4/4 sleep refused: firmware restarted as for DPMS: 0 in a capture boot on 05a4e717, plus both deep sleeps above. An s2idle cycle on J414s 27.2 would close the last gap. On 13.5 the internal DCP keeps hw.s2r off, and dcpext0/1 act only on a firmware suspend.

  3. #4200 should land next. Every passing row includes it, and without it a full-desktop deep sleep on J414s stalls (body table). T6020 deep sleep stays opt-in (apple_sleep.deep=1 and apple_sleep.untested_commit=1, existing parameters, as on T8112), so merging first changes nothing by default. The step toward shipping is a follow-up that qualifies the profile (drops .untested).

  4. Nits.

    • Commits 6 to 8 have unwrapped long lines in their messages.
    • apple_pmp_stop_late() checks the compatible in pmp-export.c. A flag in pmp.rs's HW_CFG_T6020 would keep that choice in match data.

@DjDeveloperr
DjDeveloperr merged commit 2eceb1f into main Dec 3, 2026
23 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/t6020-s2r-sleep branch December 3, 2026 17:59
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged as 2eceb1f24262 (main fcd7a7423d4b + head b4038743451e, merge commit). Its tree 263a1b8836c3 is the merge-tree result I checked against this tip. It differs from the tree the local checks in my review ran on (675342246b87, onto c43014f079f5) only in #1851's three files, none of which this PR touches.

Gates at merge:

  • Code-owner approval at the head: RyanTheTide, plus sithglan and the review App.
  • CI at the head: 15 passed, 7 skipped, 0 failed.
  • Exact-head J414s row: boot b41e00af, 2/2 deep sleeps.
  • Change requests: none open.

Follow-ups are in the review above: the SEP wake poll, the Risk wording for firmware 27, #4200 next, and qualifying the profile.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J414s 27.2 s2idle follow-up check (review 6175485736 item #2 — default appledrm.s2r_untested on, display stop/start path across internal panel + both external DCPs): PASS.

  • Target: J414s (Mac14,9, T6020, OS firmware 27.2, m1n1/boot.bin sha256 196da4c690882ac64a70932e2dbb5affa0828e533117c975633e1b6705a9bd38)
  • Kernel: 7.3.0-j414s-sepwake+ (90292a6e3345 = main 2eceb1f24262 + SEP wake-poll fix b9bff7416310 + #4200 ae343b883fba, Image sha256 f6fc5123ed564817f15264ffc15fd4374cfcde6ac3292b33a15b5a9f18038e6c)
  • Boot ID: c4ceb0f5-34b0-45db-8d31-b4320fdd20ae
  • Module parameter check: appledrm.s2r_untested omitted from /proc/cmdline; /sys/module/appledrm/parameters/s2r_untested read Y (compiled default active).
  • DCPs bound: 389c00000.dcp (internal panel eDP-1), 289c00000.dcp (external HDMI, no monitor attached), 315c00000.dcp (external DPTX, no monitor attached).
  • Cycle (rtcwake -d /dev/rtc0 -m freeze -s 15, mem_sleep=[s2idle] deep):
    • RTCWAKE_RC=0, suspend_stats: success=1 fail=0, PM: suspend devices took 0.686 seconds, PM: resume devices took 0.084 seconds.
    • 389c00000.dcp: brightness set to 0 on suspend; modeset 3024x1964 and brightness restored (7667712, apple-panel-bl actual=117/500, bl_power=0) on resume; card1-eDP-1 connected/enabled/On; kwin_wayland framebuffer 3024x1964 active.
    • Post-s2idle DPMS off/on via kscreen-doctor: dpms_during_off=Off bl_off=0 -> dpms_after_on=On bl_on=117 PASS dpms Off On.
    • External DCPs: 289c00000.dcp stayed idle across s2idle with zero errors; 315c00000.dcp initialized cleanly during suspend (RTKit: Initializing (protocol version 12)) and returned to runtime-PM idle 5 s post-wake (RTKit: idle, but not stopped: status 0x2d), zero errors/faults.
    • GPU (aurora 406400000.gpu): GPU held for sleep: submitted=3950 completed=3950 pending=0 -> GPU released after sleep: running=Ok(0) pending=0; 0 faults/WARNs.
    • Wi-Fi ping post-s2idle: 3/3 (0% packet loss).
    • Followed in the same boot by 2/2 committed deep sleeps (resumes 0 -> 1 -> 2), both clean.
  • Archive: work/j414s-sepwake-20261203/ (SHA256SUMS).

Follow-up #1 (T6020 SEP AUTO_ENABLE wake poll) is opened separately in $PR_URL.

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) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) blast:m2 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants