Skip to content

ASoC: apple: aop_audio: leave out T6040 microphones the firmware did not set up - #2349

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
hack/aop-audio-a
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
hack/aop-audio-a

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the T6040 flow (apple,t6041-aop-audio: J614s, J616s) the AOP audio probe sends three microphone setup steps: the low-power microphone's channel masks (lpai property 300), the PDM configuration (property 200) and the high-frequency decimator configuration (property 212). Since 2ba1e89 ("ASoC: apple: aop_audio: configure the T6040 microphones as macOS does", Jonathan Goyvaerts) a refusal or a failed call of any of them is logged as ... refused, continuing (sound/soc/apple/aop_audio.rs:1239-1245 at 0abc2f3) and both microphone PCMs are registered anyway. The same PDM and decimator calls fail the probe on every other SoC this driver serves. The exception was made during bring-up so that each later step's answer could still be seen. It leaves a capture that starts on whatever configuration the firmware held, which records silence or garbage, and the only trace is a line from boot.

Change

Each refusal now costs only what that step configures:

  • Without the PDM or decimator setup, no microphone is offered. The probe registers only the speaker and jack streams the node lists, the same path a Mac without microphones already takes (moved into without_microphones()), and fails with the error when the node lists none.
  • Without the channel masks, the low-power microphone PCM is left out and the array stays.
  • Each failure is logged at error level with its return code. The channel-mask call used to log its answer only at debug level.

The order of the three calls does not change. If the firmware accepts all three, as the J616s firmware does in every capture we have, the probe behaves exactly as before. Other SoCs (T8103 to T6030, T8140) do not use this path and are not affected.

Testing

  • make O=... sound/soc/apple/aop_audio.o (arm64, LLVM, release config): builds with no warnings. Also built with CONFIG_KUNIT=y. The driver's KUnit cases are in aop_lpai/aop_t8140, which this change does not touch.
  • J616s captures from 11-10 and 11-12 (fleet58lp2, fleet61, fleet63) show both PCMs delivering real audio, with no lpai/aop error lines. That is consistent with all three steps being accepted today, so on that firmware the change does nothing.

Still to run

J616s (T6040), capture only, nothing kept:

  • dmesg | grep -iE 'snd_soc_apple_aop|lpai channel masks|microphone setup failed|refused, continuing'. Expected after the change: no microphone setup failed, no lpai channel masks not set, no Unable to set .... If one appears, the firmware refuses that step today, and the old kernel was hiding it.
  • arecord -l: card AppleJ616HPAI with PCM 0 hpai and PCM 1 lpai, the same as before.
  • arecord -D hw:AppleJ616HPAI,0 -f FLOAT_LE -r 48000 -c 3 -d 10 -t raw -vv | wc -c returns 5760000, and arecord -D hw:AppleJ616HPAI,1 -f S32_LE -r 16000 -c 3 -d 10 -t raw -vv | wc -c returns 1920000. The -vv peak meter should not show silence.
  • Speaker and jack: check only that the components still register (ls /sys/kernel/debug/asoc/components lists the J616s speaker and jack components). Nothing is played.
Hardware rows (combined test kernel, 2026-11-20)

This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:

  • kernel errors, failed units and SELinux denials;
  • microphone capture byte counts;
  • camera frame counts;
  • USB speeds;
  • panel brightness steps;
  • every retry/refusal message these drafts touch;
  • 2 s2idle cycles on M1 Pro, M2 and J616s.

M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.

This PR: J616s: 0 microphone-setup refusals on production and on the test kernel, so no change on a healthy boot. Mic capture byte counts identical before and after (J616s 1920000/5760000, M1 Pro and M2 960000/5760000).

Assisted-by: LLM (Claude:Opus 5.5)

…not set up

On the T6040 flow (apple,t6041-aop-audio: J614s, J616s) the probe sends
the low-power microphone's channel masks (lpai property 300), the PDM
configuration (property 200) and the high-frequency decimator
configuration (property 212), and on a refusal or a failed call logs
"... refused, continuing" and registers both microphone PCMs anyway. The
same PDM and decimator calls fail the probe on every other SoC this
driver serves. The T6040 exception was made during bring-up so that
each later step's answer could still be seen; it leaves a capture that
starts on whatever configuration the firmware held, silence or garbage
with nothing in the log at the time of the capture.

Make each refusal cost what it configures. Without the PDM or decimator
setup no microphone is offered: the probe registers only the speaker
and jack streams the node lists, as it does on a Mac without
microphones, and fails with the error when it lists none. Without the
channel masks the low-power microphone PCM is left out and the array
stays. Each failure is logged with its return code. A firmware that
accepts all three, as the J616s one does, sees no change.

Fixes: 2ba1e89 ("ASoC: apple: aop_audio: configure the T6040 microphones as macOS does")
Cc: Jonathan Goyvaerts <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

