Skip to content

ASoC: apple: t8140-aop-audio: wait for the first lpai report on a completion - #2404

Closed
RyanTheTide wants to merge 1 commit into
mainfrom
sweep/delays-soc-aop
Closed

RyanTheTide wants to merge 1 commit into
mainfrom
sweep/delays-soc-aop

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

sound/soc/apple/aop_t8140.rs:867 (07084c3): before a leaf power request, the driver runs the low-power microphone to raise the audio fabric. It then polls a flag every 5 ms, up to 100 times, until the first report shows the fabric is up. That report is a firmware message the driver already handles.

Change

The report path signals a Completion on the first report after a run request, and the raise waits on it with the same 500 ms timeout. If the report has already arrived, the raise returns at once. A raise that receives the completion hands it on to any raise waiting beside it, and the next run request drops any token left over. This is T8140 only, because the file is the T8140 backend.

Testing

  • make sound/soc/apple/aop_audio.o (Rust, release config): builds, no warnings.

Still to run

  • Neo (T8140 J700): play on the speakers and record from the internal mic and the jack, three times each, from a cold start of each service. dmesg must show no lpai: no report while raising the fabric and no PMGR leaf timeout. The audio must start no later than before.
  • Neo: repeat after s2idle three times (rtcwake -d rtc0 -m freeze -s 20).

…pletion

Before a leaf power request, the low-power microphone is run to raise
the audio fabric, and its first report proves the fabric is up. The
driver waited for that report by polling a flag every 5 ms, 100 times.

The report is a firmware message the driver handles. Complete a
completion from the report path on the first report after a run
request, and wait on it for the same 500 ms. A raise that finds the
report already in returns at once; one that gets the completion hands
it on to a raise waiting beside it, and the next run request drops any
left over.

Fixes: 07084c3 ("ASoC: apple: t8140-aop-audio: raise the fabric before every leaf request")
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Looks good; approve once the Neo audio rows below are on 42acd38.

I checked the handoff. sound/soc/apple/aop_t8140.rs:1189 completes only on the first report, through reported.xchg. sound/soc/apple/aop_t8140.rs:741 drains a leftover token under lpai_run, before runn. sound/soc/apple/aop_t8140.rs:871-877 waits only when no report is in yet, so a report that lands between the load and the wait still returns at once. Concurrent raisers pass the token on, and the next run request drops the one token left over. A late report from the previous run that races the drain sets reported, so the raise skips the wait. The polled code behaved the same way. The timeout, the warning and the wait budget (500 ms, uninterruptible) are unchanged, and the commit is clean.

  1. CI ran only host-tests on this head; rust-build and kunit did not run. Because the file is Rust, the only build proof is the local make sound/soc/apple/aop_audio.o. Please run the Rust build job, or post that build at 42acd38 with the config used.

HW row: Neo J700, on a fleet kernel plus this head, default command line. Run speaker playback (through speakerguardd v2), internal mic capture and jack capture three times each from a cold start of each service, then three times again after rtcwake -d rtc0 -m freeze -s 20. Pass criteria: no lpai: no report while raising the fabric, no PMGR leaf timeout, audio start latency no worse than the base kernel's, 0 AVC, 0 failed units, no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The fabric raise in aop_t8140.rs still polls every 5 ms up to 100 times on integration/aurora (4a17f73); the file has not changed since this branch was cut and the change applies cleanly. The Completion calls it uses (try_wait_for_completion, wait_for_completion_timeout) are present on the tip. Before it can leave draft it needs the Rust build job (or a posted build of sound/soc/apple/ at this head) and the Neo J700 rows from the review: speaker, internal mic and jack three times each from a cold start and again after three s2idle cycles, with no lpai: no report while raising the fabric and no PMGR leaf timeout.

RyanTheTide added a commit that referenced this pull request Nov 25, 2026
…rst lpai report on a completion

Folds #2404 into this PR unchanged.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Folded into #2350, which now carries this PR's commits unchanged (merge commit); review continues there.

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