Skip to content

ASoC: apple: aop_audio: Accept devices still attached after a reload - #759

Closed
erikwb wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
erikwb:j713/aop-audio-reattach
Closed

erikwb wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
erikwb:j713/aop-audio-reattach

Conversation

@erikwb

@erikwb erikwb commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Goes with #760: this brings the cards back after a reload, but on the J713 the speakers stay silent unless the amp driver fix in #760 is applied as well. Rebinding the speaker card leaves two amps without their idle-slot force-0 enable, which corrupts two other amps' voltage sense words, and the protection daemon then holds the speakers at a safe level. With both changes, a reload gives working, governed speakers.

Reloading snd-soc-aop leaves the machine without audio until a reboot. This makes the probe accept a device that is still attached from the previous load.

What happens

The AOP firmware keeps a device attachment for as long as it runs, and the driver has no call to drop one at removal. On the next load, the probe attaches the microphone devices again (pdm0, hpai, lpai, and lilb where there's an HF decimator). The firmware answers kIOReturnBusy (0xe00002d5), the probe fails with "Unable to attach device", and every card the driver provides stays missing. With the T6040 flow that includes the speakers and the jack, which the same probe registers.

The speaker and jack services already treat that return as "attached" (Service::get in aop_spkr.rs). This does the same in the probe's audio_attach_device, with a debug message, and moves AUDIO_RET_BUSY into aop_audio.rs so aop_spkr shares it. aop_t8140 keeps its own copy, as it does for the rest of its protocol constants.

Testing (J713)

This was tested on a J713 kernel with #439's T8132 support, where the AOP audio node binds apple,t8132-aop-audio / apple,t6041-aop-audio and takes this probe.

  • Before: with the stock module, rmmod snd_soc_aop and then insmod fail the probe on the pdm0 attach, and there's no audio until a reboot.
  • After: five unload/reload cycles of snd-soc-aop (with snd-soc-macaudio), the last two with the final version of this commit. After each one:
    • the speaker card, the jack card and the microphone card are all back;
    • speaker and jack streams play;
    • the microphones record room noise at the same level as before (−65 to −69 dBFS, against −67.5 dBFS on the first load);
    • the speaker protection daemon comes back and governs;
    • the kernel log has nothing new apart from the taint line for the test module. In particular, the probe's property writes to the still attached devices aren't refused.
  • Checks:
    • checkpatch --strict is clean;
    • sound/soc/apple builds with W=1 and no warnings;
    • the branch builds Image, modules and dtbs on integration/aurora with no new warnings.

The AOP firmware keeps a device attachment for as long as it runs, and
the driver has no way to drop one at removal.  When the module is
loaded again, the probe's attach calls for the microphone devices get
kIOReturnBusy back and the probe fails.  The machine then has no audio
until it reboots: with the T6040 flow the speaker and jack streams are
registered by the same probe and are lost as well.

The speaker and jack services already treat that return as attached.
Do the same in the probe, and share the constant with aop_spkr.  The
probe's property writes that follow are accepted by the still attached
devices.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #820, where this is commit 18, unchanged.

@erikwb erikwb closed this Nov 1, 2026
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