No blockers.

I checked the T6040 probe path at the head. A refused PDM or decimator step now goes to without_microphones() (sound/soc/apple/aop_audio.rs:1186), which is the same speaker/jack-only registration the no-"dma" path already used, and it fails with that step's error when the node lists no streams. A refused channel-mask step only drops the LPAI PCM (:1252-1279), and the array stays. On a firmware that accepts all three steps, the probe does the same thing as before. Other SoCs never take this branch. The commit has a human Signed-off-by and no agent trailers, CI is green and the branch merges cleanly. The combined-kernel row on the J616s shows 0 setup refusals and identical capture byte counts (1920000/5760000) before and after, and M1 Pro and M2 also matched production. That covers the only machine class where this path runs on a healthy boot. The PR can leave draft.

  1. Nit, aop_audio.rs:1247: this PR rewrote the comment but kept the vendor return-code name next to the value. The hex value is enough, so drop the name.

HW row: none required. Optional: the same capture row on a J614s, if an owner has one, since it shares apple,t6041-aop-audio.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 22, 2026 10:15
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Adversarial pass at 1a9583e: no blockers.

Checked: microphones are dropped only on the firmware's own answer (PDM/decimator refusal drops both, mask refusal drops only the LPAI PCM, aop_audio.rs:1250-1276), the speaker/jack registration is the same call on every exit (:1196, :1290) and no speaker code changes, and a firmware that accepts all three steps takes the old path.

  • Nit, aop_audio.rs:1239-1244 vs :1268: on a PDM/decimator refusal the PDM0/HPAI/LPAI devices stay attached with no PCM behind them. Fine if attach alone does not power anything; worth a word in the comment.
  • Nit, aop_audio.rs:699-703 and :1255-1259: one mask refusal now prints two error lines. Either log the return code in the probe or drop the inner line.
  • Earlier nit at :1247 (the return-code name next to the value) is still there.

Assisted-by: LLM (Claude:Opus 5.5)

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

Formal §1–§6 pre-PR review at 1a9583e603a29facc19bad64418ee765dc9a8687: APPROVED (0 blockers; live CI green).

Code, Locking, Memory & Lifetime Audit

  • SndSocAopDriver::without_microphones() cleanly factors out the speaker/jack-only registration path already used when "dma" is absent: if !streams it returns the setup error directly; otherwise it registers SpeakerComponent with card: null, lpai: None, and an unattached MicLid. Drop for SndSocAopDriver guards snd_card_free() on non-null self.card and safely detaches MicLid, so there are no leaks or invalid-pointer frees on error or unbind.
  • On info.t6040_flow: a refused/failed set_lpai_channel_control() now drops only the LPAI ring PCM while preserving the HPAI microphone array, and a refused/failed set_pdm_config() or set_decimator_config_hf() drops microphone registration via without_microphones() while preserving speaker/jack streams. A firmware accepting all three steps follows the exact previous path.
  • Not superseded on live integration/aurora (70a00e583b03; sound/soc/apple/aop_audio.rs unchanged since db5807513d7b), merges cleanly.

Pre-PR Checklist (§1–§6)

  • §1 No model gating: PASS — refusal handling is driven by firmware EPIC return codes (t6040_flow is pre-existing compatible-selected config).
  • §2 Production-ready: PASS — removes the bring-up "refused, continuing" fallback; works on default cmdline.
  • §3 Safety: PASS — speaker/jack components remain untouched; unconfigured microphone PCMs are withheld instead of exposing undefined firmware state.
  • §4 Clean-room & attribution: PASS — commit 1a9583e603a2 carries human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by: only (zero AI commit trailers); PR body ends with Assisted-by:.
  • §5 Evidence: PASS — exact commit 1a9583e603a2 was booted on affected hardware (J616s apple,t6041-aop-audio) plus M1 Pro J316s and M2 J413 in the 2026-11-20 combined test kernel, confirming 0 setup refusals, identical capture byte counts (1920000/5760000 on J616s, 960000/5760000 on M1 Pro/M2), 2 s2idle cycles, and matching production on kernel errors, failed units, and SELinux denials; arm64 LLVM release and KUnit builds warning-free.
  • §6 Naming & Live CI: PASS — host-tests (the only workflow triggered for sound/soc/apple/aop_audio.rs) is SUCCESS.

Non-blocking Nits

  • set_lpai_channel_control() logs dev_err! on ret != 0 and probe() logs a second dev_err! in .inspect_err(...) on the same failure.
  • The reflowed comment at sound/soc/apple/aop_audio.rs:1247 retains the pre-existing kIOReturnNotWritable name alongside 0xE00002CF; hex alone is cleaner if touched again.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 66c17a6 into integration/aurora Nov 23, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the hack/aop-audio-a branch November 27, 2026 13:21
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.

2 participants