Skip to content

soc: apple: sleep: cover T6021 (M2 Max) in the T6020 profile and enable it on J414c - #4360

Merged
RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
muness:feat/t6021-s2r-sleep
Dec 5, 2026
Merged

RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
muness:feat/t6021-s2r-sleep

Conversation

@muness

@muness muness commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What: The T6020 (M2 Pro) deep-sleep profile now covers T6021 (M2 Max), and the J414c gets its sleep controller.

Refs #3336 (the T602x suspend-to-RAM tracking issue, where sleep.c was settled as the way it lands). Builds on #3999 (the T6020 profile) and #4200; the wake side is aurora-silicon/aura#663.

A T6021 node is a T6020 node with one more power-word block, ps-south. When the node has it, the commit also does what macOS 13.5 does on the Max and the wake undoes it:

  • the second display's cluster word goes down with the others;
  • the memory side's writes and the AMCC error enables cover eight controllers, not four;
  • the two extra IOAs' error enables are cleared while their bridges are powered;
  • the third and fourth external display's system, front-end and CPU words are lowered, and five words macOS zeroes there are zeroed.

Without ps-south every loop bound and table is what it was, so a T6020 node runs the same sequence as before. The J414c node is enabled with J414s's wake-source list and without apple,sleep-tested: deep sleep on it stays opt-in and stops before the commit unless that is asked for too.

