Skip to content

soc: apple: sleep: power the AVE complex as the encoders' parent domain - #1663

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
neovenc/ave-complex-genpd
Nov 12, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
neovenc/ave-complex-genpd

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

On a T8140 with a video encoder enabled, the first wake from suspend-to-RAM resets the SoC. On the J700 that's every unit whose bootloader enables encoder 0 from the ADT (aura with #167).

The encoders' power domains sit behind the AVE complex, the word at +0x8 in the sleep controller's cluster block. With the complex off, VENC0_SYS refuses its target. With VENC0_SYS on, the complex doesn't go off, and the PMC's encoder cluster vote behaves the same way. .prepare turns the complex off and the wake leaves it off. In the noirq resume genpd then raises VENC0_SYS for the encoder's DARTs, ignores the failed power-on, and apple-dart restores the DARTs in an unpowered block, so the kernel panics and the SoC resets. A runtime check without any sleep shows the first part: with the complex off, a runtime resume of the encoder DARTs logs PS venc0_sys: Failed to reach power state 0xf.

The sleep driver now registers the complex as an IRQ-safe genpd domain and makes the enabled VENC0_SYS/VENC1_SYS domains and the PMC encoder cluster vote its subdomains. genpd raises it before them and lowers it after them. It is off at boot and after each wake, and on only while an encoder is in use. That's the order macOS uses: a macOS trace of the complex word shows it raised before the encoder's power states and dropped after them. Lowering waits for the encoder domains' BUSY bit to clear, and raising waits out a lower still in progress. With no encoder enabled nothing changes, and no device tree change is needed.

Tested on a J700 (encoder 0), production Stage 2 with a trial DTB, PMU RTC wake, kernel = integration af1bb44 + this commit:

  • Encoder 0 enabled, deep: 20/20 sleeps (22 wakes on that boot). Wi-Fi, NVMe, eDP, input, USB and fprintd back on every cycle; 0 kernel errors or warnings, 0 AVCs, no deep-path fallback. After every wake an H.264 and an HEVC encode of 300 1080p frames are byte-identical to the encodes before the first sleep.
  • Encoder 0 enabled, 8 rounds of back-to-back short encodes before a sleep and after each of two wakes: 0 failures, 0 complex or PMC errors.
  • Encoder 0 enabled, s2idle: 5/5 with encodes.
  • Encoder 0 disabled (DT as merged): 5/5 deep sleeps, no complex domain registered.
  • Without this change, encoder 0 enabled: reset at the first wake, 4/4.
  • Host tests 286/286, DCP 88/88, checkpatch clean.

Thanks to Diljit Singh for the macOS trace of the complex word that confirmed the order.

🤖 Generated with Claude Code

On a T8140 with a video encoder enabled, the first wake from
suspend-to-RAM resets the SoC. On the J700 that's every unit whose
bootloader enables encoder 0 from the ADT.

The encoders' power domains sit behind the AVE complex, the word at +0x8
in the sleep controller's cluster block. With the complex off, VENC0_SYS
refuses its target. With VENC0_SYS on, the complex doesn't go off. The
PMC's encoder cluster vote (VENC-CLSTR-V) behaves the same way: raised
with the complex off, the complex's next power-up never completes, and
with the complex off first the vote doesn't drop.

.prepare turns the complex off, and the wake leaves it off. In the noirq
resume genpd then raises VENC0_SYS for the encoder's DARTs, ignores the
failed power-on as it does in that phase, and apple-dart restores the
DARTs in an unpowered block. The kernel panics and the SoC resets.

Register the complex as an IRQ-safe genpd domain, and make the enabled
VENC0_SYS and VENC1_SYS domains and the PMC's encoder cluster vote its
subdomains. genpd then raises the complex before any of them and lowers
it after all of them: off at boot and after each wake, and on only while
an encoder is in use. That's the order macOS uses; a trace of the
complex word under macOS shows it raised before the encoder's power
states and dropped after them. Lowering it waits for the encoder domains'
BUSY bit to clear, and raising it waits out a lower still in progress.

With no encoder enabled nothing changes: .prepare still turns the complex
off. No device tree change is needed.

Fixes: d9b438c ("arm64: apple: support coordinated suspend-to-RAM on T8140")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 9219565 into integration/aurora Nov 12, 2026
7 checks passed
@RyanTheTide
RyanTheTide deleted the neovenc/ave-complex-genpd branch November 12, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant