Skip to content

Merge integration/aurora (#981 amp values from the ADT) into sgv2-kernel-interface - #982

Merged
RyanTheTide merged 9 commits into
sgv2-kernel-interfacefrom
n2/sgv2-nohand2
Nov 5, 2026
Merged

RyanTheTide merged 9 commits into
sgv2-kernel-interfacefrom
n2/sgv2-nohand2

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Summary

Brings integration/aurora's #981 (SN012776 amp values from the ADT, via aura #75) into the #922 line, on top of ec5128d.

Conflict resolution in sound/soc/apple/macaudio.c:

  • Each SN012776's "Amp Gain Volume" is fixed (limit + value + lock, the sgv2 semantics) at its own ADT level: macaudio_fix_sn012776_levels() uses macaudio_set_fixed_volume() per amp instead of integration's limit-only.
  • Tweeters keep macaudio_speaker_hpf() (800 Hz floor ungranted, ASoC: apple: macaudio: Open the tweeter HPF only while protection is granted #949's granted corner); woofers keep the corner the amp got from the ADT.
  • j316/j413 keep .tweeter_hpf_granted; no SN012776 gain in any table.
  • macaudio-protection-test.h: the amp-gain test fixes an ADT-style level (15) instead of the j316 table's gain, which is gone.

Follow-up: tweeter_hpf_granted = "2 Hz" is still a literal; it should become the woofers' ADT corner.

Tests

🤖 Generated with Claude Code

DjDeveloperr and others added 9 commits November 4, 2026 23:47
A display behind a Thunderbolt dock on a T6020 (M2 Pro/Max) can drop
HPD for a second or two while the CRTC stays on, for example a monitor
that blips HPD as it leaves standby after a wake or unblank. The
connection manager tears the DP tunnel down and builds it again, and
the DCP firmware powers the pipe down with the lost link. The
compositor never sees the short disconnect, so it keeps the CRTC active
and issues no modeset.

dcp_hotplug() left T6020 tunnels out of the active-CRTC retrain, and a
reset of the CRTC would not have helped either: with the CRTC still
active it only sets the mode, and the modeset fails because nothing
powers the pipe back on. The display stayed dark until it was
replugged.

Turn the CRTC off and on instead. dcp_poweron() then reconnects the
DPTX, waits for the firmware's hotplug, and powers the pipe on before
the mode is set, as when the compositor wakes the display. Check the
mode again under the modeset locks, so a commit that got there first is
not redone, and allow two cycles until the mode is valid again.

Tested on a J414s with a Thunderbolt 5 dock and a 4K 120 Hz monitor:
the monitor dropped HPD 3 s after a wake and the picture came back
0.6 s after the tunnel returned. Before, it stayed dark.

Assisted-by: Claude Opus 5.5
Signed-off-by: DjDeveloperr <[email protected]>
…he DT

The driver wrote a brownout prevention block typed in from a trace to
every SN012776, and left the DC blockers at their reset values. The
Mac's ADT carries both for each amp group (bop-config and
amp-dcblocker-config), and the boot loader now copies them to every
amp's node as apple,bop-config and apple,amp-dcblocker-config.

Program BOP_CFG0..BOP_CFG24 from apple,bop-config, and DC_BLK0 and
DC_BLK1 from the first two bytes of apple,amp-dcblocker-config (the
rest is padding), and drop the copy in the driver. PVDD stays the
brownout source on every SN012776, as before. Without a property its
registers keep their reset values; a property of the wrong length is
a broken device tree and fails the probe.

KUnit tas2764-bop (8 cases): each block is the property byte for byte,
absent means none, a wrong length fails, a TAS2764 ignores both.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Which of an SN012776's idle sense output slots drive zeros instead of
floating comes from per-board masks in the sound card's device tree
node. The Mac's ADT carries it per amp (a row of the group's
amp-tx-zd-config: one byte per eight slots from slot 0), and the boot
loader now copies each amp's row to its node as apple,amp-tx-zd-config.

With the property, program SDOUT_HIZ_1..4 from the row's first four
bytes and enable FORCE_0 at probe, and leave the card's idle masks
unused for that amp; the bit clock ratio still crops the mask to the
frame. An all-zero row leaves every idle slot in high impedance, as an
amp without a card mask has today. Like those masks, slots from 32 on
are not driven; a row that asks for them is warned about. Without the
property nothing changes.