Tested: J414c (MacBook Pro 14", M2 Max, T6021), firmware 13.5, Hyprland desktop, undocked. Aura main (2cf23900, which has aurora-silicon/aura#663) plus a test commit noting the wake's steps.

Main does not idle this machine's GPU for a firmware sleep on 13.5 (genpd_prepare returns -16), and its internal display coprocessor does not come back from the commit's cold halt on 13.5. So the sleeps below ran on this branch's head with those two stops carried on top, from JJRPF's work and this machine's daily kernel, plus a test commit that turns the profile's PMU step notes on: wip/t6021-s2r-test-stack-4. Nothing else was added.

Hardware row: ce0a6933b667 on J414c (MacBook Pro 14", M2 Max, T6021), firmware 13.5: dry run passes on the T6021 path, deep sleep and wake pass. Run as 775e64f4db4b, which is this head with the two 13.5 stops and the step-notes commit on top; of the files this PR changes only sleep-t6020.h differs there, by the notes. The commit before it, 56c609a8f91e, ran the rows below the same way (as 615c43b0753c).

Run Result
Dry run (apple_sleep.deep=1, no commit) every check passed
Deep sleep from the menu, woken from the keyboard, twice woke; resume count 0 → 2; all twelve cores up; both PCIe ports' links back; the PCIe endpoints left bound for the second
Deep sleep by closing the lid, 85 s, woken by opening it woke; resume count 2 → 3
Suspend-to-idle with the controller enabled (what a J414c does by default) suspends and resumes as before; no deep-sleep step taken
Headphone output after the three deep sleeps a 10 s tone plays in 10.1 s; no cs42l84 PLL lock error

No driver reported a failure after any wake. Before #3999 merged, the same four commits on its earlier heads went through ten more deep sleeps on this machine, including one switched to each of: no AIC mask between the commit words, IRQ/FIQ mode 0 on the boot core, PCIe endpoints left bound.

The profile selection, with t6020_map() and the ps-south block taken verbatim from the source and run against stubs:

Node Result
no ps-south, not a T6021's T6020's sequence: four memory controllers, five cluster words
ps-south named and mapped T6021's: eight and six
ps-south named, too short probe fails, -EINVAL
ps-south named, mapping fails probe fails, -ENOMEM
apple,t6021-sleep without ps-south probe fails, -EINVAL

Also: arm64 build with LLVM=1; checkpatch --strict clean on each commit; dt_binding_check on apple,t6020-sleep.yaml and CHECK_DTBS on t6021-j414c, t6021-j416c and t6020-j414s clean.

Risk: two-way.

  • T6020: the profile's code is shared. By construction a node without ps-south takes the old bounds and skips every new step; this was not run on T6020 hardware.
  • J414c on main today: only the default changes hands, and it was run (the suspend-to-idle row). Deep sleep stays behind the two opt-ins, and on 13.5 firmware main's GPU refuses it before anything is stopped, so an opt-in sleep fails clean and the machine stays up.
  • Other T6021 boards (J416c, J375c): the SoC node is added status = "disabled"; nothing changes until a board enables it.
  • The wake-source list is J414s's ADT numbers, used on J414c by the PSCI entry this machine runs daily and by every sleep above; it was not read back from the J414c's own ADT.

Not yet:

  • apple,sleep-tested on J414c. It needs a sleep that works on main alone: either a 13.5 path for the G14 GPU and the display coprocessors, or the Max on firmware 27.2, where neither stop is needed. The 27.2 GPU hand-off covers T6020 only so far.
  • The halt of an external display coprocessor left running (added for T6020's two) for T6021's third and fourth. On 13.5 they are stopped before the sleep, so it can't be exercised here; one earlier sleep with all four left running and only their words lowered did sleep and wake.
  • Docked. With a Thunderbolt dock and an external display the dry run is cancelled by the dock's own disconnect, apple-sio reports firmware did not come back from runtime suspend: -62 each time DisplayPort audio asks for it, and unplugging the dock froze the session. None of it is in this profile's path.
  • J416c and the Mac Studio.
  • After each wake, as on soc: apple: add T6020 (M2 Pro) suspend-to-RAM and DCP S2R power layouts #3999's earlier head: PS prores: resync after sleep failed: -5, 17 words back (3 left), and a key or lid wake sometimes reported as ATC0.USBWakeup.

T6021 (M2 Max) has T6020's sleep registers and one more PMGR power-word
block, which holds the words of the hardware the Max adds: its third and
fourth external display and the bridges of two more IOAs. Add its
compatible, with T6020's as the fallback, and the block as a sixteenth
range, "ps-south".

Signed-off-by: Muness Castle <931+muness@users.noreply.github.com>
T6021 is T6020's die-0 layout with more of the same blocks. When the
sleep controller's node names the Max's power-word block, "ps-south", the
commit also covers what macOS 13.5 does at its sleep entry on J414c:

 - the second display's complex goes down with the others;
 - memory controllers 4 to 7 take the memory side's writes to the fourth,
   and their error enables are off over the commit;
 - the error enables of IOAs 4 and 5 are cleared while their bridges are
   powered;
 - the third and fourth external display's system, front-end and CPU
   words are lowered, and five words are written zero.

The wake puts all of them back. A dry run reads the new power words and
reports them with the rest.

Nothing changes for a node without "ps-south".

Signed-off-by: Muness Castle <931+muness@users.noreply.github.com>
T6020's ranges and the Max's own power-word block. t6020.dtsi includes
this file and describes its own node over it, so T6020 boards keep theirs
unchanged. Disabled until a board enables it with its wake sources.

Signed-off-by: Muness Castle <931+muness@users.noreply.github.com>
With the wake sources the board sleeps and wakes with: AOP, NUB (the
PMU's RTC alarm), SMC, ATC and MTP.

Signed-off-by: Muness Castle <931+muness@users.noreply.github.com>
@muness
muness requested review from a team as code owners December 4, 2026 21:06
@muness
muness requested review from Acelogic and scottjones December 4, 2026 21:06
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m2 Macs affected, from Merge risk (bot) door:two-way Revertible or not, 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) labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at ce0a6933: ready to merge

Check Detail
CI at head ok 11 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at ce0a6933
Conflicts ok none
PR text ok Risk: two-way · . - T6020: the profile's code is shared. By construction a node without ps-south takes the old bounds and skips every new step; this was not run on T6020 hardware. - J414c on main today: only the default changes hands, and it was run (the suspend-to-idle row). Deep sleep stays behind the two opt-ins, and on 13.5 firmware main's GPU refuses it before anything is stopped, so an opt-in sleep fails clean and the machine stays up. - Other T6021 boards (J416c, J375c): the SoC node is added status = "disabled"; nothing changes until a board enables it. - The wake-source list is J414s's ADT numbers, used on J414c by the PSCI entry this machine runs daily and by every sleep above; it was not read back from the J414c's own ADT.

Areas: area:platform
Merge: gh pr merge 4360 --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.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 4, 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: REQUEST_CHANGES at 56c609a

Failure: A T6021 sleep node with a present ps-south range falls back to the T6020 sequence when that range cannot be mapped. I replayed the exact mapping helper and profile selection from sleep-t6020.h. A short named resource returned -EINVAL, and an injected mapping failure for the correctly sized resource returned -ENOMEM. Both selected four memory controllers and five cluster entries instead of failing the probe. t6020_sleep_map_regs() discards the error at lines 609–614 and continues. The real J414c DTB with a shortened ps-south range still passes the binding check, so the schema cannot catch the malformed-range case.

Please preserve the existing T6020 path when the range is absent and propagate the mapping error when a described ps-south fails. This prevents offering the T6020 commit sequence on an incompletely mapped T6021.

Checked: The binding document and submitted J414c, J416c and J414s DTBs passed the targeted schema checks. J414c has the 16 named resources and wake list, J416c stays disabled, and the T6020 J414s sleep resources and wake list match base. No local hardware run.

A node that names ps-south and has it too short, or whose mapping
fails, was taken for a T6020: four memory controllers, five cluster
words, none of the Max's steps. So was a T6021 node that doesn't name
it at all.

Only a node that neither names ps-south nor is a T6021's takes T6020's
sequence. One that should have the block and can't have it mapped fails
the probe with the mapping's error.

Signed-off-by: Muness Castle <931+muness@users.noreply.github.com>
@muness

muness commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in ce0a693.

• A node that neither names ps-south nor is a T6021's takes T6020's sequence, as before.
• A node that names ps-south and can't have it mapped fails the probe with the mapping's error: -EINVAL for a short range, -ENOMEM for a failed map.
• A node with apple,t6021-sleep and no ps-south also ran as a T6020. It fails the probe too, -EINVAL.

The Max's other mappings in t6020_sleep_map_regs() (the extra memory controllers, the two IOAs, the zeroed words) already returned their error.

Checked: t6020_map() and the selection block taken verbatim from the new source and run against stubs, five cases, results in the PR body. checkpatch --strict clean.

Hardware row: ce0a693 on J414c (MacBook Pro 14", M2 Max, T6021), firmware 13.5: dry run passes on the T6021 path, deep sleep and wake pass. Run as 775e64f, which is this head with the two 13.5 stops and the step-notes commit on top; of the files this PR changes only sleep-t6020.h differs there, by the notes.

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

Checked: Replayed the mapping helper and profile selection with GCC and Clang. A missing T6021 ps-south or a short named resource returns EINVAL, and a failed mapping returns ENOMEM. A legacy T6020 node still selects four controllers and five clusters. A successful ps-south mapping selects eight controllers and six clusters. The DTS and binding are unchanged from the previously checked revision.

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

Reviewed the T6021 south-bank correction at ce0a6933b667. The original T6020 setup keeps its existing loop bounds with no named south bank. T6021 rejects the missing bank, and a declared bank propagates the short range or mapping failure before the Max setup proceeds. I compiled the exact admission block with GCC and Clang and passed six cases with each, covering both successful profiles, a missing T6021 bank, short and unmappable banks, and capability selection by the named bank.

The updated J414c dry-run and deep-wake receipt covers the T6021 side. The T6020 shared-profile boot/wake control is the remaining hardware row.

@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 4, 2026
@RyanTheTide
RyanTheTide merged commit c5cb986 into aurora-silicon:main Dec 5, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform 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.

3 participants