Skip to content

ASoC: apple: macaudio: M5 Mac Studio speaker under a fixed -20 dB ceiling - #2514

Closed
RyanTheTide wants to merge 2 commits into
integration/aurorafrom
dtfill-t6050/studio-speaker
Closed

RyanTheTide wants to merge 2 commits into
integration/aurorafrom
dtfill-t6050/studio-speaker

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

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,macaudio configuration: 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.

  • macaudio: a J775 configuration for apple,j775c-macaudio and apple,j775d-macaudio (binding updated). It uses the J714s AOP front-ends and formats, one amp, and spk_fixed_ceiling with safe_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.
  • DT: a new t6050-studio-audio.dtsi holds 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 gets ti,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.

  • KUnit (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 new macaudio_j775_fixed_ceiling passes: 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.
  • J775d DTB: the only change is ti,bclk-ratio on 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):

  • J775c (@satchlj) and J775d (@funkzy), on the PR head plus the J775c board file from arm64: dts: apple: support M5 Max Mac Studio (J775c) #2102:
    • the amp and jack codec probe;
    • amixer -c <card> contents shows the speaker volume capped at -20 dB, with no sense controls;
    • evtest on the jack device shows insert and remove events;
    • aplay -l lists the jack and speaker PCMs.
  • dmesg must not contain "driver can't assure safety". It will contain "boot loader passed no amp levels" if aura does not yet pass apple,speaker-config on 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()). With spk_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 (see macaudio_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 its apple,speaker-config level from the boot loader, or the speaker stays off.

Assisted-by: LLM (Claude:Opus 5.5)

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>
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

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, 7400d465c320 = integration/aurora e0ee46a18e33 + 80 commits, 0 behind the tip at 06:27Z, booted 2026-11-20 05:57Z. It includes this PR's two commits at 0adc3b29e634, and #2102's J775c DT, which already uses apple,j775c-macaudio with the amp, jack and both links. It does not include t6050-studio-audio.dtsi.

  • J775d DT: in cand-4 it is a hand-merge, not this PR as-is. This PR's J775d hunks conflicted with one of our carries ("describe the headphone jack codec on every board"), so I applied them by hand to the carried file.
  • J775c DTB: unaffected. It is byte-identical to the previous candidate's.

Baseline: lobata's default kernel (7.3.0-lobata-j775c+, Nov 16). It has its own speaker path: speaker governor: active, ceiling 0 dB requested (fixed -20 dB).

Row default cand-4 (this PR)
Amp 0-0038 sn012776, bound to tas2764 sn012776, bound to tas2764
Jack codec 1-004b cs42l84, bound cs42l84, bound (Cirrus Logic CS42L84, Revision: 36)
AOP 290c00000.aop (apple,t6050-aop) bound no driver bound, not in devices_deferred
macaudio card card 3: AppleJ775 [Mac Studio J775] none: platform sound: deferred probe pending: snd-soc-macaudio: parsing CPU DAI of link 'Headphone Jack' at /sound/dai-link@0/codec
amp DVC (reg 0x1a, regmap read-back) 0x28 = −20.0 dB 0x00, the amp's untouched reset value, because no card set it
Sense controls none in the card (no card)
"driver can't assure safety" / "boot loader passed no amp levels" neither line neither line (macaudio never reached its speaker admission)
evtest on the jack needs hands, Satya's step needs hands, Satya's step

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:

  1. Our J775d board file (and the tip's comment, which this PR removes) describes the ADT speaker-config with ti,vmon-slot-no = <0> and ti,imon-slot-no = <2>. The amp is configured to transmit V/I sense slots, even though no sense stream has been seen reaching the AP. That may matter if the sense later turns out to arrive through the AOP.
  2. Once arm64: dts: apple: support M5 Max Mac Studio (J775c) #2102 lands, J775c can include t6050-studio-audio.dtsi as you suggest. arm64: dts: apple: support M5 Max Mac Studio (J775c) #2102's own J775c file currently describes the same nodes inline.

🤖 Generated with Claude Code

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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.
  2. "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.
  3. 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).
  4. 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.
  5. 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.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Split up. The jack, the shared t6050-studio-audio.dtsi and the J775c binding are now in #2535, with the speaker off. The AOP speaker stream has one TX slot and no RX slot, so the speaker comes next behind the protection lease, the same way as the J773g: #2536 (draft, stacked) with aurora-silicon/speakerguardd#220. Closing this one in favour of those.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

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.

/arm-io/iop-audio-controller/audio-speaker (the AOP's speaker stream, iop-adma-stream,mca, identifier rkps):

Property Value
dma-provider-tx base-ns-adma-tx-0
dma-provider-rx base-ns-adma-rx-0
clock-domain niam

Its data child, audio-speaker@201, has reg = <0102000001000100001bb700fa0001003000010001000000000000000100180000002000>. It carries no data-sources property.

For comparison, the other streams on the same controller:

Stream Channels
audio-codec-output (jack playback) tx-2 only
audio-codec-input rx-2 only
audio-mca-loopback tx-3 and rx-3

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 (/arm-io/i2c1/audio-speaker@38, audio-control,sn012776):

  • speaker-config = <00140002>;
  • speaker-protection = <00000000>;
  • no vsense/isense slot or sense-config property.

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:

  • whether sense data actually arrives on rx-0 through the AOP. On J775c, no Linux kernel has opened that RX yet;
  • whether the J714 sense path's protection unit applies.

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

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf: cause of the J775c AOP blocker in the row above. apple_aop fails with -ENODATA, because #2102's J775c DT gives the AOP no setup mailbox, which the tip's HW_CFG_T6050 path needs. Details and a suggested DT change are on #2102: #2102. Nothing in this PR needs to change for it. I'll post the card row once a candidate with that fix boots.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants