Repository navigation
ASoC: macaudio: open the tweeter high-pass only for an engine that runs the Mac's crossover - #993
Merged
Conversation
On J316, J413 and J616 a protection grant opens every tweeter amp's playback high-pass from the 800 Hz safe corner to the amp's DT corner. That is right only when the engine ahead of the amps already splits the band the way the machine does: the tweeters then see no low-frequency content but the engine's own thermal pilot. An engine without that crossover would drive the full band into the tweeters with nothing in the way. Make the grant fail closed. Add "Speaker Protection Crossover", a boolean card control on which the owner of "Speaker Protection" declares that its engine passes every speaker channel through the machine's own crossover and high-pass ahead of the amps. A grant opens the tweeter high-pass only while that declaration is 1; otherwise the tweeters stay at the safe corner for the whole grant and the woofers are unchanged. The control is the owner's alone. Locking it needs CAP_SYS_ADMIN and ownership of "Speaker Protection"; a write needs CAP_SYS_ADMIN and that lock held by the owning file (-EPERM otherwise). A grant latches the declaration: a write while granted fails with -EBUSY. The declaration goes back to 0 when the owner unlocks "Speaker Protection" or closes its file, and when a new owner takes it. A lease that runs out keeps it, as the owner is the same; the floor still restores the safe corner. The control is appended after the existing card controls, so no control is renumbered. Machines that never open the tweeter high-pass ignore it. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
M2 (J413) hardware check, 2026-11-06, test kernel 7.3.0-aurora-sgv2xo1 (sgv2-kernel-interface + linux #990 + #993) with speakerguardd #70 + #67:
|
RyanTheTide
changed the base branch from
fix/sgv2-dcblocker-sense
to
sgv2-kernel-interface
November 5, 2026 15:06
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.
Stacks on #990. Retarget to
sgv2-kernel-interfaceonce #990 merges.What
On J316, J413 and J616 a protection grant opens every tweeter amp's playback high-pass from the 800 Hz safe corner to the amp's DT corner. That is only safe when the engine ahead of the amps runs the Mac's own crossover, so the tweeters never see full-band low-frequency content. An engine without it (an older speakerguardd v2, or any other owner) would drive the tweeters far harder at low frequencies than macOS does.
This makes the grant fail closed. The owner now has to declare the crossover before a grant can open the tweeter high-pass. Without the declaration the tweeters stay at 800 Hz for the whole grant. Woofers are unchanged. Machines without
tweeter_hpf_grantedignore the declaration.ABI:
Speaker Protection CrossoverSNDRV_CTL_IOCTL_ELEM_LOCK): needs CAP_SYS_ADMIN, and the file must already ownSpeaker Protection. Otherwise-EPERM.Speaker Protection. Otherwise-EPERM. Values other than 0 or 1 get-EINVAL.-EBUSY. The grant latches the declaration. To change it, release (write 0 toSpeaker Protection), write the declaration, then grant again.Speaker Protection, closes its file, or a new owner takes the lock. A lease that runs out keeps it, since the owner is the same. The floor still puts the tweeters back at 800 Hz.No crossover declared: tweeter high-pass stays at the safe corneron machines that would otherwise open it.Order for an owner: lock
Speaker Protection, lockSpeaker Protection Crossover, write 1 to it, then write the lease. The existing ordering is unchanged: on a grant the high-pass is set before the gain, and a withdrawal stops the streams, sets the safe gain and then the safe high-pass.Tests
-EBUSY) and takes effect on the next one; it is refused without ownership, without the lock, on another file's lock, and without CAP_SYS_ADMIN (-EPERM); it survives a lapsed lease and is cleared on unlock/close and by a new owner. The existing tests that open the tweeters now declare the crossover first. One earlier run, made while a full kernel build was loading the box, missed two timing-sensitive lease tests (lease_expires,timer_beats_a_fifo_spinner). The rerun passed both.tools/testing/selftests/alsa/macaudio-fixed-controls.py: 660 attempts per input-validation setting, 0 failures.checkpatch.pl --strict: clean.sound/soc/apple/andsound/soc/codecs/tas2764.o: no warnings.7.3.0-aurora-sgv2xo1. Boot qualification pending.🤖 Generated with Claude Code