Skip to content

dmaengine: apple-admac: T8132/T6041 split channel banks, no register access at probe, fail cyclic transfers on errors - #379

Merged
RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/admac-t6041
Oct 23, 2026
Merged

RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/admac-t6041

Conversation

@jgoyvaerts

Copy link
Copy Markdown
Contributor

The ADMACs behind the M4 Pro/Max (T6040/T6041) AOP, which carry the microphones and speakers on the MacBook Pro J616s.

  • Niklas Sheth: T8132 split TX/RX channel banks, ported onto integration/aurora (his original, GravityLinux/niklas-linux 3f7b289, does not apply here: aurora already has the T8140 channel layout and the 42-bit mask). He stays the author; the commit carries a [jg: …] note with what changed in the port and a Link: to his original.
  • Binding: apple,t6041-admac with the apple,t8132-admac fallback (t6041 like the other M4 Pro/Max blocks in dt-bindings: Apple M4 Pro/Max (T6040/T6041) compatibles #372).
  • Do not touch the registers at probe: the AOP's ADMACs are powered only once the AOP audio driver requests an audio power state. The one-time CTL write moves to the first channel allocation, and the T603x UNK_28/2C writes happen only after the slave config validates.
  • Fail a cyclic transfer on errors (DMA_ERROR from tx_status, stop the channel) instead of advancing over data that was never moved; prep_dma_cyclic refuses bad period/buffer sizes. Pairs with the pcm_dmaengine XRUN fix in Apple platform: small independent fixes (DART page tables, SMC, PWM, LEDs, SPMI, tipd, AVD, ALSA, tas2764) #368.

Hardware tested on: Apple MacBook Pro (16-inch, M4 Pro, 2024), J616s / T6040, booted by our own loader with our private T6040 device tree. The AOP microphones and the speakers stream through these ADMACs daily.

Not tested / limits: the error path was exercised only by forced faults during bring-up; other ADMAC SoCs were not tested (the cyclic error tracking acts on all of them). The AOP audio driver that uses this comes in a later PR.

Base: integration/aurora (6210b28, Linux 7.3). drivers/dma/apple-admac.o builds with W=1, no warnings. checkpatch --strict: our three commits are clean; Niklas's commit keeps his own message and trailers (long log line, Assisted-By spelling, binding and driver in one commit). Hardware testing was done on our daily tree (aurora-wip, Linux 7.1.12), which runs this code.

Credits: Niklas Sheth (T8132 split channel banks).

🤖 Generated with Claude Code

niklassheth and others added 4 commits October 21, 2026 19:14
Add the T8132 compatible and describe its separate TX/RX register banks while preserving logical channel numbering. Select the channel register base, SRAM layout, transfer configuration and 42-bit DMA mask for this variant.

Keep the existing register layout and configuration for earlier hardware.

Validation: the affected object builds with the development arm64 configuration; binding schema validation passed.

Assisted-By: OpenAI Codex (GPT-6 Astra)
Assisted-By: Claude Code (Claude Fable 5.1)
Signed-off-by: Niklas Sheth <[email protected]>
Link: niklassheth/linux@3f7b289
[jg: ported onto integration/aurora. The channel blocks use aurora's
 evolved (T8140) register layout, which places them where this patch
 did, and aurora already sets the 42-bit DMA mask for every variant;
 what remains is the T8132 compatible, the SRAM size mask, the reserved
 first SRAM block, the channel config/burst/enable writes and the
 global CTL write.]
Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
The ADMACs behind the M4 Pro/Max (T6040/T6041) AOP have the T8132
register layout.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
On the T6040 (M4 Pro) the ADMACs of the AOP audio paths sit in a power
domain that the AOP firmware manages. They are powered only once the
AOP audio driver has requested an audio power state, which it does
right before its first channel request; a register access before that
faults.

Move the one-time CTL write of the split-bank controllers from probe to
the first channel allocation, done once under the carveout allocation
lock before the first SRAM carveout access.

Write the T603x UNK_28/UNK_2C values only after the slave config has
been validated, so that a refused config touches no register.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
A channel error interrupt is cleared and logged, but the cyclic
transfer carries on as if nothing happened, and the completion path
turns whatever the report FIFO says into period callbacks. A stalled or
confused channel then shows up as a PCM that keeps advancing over data
that was never moved.

Track failures per transfer instead:
- prep_dma_cyclic refuses zero or non-dividing period lengths, buffers
  of 4 GiB or more (the residue is a u32) and a buffer that wraps the
  DMA address space;
- every descriptor written to the ring is counted, and a report for
  more periods than are outstanding, or a failed ring refill, marks the
  transfer failed and stops the channel;
- a channel error interrupt marks the running transfer failed and stops
  the channel;
- a failed transfer reports DMA_ERROR from tx_status (with the whole
  buffer as residue), resume refuses it with -EIO, and the tasklet stops
  invoking period callbacks once the transfer has failed or has been
  replaced.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
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.

3 participants