Skip to content

soc: apple: sleep-t8122: lower newly enabled peripheral domains at sleep entry - #3834

Merged
satchlj merged 1 commit into
aurora-silicon:mainfrom
satchlj:fix/t8122-sleep-stray-domains
Dec 1, 2026
Merged

satchlj merged 1 commit into
aurora-silicon:mainfrom
satchlj:fix/t8122-sleep-stray-domains

Conversation

@satchlj

@satchlj satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member

Bisecting a T8122 (M3 MacBook Air 13", J613) deep-sleep regression showed that committed deep sleep (apple_sleep.deep=1 apple_sleep.untested_commit=1) passes with Aura 1.0.0b18-g34534c5f + pre-#3535 DTBs (boot object resumes 0 -> 1, wake NUB.SPMI0.SW3), and resets on Cycle 1 with 535e57a9 (#3535) DTBs.

With #3535 DTBs, pm_genpd_summary and sync_state() show ps_msr (0x428), ps_msr_ase_core (0x498), ps_scodec (0x420), ps_venc_sys (0x418), ps_aes (0x290), and ps_fpwm0 (0x218) left powered on at sleep entry due to unbound peripheral nodes (scaler0, apr, dart_ave2, aes, pwm0).

Changes

  • Add fpwm0 (0x218), i2c4 (0x250), aes (0x290), venc_me1/venc_me0/venc_pipe5/venc_pipe4/venc_dma/venc_sys (0x8020..0x8000, 0x418), scodec_stream/scodec (0x490, 0x420), and msr_ase_core/msr (0x498, 0x428) to t8122_stray[] in drivers/soc/apple/sleep-t8122.h, ordered child-before-parent so apple_sleep_lower_stray() lowers children first and apple_sleep_stray_restore() raises parents first on refusal or wake.
  • Touches only drivers/soc/apple/sleep-t8122.h and composes cleanly with #3413.

Tested: Untested on hardware yet (kernel build and J613 committed deep-sleep row on #3535 DTBs in progress; KUnit sleep-test and apple-build running in CI).

Risk: two-way · Only extends t8122_stray[] for domains already off on pre-#3535 DTBs (skipped when already off, no writes on dry runs), and reverts cleanly in one commit.

…eep entry

Commit 535e57a ("arm64: dts: apple: t8122: enable ADT-present peripherals and tunnel PIODMA") enabled scaler0, dart_scaler, apr, dart_apr0/1, dart_ave2/3, aes, pwm0, and i2c4 in the shared T8122 device trees. On systems where those peripheral nodes remain unbound, apple-pmgr-pwrstate leaves sync_state() pending so ps_msr, ps_msr_ase_core, ps_scodec, ps_venc_sys, ps_aes, and ps_fpwm0 stay powered on at deep-sleep entry, causing T8122 committed deep sleep to reset on Cycle 1.

Add those peripheral domains (and their subdomains in child-before-parent order) to t8122_stray[] so apple_sleep_lower_stray() powers them off when still on at sleep entry and apple_sleep_stray_restore() brings them back in reverse order on refusal or wake. Domains that are already off are untouched, and dry runs continue to perform no power writes.

Signed-off-by: Satya Benson <satya@benson.earth>

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

Review at 4fd44db (one round, no blockers):

  • All 13 new offsets match t8122-pmgr.dtsi on main (fpwm0 0x218, i2c4 0x250, aes 0x290, venc_me1/me0/pipe5/pipe4/dma 0x8020..0x8000, venc_sys 0x418, scodec_stream 0x490, scodec 0x420, msr_ase_core 0x498, msr 0x428), and all are in &pmgr, the same block as the existing entries.
  • The order is right against the DT parents: venc_me*/pipe* -> venc_dma -> venc_sys, scodec_stream -> scodec, msr_ase_core -> msr. Lowering walks children first and the reverse restore raises parents first.
  • Consumers: none of these is a wakeup path on J613/J615. i2c4 hosts only avellino@44 (no wakeup-source), and venc/scodec/msr are PMP report entries or disabled nodes. So lowering a domain that is still on after genpd's noirq pass shouldn't take a wake source with it.
  • Composes with #3413: no textual overlap (#3413 touches sleep.c/sleep.h and drm/apple). I'm building main + this + #3413 for a J615 row now.

Note for the J615 (27.2 firmware) row: committed deep is refused before the sleep controller there (G16 deep_sleep: false and, since 12-01, the DCPEXT no-firmware-stop refusal), so it can show composition and no regression but can't exercise the new stray lowering. The J613 cycle-1 row on #3535 DTBs is the one that proves the fix.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Row: 4fd44db (+ #3413 aed286b, on main c5772ac, main DTBs) + J615 (MacBook Air 15" M3, 27.2 firmware) + composes, no regression; the new lowering isn't reached on this Mac.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Row: 4fd44db (+ main 539585d incl. #3413 + #3504 2cc7c04) + J613 (MacBook Air 13" M3, T8122, 25G83 stub, stock Stage 2 carrying #3535 DTBs) + PASS 3/3 committed deep sleep (boot object resumes 0 -> 1 -> 2 -> 3)

  • Build & setup: main 539585d7 (includes merged #3413) + #3834 4fd44dbeec (unchanged, zero-conflict merge) + #3504 2cc7c04b (3 commits unchanged; required on T8122 so the GPU stops for deep sleep rather than returning -EBUSY in genpd_prepare). Stock Stage 2 boot.bin carrying #3535 DTBs (no Stage 2 DTB override). Volatile one-shot trial with apple_sleep.deep=1 apple_sleep.untested_commit=1.
  • Deep sleep (3 consecutive 12s RTC wakes via apple-pmu-rtc):
    • All 3 cycles committed and resumed cleanly in the same boot (boot object resumes 0 -> 1 -> 2 -> 3, wake source NUB.SPMI0.SW3, 0 resets, 0 failed units, 0 EDAC errors).
    • On every cycle, apple_sleep_lower_stray() detected and lowered the #3535-powered domains that were still on at the last step (aes 0x290 and scodec 0x420, alongside existing isp_sys and apcie_phy_sw):
      apple-sleep 2d0700000.sleep-controller: 6 coprocessors up and stopped
      apple-sleep 2d0700000.sleep-controller: isp_sys was on at the last step, lowered
      apple-sleep 2d0700000.sleep-controller: aes was on at the last step, lowered
      apple-sleep 2d0700000.sleep-controller: scodec was on at the last step, lowered
      apple-sleep 2d0700000.sleep-controller: apcie_phy_sw was on at the last step, lowered
      apple-sleep 2d0700000.sleep-controller: back from sleep, boot object resumes 0 -> 1
      
      Without #3834, this same stock #3535 Stage 2 reset on Cycle 1.
  • Post-wake subsystem checks (all 3 cycles):
    • Audio capture (48 kHz and 44.1 kHz, 4s each): rc=0 on cycles 0–3.
    • GPU / Borealis Vulkan (Apple M3 (G15G C0)): healthy=1, completed 211 → 2493 → 4729 → 7009; glmark2 997 / 975 / 995 / 1009 FPS.
    • Wi-Fi: connected after every wake.
  • Clean reboot back to default kernel afterwards. Marking ready for review.

@satchlj
satchlj marked this pull request as ready for review December 1, 2026 22:41
@satchlj
satchlj requested review from a team as code owners December 1, 2026 22:41
@satchlj
satchlj requested review from Acelogic and malik-na December 1, 2026 22:41
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at 4fd44dbe: ready to merge

Check Detail
CI at head ok 10 checks passed
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok comment at 4fd44dbe
Conflicts ok none
PR text ok Risk: two-way · Only extends t8122stray[] for domains already off on pre-#3535 DTBs (skipped when already off, no writes on dry runs), and reverts cleanly in one commit.

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

@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 4fd44db

Checked:

  • All 21 t8122_stray[] offsets match t8122-pmgr.dtsi at this head, and all are in &pmgr. That is the same s->ps block as the existing entries, and its reg size 0x14000 covers 0x8020. nstray = 21 is under the BITS_PER_LONG guard on stray_lowered.
  • Order against the DT parents: venc_me1 -> venc_me0 -> venc_dma, venc_pipe4/5 -> venc_dma, venc_dma -> venc_sys, scodec_stream -> scodec, msr_ase_core -> msr. Each child comes before its parent, so lowering goes children-first and apple_sleep_stray_restore() (reverse walk) raises parents first. Every DT child of venc_dma, venc_me0, scodec and msr is in the list.
  • Failure handling: a word that won't go off sets -EBUSY and restores every word lowered so far. Dry runs write nothing. Words that are already off are skipped.
  • Row at this head: J613 on #3535 DTBs, committed deep 3/3 (resumes 0 -> 3, 0 resets). On every cycle aes and scodec were lowered, which matches the claim. J615 row: composes, and the new path is not reached there.

Follow-ups (not blockers):

  • ps_sio_adma (0x310) is a DT child of fpwm0 and is not in the list. If sio_adma is still on at the last step, fpwm0 is lowered under it. The J613 row doesn't show this happening. Either add sio_adma ahead of fpwm0 or skip fpwm0 while sio_adma is on.
  • The PR body's "Tested: Untested on hardware yet" is out of date now that the J613/J615 rows exist.

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

Code-owner approval at 4fd44db. Checked: all 21 offsets are in &pmgr per t8122-pmgr.dtsi, children come before parents (venc, scodec, msr chains), a failed lowering refuses and restores, and dry runs write nothing. J613 row at head: committed deep 3/3 on #3535 DTBs, with aes and scodec lowered every cycle. Follow-up: ps_sio_adma (0x310) is a child of fpwm0 but isn't in the list. Add it ahead of fpwm0, or skip fpwm0 while sio_adma is on.

@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 1, 2026
@satchlj
satchlj merged commit 26b54b7 into aurora-silicon:main Dec 1, 2026
45 checks passed
DjDeveloperr pushed a commit to joshuaswarren/linux that referenced this pull request Dec 2, 2026
…eep entry

Linux aurora-silicon#3551 enabled the ADT-present T8103 peripherals. Several of them
have no driver yet (aes, jpeg0/1, ave_dma), so the PMGR provider's
sync_state() stays pending and ps_aes, ps_jpg and ps_venc_sys stay
powered. T8103 had no stray list, so nothing lowered them at sleep
entry, and J313 deep sleep stopped waking.

Add t8103_stray[] with aes, jpg and the venc chain, children before
parents, so apple_sleep_lower_stray() lowers them at the last step and
apple_sleep_stray_restore() raises them in reverse on refusal or wake.
fpwm0 is already lowered by t8103_cg_commit_off and dwi is always-on.
The nodes stay enabled.

This is the T8103 counterpart of the T8122 fix in aurora-silicon#3834.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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) 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.

2 participants