Skip to content

ASoC: apple: t8140-aop-audio: drive the speakers to full scale - #1201

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
neogain/j700-speaker-full-scale
Nov 8, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
neogain/j700-speaker-full-scale

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

The J700 (MacBook Neo) speakers played 6 dB quieter than macOS at full volume. The cause is in the kernel, not in speakerguardd: the AOP speaker front-end mapped a full-scale S32 sample to a LEAP float of 0.5. This makes a full-scale sample a float of 1.0.

Why 0.5 was wrong

The 0.5 ceiling came from a SpeakerTap readback during bring-up (a sine written at 6 791 000/2^31 read back at 13 582 000). The ADT describes the speaker stream as 32-bit words and the tap as 24-bit samples in 32-bit slots with different framing, so the tap words do not show the wire's scale. macOS keeps its speaker output within digital full scale and does not wrap, yet it is 2x louder for the same chain output, so the wire's full scale is a float of 1.0.

Measurements

Same 80 s program, four raw external microphones on other Macs (J616s Snowball, J616s HQ mic, M2 HQ mic, M1 Pro HQ mic), dB(A).

Before (2026-11-08 12:45/12:48, Linux at full volume vs macOS at volume scalar 1.0):

Segment Linux - macOS
pink -30 dBFS -5.8 / -5.9 / -6.0 / -5.7
pink -18 dBFS -5.7 / -5.7 / -5.8 / -5.7
sweep -12 dBFS -5.7 / -5.8 / -4.9 / -5.7

Every 1/3-octave group from 125 Hz to 16 kHz was within -4.8..-5.9 dB: a flat factor of two.

This change, same session and microphone positions (17:16-17:24), stock fleet kernel vs the same kernel plus this commit, both at full volume under speakerguardd v2:

Segment this change - stock
pink -18 dBFS +5.8 / +5.8 / +6.0 / +5.9
sweep -12 dBFS +5.8 / +6.0 / +5.9 / +5.8
music +5.5 / +5.5 / +5.8 / +5.4
  • Every 1/3-octave group from 125 Hz to 16 kHz moved by +4.8..+6.2 dB, so the gain is flat, with no wrap or distortion signature.
  • Two passes with the change repeat within 0.1 dB.
  • No amplifier fault lines, protection stayed granted, 0 AVC denials.

Safety

  • The "Speaker Playback Volume" table is regenerated against the new full scale (0.5 dB steps, 127 = 0 dB, 87 = the safe level 20 dB down).
  • Unowned playback stays refused.
  • speakerguardd v2's speaker model already assumes the amplifier's full drive at a float of 1.0. Before this change it overestimated the real drive by 6 dB (conservative); after it the model matches the hardware.
  • KUnit: the conversion suite checks the new full scale and the exact conversions at it (12/12 pass, arm64 QEMU).

Testing

  • Test kernel 7.3.0-aurora-neogain1 = fleet31 (integration 14d64c3) + this commit. CTXR execmem on, 0 build warnings, 5891 modules. One-shot on the J700 with the os_uuid pin kept.
  • The macOS-vs-Linux confirmation in today's microphone geometry and the protection ladder at full volume run in the speakerguardd v2 qualification next. I will post the results here; please merge after that comment.

Merge-train notes: one file, sound/soc/apple/aop_t8140.rs, J700 only. Based on integration/aurora e636747, so it merges cleanly.

🤖 Generated with Claude Code

The speaker front-end converted each S32 sample to the float the LEAP
consumes through a ceiling of 0.5, on the belief that the LEAP doubles
its input: a sine written as 6 791 000/2^31 read back on the SpeakerTap
with a peak of 13 582 000. The tap is not the transmitter's format,
though. The ADT describes the speaker stream as 32-bit words and the tap
as 24-bit samples in 32-bit slots with its own framing, so its words do
not give the wire's scale.

Measured from outside the machine, the speakers fall 6 dB short of
macOS. The same 80 s program through the same speaker chain (Linux at
full volume, macOS at volume scalar 1.0, its 0 dB) recorded by four raw
external microphones on other Macs (2026-11-08):

  pink -30 dBFS  -5.8 / -5.9 / -6.0 / -5.7 dB(A)
  pink -18 dBFS  -5.7 / -5.7 / -5.8 / -5.7 dB(A)
  sweep -12 dBFS -5.7 / -5.8 / -4.9 / -5.7 dB(A)

and every 1/3-octave group from 125 Hz to 16 kHz within -4.8..-5.9 dB:
a flat gain, not tone, and a factor of two. macOS keeps its speaker
output within digital full scale and does not wrap, so a float of 1.0
is the wire's full scale and the 0.5 ceiling left both amplifiers 6 dB
below it.

Make the ceiling unity: a full-scale S32 sample is a float of 1.0. The
"Speaker Playback Volume" table is regenerated against it (still 0.5 dB
steps, 127 = 0 dB, 87 = macaudio's safe level 20 dB down), so a
protection engine that owns the speakers now drives the amplifiers at
the full scale its own model already assumes. Unowned, playback stays
refused. The KUnit suite checks the new full scale and the exact
conversions at it.

Checked on the J700 with sound, same session and microphone positions,
stock kernel vs this change, both at full volume under speakerguardd v2,
four raw external microphones (2026-11-08 17:16-17:24):

  pink -18 dBFS  +5.8 / +5.8 / +6.0 / +5.9 dB(A)
  sweep -12 dBFS +5.8 / +6.0 / +5.9 / +5.8 dB(A)
  music          +5.5 / +5.5 / +5.8 / +5.4 dB(A)

with every 1/3-octave group from 125 Hz to 16 kHz within +4.8..+6.2 dB,
two passes repeating within 0.1 dB, and no amplifier fault, wrap or
distortion signature.

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

Copy link
Copy Markdown
Contributor Author

Qualification done (2026-11-08 17:35-19:08). On the J700 with this change plus speakerguardd v2 RC6, at full volume:

  • Protection: 300 s ladder (0.3 / 0.6 / 1.0) with a supervisor kill at 150 s passed: 0 amplifier faults, 0 dropouts, withdrawn +2 ms and regranted +0.79 s with no click. The coil-temperature check passed, and lsm2 never reduced the gain. Kill-click at 1.0 passed.
  • Against macOS 26.6.2 at volume scalar 1.0, same session and microphone positions, noise-robust sweep analysis (deconvolved and gated, 1/3-octave bands at 20 dB SNR or better): Linux - macOS = -0.06 dB(A) on 3 external microphones (spread 0.10). An earlier window read +0.07 on 4 microphones. Before this change the gap was -5.7.

Ready for the merge train.

@RyanTheTide
RyanTheTide merged commit d4d2678 into integration/aurora Nov 8, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the neogain/j700-speaker-full-scale branch November 8, 2026 08:36
RyanTheTide added a commit that referenced this pull request Nov 8, 2026
Brings #1122, #1123, #1124 (T8142 DART/MTP/MSI), #1176 (G17 fw-id fence),
#1201 (J700 speaker full scale) and the rest of integration since
11943fb into aurora-wip.

Conflicts were in four device-tree binding documents only, where
aurora-wip has the T8152 versions and integration the T8142/T8152/T6050
generalisation:
- apple,admac: keep both the lone apple,t8152-admac and the
  apple,t6050-admac/apple,t8140-admac pair.
- apple,t8152-aop: take integration (it still allows a lone
  apple,t8152-aop, one or two mailboxes).
- apple,t8152-aop-audio: take integration and keep a lone
  apple,t8152-aop-audio compatible.
- apple,dwc3: keep the T8152 host-mode rules, and require resets and
  usb-role-switch on every enabled non-T8152 controller.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
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.

1 participant