Repository navigation
ASoC: apple: macaudio: Open the tweeter HPF only while protection is granted - #949
Merged
Merged
Conversation
macaudio fixes the playback high-pass filter of every SN012776 tweeter amp at 800 Hz, a safety net from before any speaker protection ran in userspace. On machines where the protection runs in the PipeWire graph and measures each voice coil with a low-frequency pilot tone, that filter sits after the protection stage and removes the pilot from the tweeter outputs. The tweeters' V/I sense then never carries the pilot, so their closed-loop temperature never leaves its calibration value and only the open-loop model protects them. The woofers, filtered at 2 Hz, track as expected. The amp's sense-path DC blockers are separate and unchanged. On those machines the graph's crossover, which keeps program bass off the tweeters, comes before the protection stage, so the amp filter adds nothing to the tweeters' protection there but takes away their sense. Add a tweeter_hpf field to the platform match data, "800 Hz" when unset, and set it to the woofers' 2 Hz on the J413 and the J616s/J616c, both of which run the in-graph protection with a tweeter pilot. Every other machine keeps 800 Hz. The control stays fixed and read-only, and the speaker gate is unchanged: no amp plays unless the protection owner grants it. KUnit apple-speaker-hpf: woofers stay at 2 Hz, the default tweeter corner stays 800 Hz on every machine that does not set it, the two pilot machines get the woofer corner below the pilot, and no machine selects "Disabled". Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
Hardware check, M2 (J413), one-shot 7.3.0-aurora-sgv2k6h (#922 tip + this commit, same tree). SELinux enforcing, 0 AVCs.
|
…granted The previous change fixed the tweeter playback high-pass at the woofers' 2 Hz on the J413 and J616 for good. That opens the tweeters even when no protection engine owns the speakers, which is exactly when the 800 Hz filter is the only thing keeping program bass off them. Tie it to the grant instead. The tweeter corners become the driver's, like the speaker volumes: read-only to userspace, 800 Hz from the card's binding on, and set to the machine's granted corner (tweeter_hpf_granted) in macaudio_spk_grant(), before the amps go up to the operating gain. Every withdrawal (an explicit release, the owner's file closing, a new owner, the lease running out, system sleep) goes through macaudio_spk_floor(), which brings the amps to the safe level first and then restores 800 Hz. A corner that cannot be restored is a failed floor: speaker playback is refused until the driver reloads. A corner that cannot be opened fails the grant and floors. The machines that open the tweeters while granted are the J316, J413 and J616s/J616c, the boards whose protection engine runs the crossover ahead of its protection stage and a low-frequency pilot on every voice coil. Every other machine keeps 800 Hz throughout. KUnit apple-speaker-hpf, now 7 cases: a grant opens the tweeters, an explicit release, the owner going and a lease timeout restore 800 Hz, a refused renewal opens nothing, a failed restore is a failed floor, a failed open floors, other machines stay at 800 Hz, woofers stay at 2 Hz, and no machine ever selects "Disabled". Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
Rework (680711e): the tweeter playback high-pass now opens to the woofers' 2 Hz only while protection is granted, on J316, J413 and J616s/J616c. It opens in macaudio_spk_grant() before the amps go up. Every withdrawal goes through macaudio_spk_floor(), which sets the safe level and then puts 800 Hz back. A restore that fails is a failed floor. KUnit apple-speaker-hpf has 7 cases; apple-* passes 33/33. Hardware, one-shot 7.3.0-aurora-sgv2k6i (same tree as this branch), SELinux enforcing, 0 AVCs, all Amp Fault Status 0:
|
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.
On top of #922 (
sgv2-kernel-interface, 459c031).Problem. macaudio fixes every SN012776 tweeter amp's playback high-pass filter at 800 Hz. With speakerguardd v2, protection runs in the graph and measures each voice coil with a low-frequency pilot tone added inside the protection stage. The amp filter sits after that stage, so it removes the tweeter pilot. The tweeter V/I sense never carries it, and tweeter closed-loop temperature stays at its calibration value. Woofers, filtered at 2 Hz, track as expected.
Live v2 runs (J616s x2, M2 x1): while the pilot is enabled, tweeter pilot-bin V/I power is 25-37 dB below the woofers', and below the window acceptance thresholds.
Change. A
tweeter_hpffield in the platform match data. It defaults to "800 Hz" and is set to the woofers' 2 Hz on the J413 and J616s/J616c, the two machines that run in-graph protection with a tweeter pilot. On those machines the graph's crossover comes before the protection stage. Every other machine is unchanged. The control stays fixed and read-only, the sense-path DC blockers are untouched, and the speaker gate is unchanged: no amp plays without the owner's grant.Tests. KUnit
apple-speaker-hpf(4 cases). apple-* 30/30 on arm64 qemu (PROVE_LOCKING). Hardware results are in the comments below.🤖 Generated with Claude Code