Repository navigation
ASoC: apple: macaudio: M5 Mac Studio speaker under a fixed -20 dB ceiling - #2514
RyanTheTide wants to merge 2 commits into
Conversation
The M5 Mac Studio (J775c, J775d) has one SN012776 driving its built-in speaker and a CS42L84 for the headphone jack, both behind the AOP's audio services, as on the J714s. Neither machine has a macaudio entry, so the card falls back to the generic "apple,macaudio" configuration: no AOP front-ends, and no speaker. No voltage or current sense from the speaker amp has been seen to reach the AP on these machines, so there is nothing a protection daemon could govern. Give them the fixed ceiling (spk_fixed_ceiling) made for exactly this case: the speaker volume stays at or below the -20 dB safe level in every state, locked, unlocked or granted, and there is no sense PCM. The amp's ADT description matches the J575c's (M4 Max Mac Studio); if the sense turns out to reach the AP through the AOP, the J575 protection model can replace the ceiling. The jack and speaker links use the J714s AOP front-ends and formats. KUnit: the J775 configuration is admitted, carries no gain table, and holds its -20 dB ceiling through an unlock, a grant and the release ramp (the existing fixed-ceiling case, now shared with a J316 at -15 dB). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Move the J775d's speaker amp, jack codec and card links into a new t6050-studio-audio.dtsi, which both M5 Mac Studios (J775c, J775d) can include: one SN012776 at 0x38 on i2c1 (IRQ pin 106, shutdown pin 107), one CS42L84 at 0x4b on i2c2 (IRQ pin 134, reset pin 139), and the jack and speaker links on the AOP's audio services. The board sets the card's compatible and model. The file says why the speaker has no protection daemon and stays under macaudio's fixed ceiling. The amp is also told its frame: 250 BCLKs of 12 MHz, which its ratio detection rejects, as on the other AOP-fed SN012776 machines (ti,bclk-ratio). The J775d DTB only gains ti,bclk-ratio on the amp. J775c, whose integration file does not describe audio yet, is unchanged. Link: #2449 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Claude Opus 5.5 on @satchlj's behalf: J775c row, partial and without playback. The amp and jack codec bind, but the card does not form: macaudio waits on the AOP audio component, and the AOP device has no driver bound. That blocker is not in this PR. I'll add its cause here once I've found it. Nothing was played. Kernel: lobata's cand-4,
Baseline: lobata's default kernel (
The default's −20 dB register value matches the ceiling this PR configures, so on J775c this PR's cap is the default's cap. Two review notes on the J775c side:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
- With spk_fixed_ceiling the J775 speaker plays at up to -20 dB in every state, from bind, with no protection owner. Every other SN012776 machine is effectively silent until speakerguardd takes it: locked is raw 1 (-100 dB, macaudio.c:536-543) and an ungranted lease is mute (macaudio.c:1037-1039). The comment that -20 dB is "the level every SN012776 Mac sits at before a protection daemon takes it" is not what the code does. safe_vol is only an admission token for the SN012776. Please drop that claim from the cfg comment and the dtsi.
- "No daemon can govern it" is no longer true. speakerguardd#212 (merged) governs one AOP-fed SN012776 with no sense channel through derived-nosense and the Mac's own no-sense unit, and #2298 puts the J773g speaker behind the lease that way: silent until speakerguardd v2 is granted. If J775 has no sense, it should take the same route: a regular SN012776 cfg, no spk_fixed_ceiling, and "sense" dropped from the J775 aop_audio dma-names.
- Sense hasn't been tested on J775, and the description points the other way. The amp node is identical to J714s amp 0 (imon 2, vmon 0, bclk 250). It sits on the same T6050 AOP node, which declares V/I sense on RX0. The ADT speaker-config 00140002 carries vmon/imon slots 0/2 in bytes 2/3 the same way the J714s one does. What decides it is whether the ADT's audio-speaker stream lists an RX channel, which is how we showed the J773g has none. Please read that on a J775c or J775d and post it. Please also note speaker-protection = 0 in the commit message (it is 1 on J714s and 0 on J773g).
- Nothing here supports -20 dB as safe for this driver. It is the amp's digital volume, so 20 dB below full scale at the ADT's analog level. That level is 0x14, the top of the range, so -20 dB is 1% of the amp's full-scale power. There is no measurement, no macOS limit and no tuning value behind it. Please keep "amp gain 20" in the dtsi comment.
- The "no amp levels, speaker stays off" fallback won't happen. aura's kboot_audio_amp_config() copies speaker-config to every ti,sn012776 by I2C address on all chips but T8152, so merging this makes the J775d speaker play on the next boot. #2102's J775c sound node already uses apple,j775c-macaudio, so J775c follows as soon as both land. That amp node has imon/vmon swapped against the ADT and no ti,bclk-ratio; please fix that in #2102.
Please split this:
- Now: the shared t6050-studio-audio.dtsi, the J775 cfg with enable_speakers = false (or the lease-only shape once the RX read is in), the binding line, and the jack. Also move &sound off the PCIe ports comment in t6050-j775d.dts and drop the blank line it left before the root node's closing brace.
- Later: the speaker, once the RX question is answered, on the J714 sense path or the J773g lease path.
Separately, macaudio_hpf_restores_each_dt_corner fails on the base; please open an issue for it.
|
Split up. The jack, the shared |
|
Claude Opus 5.5 on @satchlj's behalf: on the ADT question, yes: J775c's speaker stream lists an RX channel. Source: lobata's (J775c, Mac Studio M5 Max) IODeviceTree capture from 2026-11-03 under macOS 26, read only. These are interfacing data only: node names, compatibles and the properties as stored.
Its data child, For comparison, the other streams on the same controller:
So the speaker stream is shaped like the loopback, with both directions. It is not TX-only, as #2298 describes J773g's (TX on base-ns ADMAC 0, no RX). The amp node (
The tip's J775d comment (removed by this PR) describes the same ADT speaker-config as V sense in slot 0 and I sense in slot 2, which fits the amp's TDM sense slots feeding that RX channel. What this does not show:
A capture-only check (open the RX, no playback, see whether the frames are non-zero idle-amp V/I data) is the next row I can run once the AOP binds on our candidate. It doesn't bind yet: see the row above. Speaker playback stays unauthorized. 🤖 Generated with Claude Code |
|
Claude Opus 5.5 on @satchlj's behalf: cause of the J775c AOP blocker in the row above. 🤖 Generated with Claude Code |
Problem. The M5 Mac Studio (J775c, J775d) has one SN012776 for its built-in speaker and a CS42L84 for the headphone jack, both behind the AOP's audio services, as on the J714s. macaudio has no entry for either machine, so the card falls back to the generic
apple,macaudioconfiguration: no AOP front-ends and no speaker. The J775d's audio nodes sit only in its board file, and J775c has none on this base.No voltage or current sense from the speaker amp has been seen to reach the AP on these machines (owner ADT reads on #2449: one amp, no sense property). So no protection daemon can govern this speaker.
Change.
apple,j775c-macaudioandapple,j775d-macaudio(binding updated). It uses the J714s AOP front-ends and formats, one amp, andspk_fixed_ceilingwithsafe_vol = -20. The speaker volume stays at or below -20 dB in every state (locked, unlocked or granted), there is no sense PCM, and no daemon takes it. -20 dB is where every SN012776 Mac sits before its protection daemon takes over. The amp's ADT description matches the J575c's (M4 Max Mac Studio); if the sense turns out to reach the AP through the AOP, the J575 protection model can replace the ceiling.t6050-studio-audio.dtsiholds the amp (i2c1 0x38, IRQ pin 106, shutdown pin 107), the jack codec (i2c2 0x4b, IRQ pin 134, reset pin 139) and the two card links, and says why the speaker has no daemon. J775d includes it and sets its compatible and model. The amp also getsti,bclk-ratio = <250>for the firmware's 250-BCLK frame, as on the other AOP-fed SN012776 machines. arm64: dts: apple: support M5 Max Mac Studio (J775c) #2102's J775c file can include the same dtsi.Testing.
apple-speaker-*, arm64 qemu): 61 tests, 58 pass. Base: 60 tests, 57 pass. The same three cases fail on both, so they predate this change:macaudio_hpf_restores_each_dt_corner, plus two wall-clock cases that miss their thresholds under emulation on a loaded host. The newmacaudio_j775_fixed_ceilingpasses: the shipped J775 configuration holds -20 dB after an unlock, a grant runs the amp at the ceiling, and the release ramp starts below it. Admission and the no-gain-table check pass with the new entry.ti,bclk-ratioon the amp. J775c is unchanged. dt-validate reports no messages before or after.Still to run (no speaker playback is needed for any of these):
amixer -c <card> contentsshows the speaker volume capped at -20 dB, with no sense controls;evteston the jack device shows insert and remove events;aplay -llists the jack and speaker PCMs.apple,speaker-configon these machines, and in that case the speaker stays off, which is the safe outcome.Why a fixed ceiling and not a daemon profile
macaudio admits a speaker link only with a configured, enforced safe level (
macaudio_speakers_allowed()). Withspk_fixed_ceiling, the SN012776 volumes' platform maximum is the safe level in every lock state, and a grant runs the amp at that level, never at 0 dB (seemacaudio_vlimit_unlock()and the lease path). No sense PCM is created, so speakersafetyd and speakerguardd have nothing to bind to. The amp also still needs itsapple,speaker-configlevel from the boot loader, or the speaker stays off.Assisted-by: LLM (Claude:Opus 5.5)