KUnit tas2764-bop: tas2764_tx_zd (row to mask, absent, short row, not
a TAS2764 property).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The driver limited every SN012776's "Amp Gain Volume" to a value from
its per-board table; three of those values (J614s, J616s, J713) were
picked at bring-up. The Mac's ADT gives each amp's operating level: the
second byte of the amp's row in its group's speaker-config, which the
boot loader now copies to the amp's node as apple,speaker-config.

Limit each SN012776's "Amp Gain Volume" to its own level from that row
(low five bits) and drop the SN012776 gains from the board tables. A
speaker link whose amps do not all carry a level in the amp's range
(an older boot loader) keeps its speakers off, as a model whose safety
the driver can't assure does. The woofers keep the playback high-pass
corner the amps were given from the ADT (apple,amp-dcblocker-config)
instead of a fixed "2 Hz"; the tweeters keep the 800 Hz protection
floor.

On the M1 Pro, M2 and M4 Pro every amp's ADT level is the level their
tables had, so their limits do not change.

KUnit apple-speaker-amp-level (4 cases): the level is the row's second
byte, out-of-range and short or absent rows are rejected, speakers need
every amp's level, no SN012776 board table carries a gain.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The J616s/J713 jack was capped 6 dB below the DAC's 0 dB by a margin
chosen at bring-up; the other CS42L84 machines had no cap and reached
the DAC's digital gain above 0 dB, which only clips. macOS's own
headphone volume ends at 0 dB on every machine whose audio
configuration we have collected. Drop the per-board value and cap every
CS42L84 jack at 0 dB. Cards without a CS42L84 jack have no such
control and are left alone.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
macaudio now leaves an SN012776 woofer's playback high-pass at the
corner the amp got from the Mac's ADT (apple,amp-dcblocker-config) and
only locks it, instead of setting "2 Hz". Expect the control to keep
the value it holds; tweeters still go to the 800 Hz floor.

macaudio-fixed-controls: 0 failures in 590 attempts with and without
CONFIG_SND_CTL_INPUT_VALIDATION.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
drm/apple: power-cycle a T6020 tunnel CRTC that lost its mode
ASoC: SN012776 amp setup and jack cap from the ADT (no bring-up hand values)
…rnel-interface

Resolves macaudio: each SN012776's Amp Gain Volume is fixed at its own
ADT level (macaudio_fix_sn012776_levels), tweeters keep
macaudio_speaker_hpf(), woofers keep the amp's ADT corner, the board
tables carry no SN012776 gain and keep tweeter_hpf_granted. The amp
gain test fixes an ADT-style level instead of the j316 table's.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware, exact head 7281ad8 built as 7.3.0-aurora-nohand3 (Fedora asahi base config + asahi.config, no local changes), under aura v1.0.0b5 (9a173ff5) installed as the real boot.bin Stage 2 (7.1 DTB set and U-Boot byte-identical), with speakerguardd-v2 from the fedora-aurora #160 CI RPMs (effddd18):

  • M2 (J413) boot 45b1d321 and M1 Pro (J316s) boot cf7480e5: every SN012776 node's apple,bop-config / amp-dcblocker-config / speaker-config / amp-tx-zd-config byte-identical to the Mac's ADT (4/4, 6/6); no amp without a brownout block; Amp Gain Volume 15 on every amp; jack DAC max 256.
  • Gate: v2=1 legacy=0, provisioning and self-check pass, supervisor active, "Speaker protection granted".
  • Speakers at minimal volume only (evening quiet rule: sink 0.03, quiet noise): PCM RUNNING, amps in active mode, quiet mic level (-37 / -35 dBFS ambient).
  • dmesg err 0, SELinux enforcing, 0 AVCs, 0 failed units.
  • Observation (v2 side, not this PR): 9 grant/withdraw ("released by the owner") cycles in the first 15–25 s of boot before it settles granted.

Merging per the brief (#922 stays unmerged).

🤖 Generated with Claude Code

@RyanTheTide
RyanTheTide merged commit f10babb into sgv2-kernel-interface Nov 5, 2026
@RyanTheTide
RyanTheTide deleted the n2/sgv2-nohand2 branch November 7, 2026 00:55
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.

2 participants