Repository navigation
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks for the ADT comparison and the careful write-up. The mechanism itself looks right to me: spk_fixed_ceiling keeps the SN012776 volumes under safe_vol in the locked, unlocked and leased states, with no sense PCM. The -15 dB arithmetic also checks out: 8.41 Vrms at full scale is 15.4 W into 4.6 Ω, and -15 dB brings that to about 0.49 W.
I can't merge it as it stands, though, because of this tree's speaker-safety rule. A change may keep a speaker's limits or lower them. Anything that raises one needs explicit sign-off from the project owner and a speaker-safety qualification first, and speaker tests aren't part of review. Here the J873 speaker goes from not admitted (enable_speakers = false, safe_vol = 0) to admitted at a -15 dB ceiling with no closed-loop protection.
Could you split it into two?
- The mechanism alone: the
spk_fixed_ceilingflag and its handling, with no board config setting it, so it changes nothing on any current machine. I'm happy to review that for merge on its own. - Enabling J873:
enable_speakers = true,safe_vol = -15,spk_fixed_ceiling = trueand the KUnit expectation. This waits for the owner's sign-off on the level. It would help to include the thermal side: a continuous full-scale signal at 0.49 W against a 0.94 W rating has no thermal model behind it. The PipeWire high-pass/limiter chain the description mentions would also belong with it.
One technical note on the mechanism. As far as I can tell, with spk_fixed_ceiling set, macaudio_spk_gain(ma, true) still returns SN012776_0DB, which is above the new platform_max. The volume control's put then fails with -EINVAL (soc_mixer_valid_ctl()), and a "Speaker Protection" grant drops straight to the floor with "operating gain not set". That fails safe, but the log reads like a fault. It would be clearer either to return the ceiling there or to refuse the lease explicitly on fixed-ceiling machines.
88adb1a to
66e221d
Compare
|
@DjDeveloperr thanks. I split it as you suggested:
You were right about the lease. Our hardware run switched the interface to the lease and back but never granted one, so it missed the bug. In #1884 a fixed-ceiling machine's operating gain is its ceiling: a grant now runs the amps at The thermal side is in the description and in the commit message. The J873 ADT has no thermal data, so it uses speakersafetyd's Mac mini (J274) model:
The PipeWire high-pass and limiter chain isn't in here yet. |
|
Status from the contributor PR sweep: #1884 (the mechanism) is merged. This PR raises the J873 speaker from not admitted to admitted at a -15 dB fixed ceiling, with no closed-loop protection. Under the tree's speaker-safety rule that needs the project owner's explicit sign-off on the level, as the review said, so it stays open and isn't merged here. Once you rebase it on |
66e221d to
d543077
Compare
The J873 speaker cannot be protected the way the other SN012776 Macs are. The AOP firmware runs its speaker stream, and that stream has no receive side: the ADT's iop-audio-controller/audio-speaker descriptor has no RX slots, where J813's has eight 16-bit ones. The amp's voltage and current sense therefore never reach the AP. The ADT also marks the amp with speaker-protection = 0, so macOS runs no closed-loop protection on the Mac mini either. Without sense, no protection daemon can govern the speaker, so it has stayed off. Admit it under spk_fixed_ceiling at -16 dB. At the amp level its ADT gives (15, 18.5 dBV), full scale is 11.9 V peak. Into the 4.6 ohms of speakersafetyd's Mac mini (J274) speaker model, the worst signal, a full-scale square wave, is 30.8 W; a full-scale sine is half that. At -16 dB they are 0.77 W and 0.39 W. The J873 ADT carries no thermal data for its speaker, so the thermal side comes from that model: thermal resistances of 40 K/W (coil) and 60 K/W (magnet), time constants of 3.7 s and 250 s, a 46 C ambient and a 140 C coil limit, which a continuous 0.94 W reaches. A continuous full-scale square wave at the ceiling settles the coil at 46 + 0.77 * 100 = 123 C, within 5% of that after about 12 minutes (three magnet time constants): 17 C below the limit. A full-scale sine settles at 85 C. At its limit speakersafetyd cuts a speaker of that model to its floor gain, -15.2 dB at this amp level, which holds a square wave at 0.94 W. The ceiling sits 0.8 dB below that floor. The speaker still needs its apple,speaker-config from the boot loader, as on the other SN012776 machines. Tested on the J873g (M6) with the integration kernel and a DT carrying the ADT's amp properties, at -15 dB: - the speaker is admitted, and there is no Speaker Sense PCM; - "Speaker Volume" tops out at 171 (-15 dB) at bind, and a write of 201 (0 dB) is clamped; - with the "Speaker Protection Interface" on the lease, a grant puts "Speaker Volume" at 171 and a quiet tone plays under 52 renewals; a withdrawal puts it at 0; - a 200 Hz tone on the speaker PCM powers the amp (DAPM OUT on), and speaker_starts_refused stays 0. At -16 dB, with this macaudio on the M6's integration kernel: the limit is 169, a write of 201 is clamped to it, and a grant puts the volume at 169 while the tone plays (51 renewals). The apple-speaker KUnit suites pass with the J873 admission expectation changed (arm64, QEMU: 60 tests). Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
d543077 to
d032b1a
Compare
|
@DjDeveloperr this is rebased on integration/aurora, so only the J873 commit is left. Since my last reply there are three changes: 1. A correction to my thermal reply, and a lower ceiling. I worked the thermal case for a full-scale sine. The worst signal is a full-scale square wave, which has twice the power. At -15 dB that is 0.97 W, and the J274 model settles the coil near 143 °C, over its 140 °C limit. So the PR now proposes -16 dB:
The kernel ceiling alone keeps the worst case 17 °C under the limit. speakersafetyd's own floor for that model is -15.2 dB, the gain that holds a square wave at the limit, and -16 dB is 0.8 dB below it. The description and the commit message are updated. The level still waits for the owner's sign-off. 2. The PipeWire high-pass and limiter chain is aurora-silicon/asahi-audio#28. It's a mono downmix, then a 4th-order Butterworth high-pass at 100 Hz, then the LSP true-peak limiter at -1 dBFS. There is no J873 speaker data, so the high-pass corner is chosen so that, at every frequency below 100 Hz, it drives the speaker less than the J274 graph drives the M1 Mac mini's. Measured on the M6 from the graph's output, with the amp muted:
3. The lease now passes on hardware. With "Speaker Protection Interface" on the lease:
The apple-speaker KUnit suites pass at -16 dB (60 tests). |
The J873's speaker has no V/I sense: the AOP speaker stream has no receive side, so neither speakersafetyd nor speakerguardd can run. aurora-silicon/linux#1862 proposes to admit it under a fixed -16 dB kernel ceiling instead, and its review asked for the userspace part to go with it. firs/j873/graph.json downmixes the stereo sink to the mono speaker PCM (L/2 + R/2). A 4th-order Butterworth high-pass at 100 Hz (two biquads) follows, then the LSP true-peak limiter at -1 dBFS that ends the other graphs. There is no measurement of this speaker, so there is no FIR, no bass extension and no loudness compensation. Below 100 Hz the high-pass drives the speaker less, at every frequency, than the J274 graph drives the M1 Mac mini's speaker. The limiter catches the high-pass's overshoot on full-scale input, and a sink volume above 100 %, since the volume is a software gain ahead of the graph. The rule matches hw:AppleJ873,1. There is no J873 UCM profile yet, so README.J873.md shows the PipeWire object that stands in for the raw node until there is one. The Makefile installs j873. Tested on the J873g with that object, the rule and the graph installed: - WirePlumber builds the filter sink, hides the raw node and makes the filter the default sink. - Recorded from the graph's output with the amp muted, for full-scale input: 30, 50, 70 and 100 Hz come out at -41.8, -24.1, -12.6 and -3.0 dB, matching the Butterworth response. 150 Hz to 5 kHz sines peak at -1.00 dBFS, a 200 Hz square wave at -1.25 dBFS. One channel alone comes out at -6.0 dB. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Rebased on integration/aurora, which has #1884 (the
spk_fixed_ceilingmechanism, split out of this PR) merged. Only the J873 commit is left. Per the speaker-safety rule this waits for the project owner's sign-off on the level.The J873 (Mac mini M6) speaker has been off on integration: "no qualified speaker protection exists for J873 yet". It can't get that protection the way J813 did, because no sense data reaches Linux.
The AOP firmware runs the speaker stream, and the ADT's stream descriptor for it (
iop-audio-controller/audio-speakerreg) has no receive side. Compared with J813:0x0f0x010xff0x00Both run a 12 MHz BCLK with 250 BCLKs per frame. The amp's V/I sense never reaches the AP, and the ADT gives the amp
speaker-protection = 0, so macOS runs no closed-loop protection on the mini either. I checked this on hardware: aurora speakersafetyd takes the controls on J873, then can't open a sense stream.This admits the speaker under #1884's
spk_fixed_ceilingat -16 dB:enable_speakers = true,safe_vol = -16,spk_fixed_ceiling = true, and the KUnit admission expectation. The first version proposed -15 dB. Its thermal case only considered a sine, and the worst signal is a square wave (see below).Power and thermal
The J873 ADT has no thermal data for its speaker, so the thermal side uses that same J274 model:
t_limit)t_limit - t_window)Steady coil temperature at the ceiling, for continuous full-scale signals:
min_gain. At this amp level that is 10·log10(0.94 W / 30.8 W) = -15.2 dB, the gain that holds a full-scale square wave at 0.94 W. The ceiling sits 0.8 dB below that floor.The caveat: this is the J274's speaker model, not a measured J873 one.
PipeWire high-pass and limiter
aurora-silicon/asahi-audio#28 is the userspace half. It wraps the raw speaker node in a graph:
It is measured on the J873g there.
Testing
On the J873g (M6), using a DT that carries the ADT's
apple,speaker-config,apple,bop-configandapple,amp-dcblocker-config(what aura's kboot_audio passes).At -16 dB, with this macaudio on the M6's integration kernel:
speaker_starts_refusedstays 0.At -15 dB, with the #1797 stack (2026-11-13/14):
OUTon), and dmesg shows no amp faults.The six apple-speaker KUnit suites pass at -16 dB (arm64, QEMU: 60 tests).
Not in this PR
HW_CFG_T8152in t8152_aop_audio.rs still declares two sense channels, and the J873 DT still has asenseDMA on RX1. Both are dead, given the descriptor above; macaudio no longer links them.cc @joshuaswarren