Repository navigation
soc: apple: sleep-t8122: lower newly enabled peripheral domains at sleep entry - #3834
Conversation
…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
left a comment
There was a problem hiding this comment.
Review at 4fd44db (one round, no blockers):
- All 13 new offsets match
t8122-pmgr.dtsion 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(nowakeup-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.
|
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.
|
|
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 (
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: MERGE at 4fd44db
Checked:
- All 21
t8122_stray[]offsets matcht8122-pmgr.dtsiat this head, and all are in&pmgr. That is the sames->psblock as the existing entries, and its reg size 0x14000 covers 0x8020. nstray = 21 is under theBITS_PER_LONGguard onstray_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 offpwm0and 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
left a comment
There was a problem hiding this comment.
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.
…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>
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 withAura 1.0.0b18-g34534c5f+ pre-#3535DTBs (boot object resumes 0 -> 1, wakeNUB.SPMI0.SW3), and resets on Cycle 1 with535e57a9(#3535) DTBs.With
#3535DTBs,pm_genpd_summaryandsync_state()showps_msr(0x428),ps_msr_ase_core(0x498),ps_scodec(0x420),ps_venc_sys(0x418),ps_aes(0x290), andps_fpwm0(0x218) left powered on at sleep entry due to unbound peripheral nodes (scaler0,apr,dart_ave2,aes,pwm0).Changes
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), andmsr_ase_core/msr(0x498,0x428) tot8122_stray[]indrivers/soc/apple/sleep-t8122.h, ordered child-before-parent soapple_sleep_lower_stray()lowers children first andapple_sleep_stray_restore()raises parents first on refusal or wake.drivers/soc/apple/sleep-t8122.hand composes cleanly with#3413.Tested: Untested on hardware yet (kernel build and J613 committed deep-sleep row on
#3535DTBs in progress; KUnitsleep-testandapple-buildrunning in CI).Risk: two-way · Only extends
t8122_stray[]for domains already off on pre-#3535DTBs (skipped when already off, no writes on dry runs), and reverts cleanly in one commit.