Repository navigation
ASoC: apple: macaudio: add a fixed speaker ceiling for machines without sense - #1884
Merged
DjDeveloperr merged 1 commit intoNov 14, 2026
Conversation
…ut sense
Speaker protection on the SN012776 Macs needs the amps' voltage and
current sense: speakersafetyd governs the volumes from it under "Speaker
Volume Unlock", and the volumes sit at the lock's floor without it. A
machine whose sense never reaches the AP can have neither, so its
speakers stay off.
Add spk_fixed_ceiling for such a machine. Its SN012776 volumes are
limited to safe_vol in every state: under the lock, after an unlock and
under "Speaker Protection". It gets no sense PCM.
Under a granted lease the amps run at a fixed operating gain, and all
attenuation is the engine's. With the ceiling that gain is safe_vol, not
0 dB: 0 dB is above the volumes' limit, so the grant's write would fail
and floor the speakers ("operating gain not set"). The withdrawal ramp
starts below the ceiling for the same reason.
No machine sets it yet, so nothing changes on any current machine.
The new KUnit case runs a J316 profile with a -15 dB ceiling: the
volumes' limit after an unlock is the ceiling, a grant sets the amps to
it, and a release ramps them down from below it to the floor. Without
the operating gain and ramp changes, the grant and the ramp write above
the ceiling and the case fails.
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
DjDeveloperr
approved these changes
Nov 14, 2026
DjDeveloperr
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the mechanism alone, as asked on #1862. No board config sets spk_fixed_ceiling, and every hunk is behind that flag, so nothing changes on any current machine.
With the flag set:
- The SN012776 limit is
SN012776_DB(safe_vol)whether locked, unlocked or granted, and there is no sense PCM. - A grant's operating gain is the ceiling, so the lease no longer drops to the floor ("operating gain not set"). That was the note on #1862.
- The withdrawal ramp starts below the ceiling.
The new KUnit case covers both fixes and fails without them.
An optional hardening for later: refuse spk_fixed_ceiling with safe_vol >= 0 at probe. Then a misconfigured board fails closed instead of getting a 0 dB ceiling.
host-tests is green on this head. Base drift doesn't touch macaudio.c or the test header. Approving and merging. #1862 (the J873 enablement) still waits for the owner's sign-off on the level.
DjDeveloperr
merged commit Nov 14, 2026
9777df3
into
aurora-silicon:integration/aurora
1 check passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #1862 as @DjDeveloperr asked: this is the mechanism alone. No machine config sets it, so nothing changes on any current machine. #1862 now enables it on the J873 and is stacked on this one.
spk_fixed_ceilingis for a machine where the amps' voltage and current sense never reach the AP, so no protection daemon can govern its speakers. Its SN012776 volumes are limited tosafe_volin every state: under the lock, after an unlock and under "Speaker Protection". It gets no sense PCM.Changes since #1862
The review found that under a granted lease,
macaudio_spk_gain(ma, true)still returnedSN012776_0DB. That is above the volumes' newplatform_max, so the put failed with -EINVAL and the grant dropped to the floor ("operating gain not set"). Now:safe_vol, and the engine attenuates below that, as on the other machines.Testing
macaudio_spk_fixed_ceilingcase runs a J316 profile with a -15 dB ceiling. An unlock leaves the limit at the ceiling, a grant sets the amps to it, and a release ramps them down from below it to the floor. With the gain and ramp changes reverted, the case fails twice: the grant writes 201 where 171 is expected, and the ramp starts at or above the ceiling.macaudio.obuilds with W=1 and no warnings (LLVM 22), and checkpatch is clean.