Skip to content

ASoC: apple: source TAS5770L amp gain from the boot device tree - #3385

Open
RyanTheTide wants to merge 5 commits into
mainfrom
fix/hardcode-audit-tas5770l-gain
Open

RyanTheTide wants to merge 5 commits into
mainfrom
fix/hardcode-audit-tas5770l-gain

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

macaudio uses a per-board analog gain cap on TAS5770L speakers. The protection lease fixes each amp at that cap, so it needs to come from the installed hardware's own configuration.

Change

Read the amp's operating gain from its device-tree row before registering the speaker backend. Apply the limit to each amp's codec control and keep the speaker backend closed if any row is unusable. Keep the existing sense-slot layout and the SN012776 fixed-ceiling check.

Depends on the bootloader handoff in aurora-silicon/aura#542. The booted loader needs to supply the rows before deploying this kernel to a TAS5770L Mac.

Tested

Arm64 macaudio and codec objects built with W=1. The binding passed dt-doc-validate and both commits passed checkpatch. All 73 macaudio KUnit cases passed in arm64 QEMU, including valid per-amp gain, a missing or malformed row, zero, out-of-range gain and a mismatched codec.

Hardware verification

The J274 owner verified both silent paths at published head e3d44558e610. With the earlier Stage 2, the speaker backend stayed closed and jack and headset-mic controls remained visible. With Stage 2 that includes aura #542, the TAS gain control matched the DT limit and the kernel held the muted floor. This Debian boot still had legacy speakersafetyd, whose unlock request the kernel refused. The probe opened zero PCMs.

The review found a shared mixer descriptor at that head. Repeat the silent TAS checks at the corrected head, including independent ALSA ceilings on a multi-amp J313. Run the silent MAX98360A and SN012776 reference rows in the same batch.

Risk: two-way · TAS5770L Macs (J274, J293, J313).

Compatibility and rollback
  • The J274, J293 and J313 stock DTBs contain TAS5770L codec nodes and rely on the loader for the new rows. An older loader keeps the TAS speaker backend closed. Verify jack and mic availability on that combination during the physical row.
  • Revert the kernel consumer before removing the provider for a release that uses it.

Document the optional row copied by the Apple bootloader for each
TAS5770L speaker amplifier. The row describes the analog operating gain
and names the source format's slot fields.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The bootloader can hand the machine's speaker-config row to each amp.
Read that row before adding the speaker backend and apply the decoded
gain to its mixer control through the existing per-amp volume limiter.
Skip the TAS speaker backend if any row is absent or unusable.

Share the codec register range with the driver. Reject zero because
the ASoC volume platform limit uses zero to indicate no limit. Keep
the SN012776 fixed-ceiling check and Linux's TAS sense layout.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH, then merge at 37cf5963 (draft until the physical TAS5770L row and aura #542 land)

Blockers: none.

Checked:

  • Complete-group admission holds. macaudio_amp_level_count() returns 0 as soon as any sound-dai amp has no row, a malformed row or a level that is not allowed, so a partly written group never opens the speakers.
  • Zero is refused (level > 0), because a zero platform maximum means no limit to ASoC. Anything above TAS2770_AMP_GAIN_MAX (0x14, now shared with the codec's control) is refused, and so is a node that is not ti,tas5770l.
  • The fixed-ceiling check for SN012776 is unchanged: same mask, same maximum, macaudio_amp_level_allowed() is only renamed.
  • With an older loader (no rows), macaudio_parse_of() skips the speaker link before the BEs are filled. The TAS components are then not on the card, macaudio_limit_amp_levels() finds none (count 0 == tas_amp_count 0), and the jack and microphone links still register.
  • With rows, every TAS component on the card must be limited, or probe fails: count != tas_amp_count gives an error.
  • The value is the machine's own. The J313 ADT (reference/adt/gravity-adt-collection/27.0.1/t8103-j313.txt) has amp_gain = 10 in both rows of audio-tas5770L-spkr-l's speaker-config, the same as the 10 this PR removes from macaudio_j313_cfg, and as a raw byte with no flag bits. So reading the byte unmasked is right for TAS5770L.

No board gate is added, three per-board constants are removed. No Apple material, no attribution.

Evidence and notes
  • Read at 37cf5963: the full macaudio.c diff, macaudio_parse_of() around lines 2690-2775, tas2770.c/tas2770.h, and the binding. ti,sn012776 lives in ti,tas27xx.yaml, so the new apple,speaker-config: false for non-TAS5770L compatibles in ti,tas2770.yaml does not touch SN012776 nodes.
  • Not yet compared: J274 and J293 ADT rows are not in our ADT collection, so I could not check them against the removed caps (20 and 15). The ADT is the authority either way. When the physical or archived rows come in, note in the PR if either differs, because that changes the live cap on that model.
  • Not run: no KUnit or hardware here. This review is source plus the ADT cross-check.

Conflict in macaudio-amp-level-test.h: main added macaudio_j775_cfg to
macaudio_level_no_table(), which checks the per-board amp_gain field.
This branch removes that field and the test with it, so keep this side;
the new J775 cfg carries no amp gain.
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Silent TAS5770L row harness (no PCM opened). For the J313 one-shot rows of this PR (head 236eeb67) paired with aurora-silicon/aura#542 (head 89e1aa2d).

The probe binds the ALSA card to the live DT sound node. It checks every TAS amp's Amp Gain Volume maximum against that amp's apple,speaker-config row (byte 1), matched by codec prefix. It also confirms the speaker controls are suppressed when the handoff is missing, while the jack controls the DT describes stay available. Output is counts and control names only.

Modes: present = new Stage 2 + this kernel. refused = this kernel on the current Stage 2 (no rows). reference = a non-TAS Mac.

Run: sudo python3 -I -B check-tas-row.py <speakerguardd main>/packaging/session/wiring.py --expect present|refused --kernel-release "$(uname -r)" --stage2-version <expected Stage 2 version string>

sha256 d78e65375386d1ed5a8916bd1dc7fa19a41562b78ebc40b3b0f78ba6d40d7e37

check-tas-row.py
#!/usr/bin/env python3
"""Read the live amp handoff and ALSA control limits without opening a PCM."""

import argparse
import json
import os
from pathlib import Path
import re
import subprocess
import sys
from types import ModuleType


DT = Path("/proc/device-tree")
TAS = "ti,tas5770l"
GAIN = "Amp Gain Volume"
PROTECTION = "Speaker Protection"


def amixer(card, *args):
    return subprocess.check_output(
        ["amixer", "-i", "-c", str(card), *args], encoding="utf-8", timeout=10,
        env={**os.environ, "LC_ALL": "C"}, stderr=subprocess.DEVNULL,
    )


def mixer_controls(output):
    controls = {}
    for line in output.splitlines():
        item = re.fullmatch(r"numid=(\d+),iface=MIXER,name='([^']+)'(?:,.*)?", line)
        if not item:
            continue
        numid, name = item.groups()
        controls.setdefault(name, []).append(numid)
    return controls


def gain_maximum(output):
    # amixer cget gets element info and may also print current values. Only
    # the raw control maximum is relevant, before or after a lease grant.
    match = re.search(r"^ *; type=INTEGER,.*\bmax=(\d+)(?:,|$)", output, re.MULTILINE)
    if match is None:
        raise ValueError("no integer maximum in ALSA control info")
    return int(match[1])


def check_row(wiring, dt, expect):
    hw = wiring.read_dt(str(dt))
    codecs = wiring._speaker_link(hw)["codecs"]
    tas = [codec for codec in codecs if TAS in codec["compatible"]]
    if not codecs or (tas and len(tas) != len(codecs)):
        raise ValueError("empty or mixed speaker codec group")
    if bool(tas) != (expect != "reference"):
        raise ValueError("speaker codec family does not match the requested row")

    card = wiring.live_card(hw, dt=str(dt))
    if card is None:
        raise ValueError("the DT speaker card is not registered")
    index, card_id = card
    # In legacy-interface mode the lease control can exist but be inactive.
    controls = mixer_controls(amixer(index, "controls"))
    if len(controls.get(PROTECTION, [])) != (0 if expect == "refused" else 1):
        raise ValueError("unexpected number of Speaker Protection controls")

    gains = set()
    matched = 0
    rows = 0
    for codec in tas:
        name = f"{codec.get('prefix', '')} {GAIN}".lstrip()
        if name in gains:
            raise ValueError("ambiguous amp gain control prefix")
        gains.add(name)
        path = dt / codec["node"] / "apple,speaker-config"
        try:
            row = path.read_bytes()
        except FileNotFoundError:
            row = b""
        # The exported ABI is four bytes with the level in byte 1.
        if len(row) == 4 and row[1] > 0:
            rows += 1
        ids = controls.get(name, [])
        if expect == "refused":
            if ids:
                raise ValueError(f"{name} is exposed on a refused speaker route")
            continue
        if len(row) != 4 or row[1] == 0:
            raise ValueError("missing, malformed or zero TAS gain row")
        if len(ids) != 1 or gain_maximum(amixer(index, "cget", f"numid={ids[0]}")) != row[1]:
            raise ValueError(f"{name} maximum does not match its DT row")
        matched += 1

    actual = {name for name in controls if name == GAIN or name.endswith(f" {GAIN}")}
    if tas and actual != (gains if expect == "present" else set()):
        raise ValueError("unexpected set of TAS amp gain controls")
    if expect == "refused" and rows == len(tas):
        raise ValueError("refusal row does not demonstrate a missing, malformed or zero gain")
    jack_prefixes = {
        codec["prefix"]
        for link in hw["links"] if link["name"] == "Headphone Jack"
        for codec in link["codecs"] if codec.get("prefix")
    }
    jack_controls = sorted(
        name for name in controls if any(name.startswith(f"{prefix} ") for prefix in jack_prefixes)
    )
    if jack_prefixes and not jack_controls:
        raise ValueError("companion jack controls named by DT are missing")

    return {
        "board": hw["board"],
        "card": card_id,
        "speaker_codecs": [codec["compatible"][0] for codec in codecs],
        "route": expect,
        "tas_gain_maxima_matched": matched,
        "readable_nonzero_tas_rows": rows,
        "jack_controls": jack_controls,
        "playback_calls": 0,
    }


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("wiring", type=Path, help="path to speakerguardd's wiring.py")
    parser.add_argument("--expect", choices=("present", "refused", "reference"), required=True)
    parser.add_argument("--kernel-release", required=True)
    parser.add_argument("--stage2-version", required=True)
    args = parser.parse_args()
    boot = Path("/proc/sys/kernel/random/boot_id")
    sys.dont_write_bytecode = True
    try:
        boot_id = boot.read_text()
        kernel = os.uname().release
        stage2 = (DT / "chosen/asahi,m1n1-stage2-version").read_bytes().rstrip(b"\0").decode()
        if kernel != args.kernel_release or stage2 != args.stage2_version:
            raise ValueError(f"expected build differs from live kernel {kernel} or Stage 2 {stage2}")
        # Accept a pinned checkout file or a stream from a shell descriptor.
        wiring = ModuleType("wiring")
        wiring.__file__ = str(args.wiring)
        exec(compile(args.wiring.read_bytes(), wiring.__file__, "exec"), vars(wiring))
        try:
            result = check_row(wiring, DT, args.expect)
        except wiring.Refused as error:
            raise ValueError(str(error)) from error
        if boot.read_text() != boot_id:
            raise ValueError("boot identity changed during the probe")
        print(json.dumps({"kernel": kernel, "stage2": stage2, **result}, sort_keys=True))
    except (OSError, ValueError, subprocess.SubprocessError) as error:
        print(f"FAIL: {error}", file=sys.stderr)
        return 1
    return 0


if __name__ == "__main__":
    sys.exit(main())

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Silent regression rows, SN012776 macaudio: J473 (M2 mini) and J413 (M2 Air). Both PASS.

Candidate: fleet89 (645f7cd3) plus this PR's net diff at 236eeb67, built as snd-soc-macaudio.ko. It was loaded on a one-shot boot of the saved fleet89 kernel through a cmdline-gated modprobe hook. The saved default was not changed, and the hook, module and entry were removed afterwards. Kernel taint confirms the candidate module was the one loaded. No playback, and the probe opens no PCM.

Mac amps probe (--expect reference) ALSA controls + info/TLV vs stock v2 self-check failed units / AVCs / new kernel errors
J473 1 × SN012776 pass, jack controls present identical (25 controls) same wiring + params hash, every check holds 0 / 0 / 0 (20 vs 22 baseline)
J413 4 × SN012776 pass, jack controls present identical (39 controls, all four Amp Gain Volume max=15) same, every check holds 0 / 0 / 0

Both Macs are back on saved fleet89 (taint 4 = baseline, v2 active, Enforcing).

The TAS5770L rows (refused on the current Stage 2, present with aura#542) are queued on erikwb's J313 through aurora-agents (owner standing approval, silent). The probe is in the comment above.

Main added a v2-only DC-blocker requirement to the SN012776 level check
(now a bool helper) and its KUnit case. This branch generalises the same
helper to count SN012776 and TAS5770L amps. Keep the counting helper and
fold main's DC-blocker check into it, keep both sets of KUnit fixtures
and cases, and take main's tweeter high-pass comment. Main's
no_table test checks the per-board amp_gain field this branch removes,
so it stays dropped.
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

host-tests failure at e3d44558 comes from main, not this PR. The one failing case is apple-scaler-recovery-tests (the image scaler). The same test fails the same way on main at 498d53fd: its stub production.c doesn't compile (field 'hdl' has incomplete type, unknown type name 'u16'). The tree comes from main's scaler work (#3204), and this PR doesn't touch the scaler. The audio suites pass: arm64 KUnit apple-speaker-* is 80/80 at this head. Still waiting on the silent J313 TAS5770L rows (aurora-agents 16b513ae).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Ready for review, merging with a filed known gap (#3654). This follows the standing rules: don't block on testers who haven't agreed, and merge, then fix the known gap.

  • The loader half, aura#542, is merged (c0af820e31). Main Stage 2 images now provide the per-amp TAS rows.
  • The change is fail-closed. With no valid row on every amp, the speaker link is refused, the speakers stay silent, and the jack stays available. With rows present, the gain maximum equals the ADT value. The archived J313 ADT gives 10, the same as the removed literal.
  • SN012776 behaviour is unchanged. The silent J473 and J413 module rows show identical controls and TLV, and arm64 KUnit apple-speaker-* passes 80/80 at this head.
  • The one red check, host-tests (apple-scaler-recovery-tests), also fails on main (a03face5). It's the scaler test stub, not this PR.
  • The physical J313 row stays requested (16b513ae) and is tracked in Known gap: physical TAS5770L (J313) row for the ADT-sourced amp gain (linux#3385) #3654, along with a revert plan.

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 29, 2026 19:35
@RyanTheTide
RyanTheTide requested review from a team as code owners November 29, 2026 19:35

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at e3d44558

Blockers: None (physical TAS5770L J313 confirmation is tracked as a filed known gap in #3654 under fail-closed admission; the red host-tests job is the pre-existing main apple-scaler-recovery-tests stub failure).

Checked:

  • Verified complete-group fail-closed admission in sound/soc/apple/macaudio.c:
    • macaudio_tas5770_level() requires ti,tas5770l compatible, exact 4-byte apple,speaker-config, and 0 < level <= TAS2770_AMP_GAIN_MAX (0x14, shared from sound/soc/codecs/tas2770.h), explicitly rejecting 0 so ASoC never interprets a zero maximum as unlimited.
    • Any missing, short, zero, out-of-range, or wrong-compatible amp makes macaudio_amp_level_count() return 0, skipping the speaker link in macaudio_parse_of() (ma->has_speakers = 0) while leaving the jack card intact (macaudio_fixup_controls() returns early when !ma->has_speakers).
    • When speakers are admitted, macaudio_limit_amp_levels() applies snd_soc_limit_volume() to each ti,tas5770l component, checks ret == 1, and enforces count == ma->tas_amp_count so no TAS amp can bypass limiting.
  • Verified all macaudio_platform_cfg definitions in sound/soc/apple/macaudio.c: every positional initializer (j180, j274, j293, j313, j314, j316, j37x_j47x, j413, j415, j45x, j493, fallback) cleanly drops amp_gain with safe_vol preserved; all other boards use designated initializers.
  • Verified DT binding Documentation/devicetree/bindings/sound/ti,tas2770.yaml constrains apple,speaker-config (4-byte uint8-array) to ti,tas5770l and matches the merged bootloader provider (aurora-silicon/aura#542, merged at c0af820e31).
  • Verified CI & tests at e3d44558: kunit (80/80 apple-speaker-*), dt-checks, and pr-text pass; confirmed host-tests run 46262667447 failed exclusively on apple-scaler-recovery-tests (production.c:222 incomplete hdl / u16), unrelated to audio.
  • Verified silent SN012776 module regression rows on J473 (1 amp) and J413 (4 amps) (identical controls/TLV, 0 errors) and open tracking issue #3654 for the physical J313 TAS5770L row with a clean two-way revert path.
Evidence
  • sound/soc/apple/macaudio.c:2548-2653 (macaudio_tas5770_level, macaudio_amp_level_count, macaudio_limit_amp_levels), :2852-2875 (macaudio_parse_of), :4004-4014 (macaudio_fixup_controls), :4405-4822 (macaudio_platform_cfg tables).
  • sound/soc/codecs/tas2770.h:28 / tas2770.c:790: shared TAS2770_AMP_GAIN_MAX (0x14).
  • sound/soc/apple/macaudio-amp-level-test.h and macaudio-kunit.dtso: covers valid TAS rows (4, 14), zero/high/short/missing rejections, and complete-group / wrong-compatible checks.
  • Bootloader dependency aurora-silicon/aura#542 verified MERGED (c0af820e3159ab1d53c687da292262b2da5af5ec).
  • Known-gap tracking issue aurora-silicon/linux#3654 verified OPEN.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at e3d44558. App approved (NEON-PR-REVIEW2), and aura#542 (the loader rows) merged as c0af820e. This sets the speaker gain cap, a protection value, so it needs a hardware row before merge. Since no TAS5770L Mac (J274/J293/J313) is in our lab: @erikwb (J313) or @sithglan (J274), could you run one row at this head with a Stage 2 built from aura main (which has #542)? Check that each amp's gain control is capped at its ADT value, the speakers stay protected (speakerguardd v2 lease, silent; no playback needed), and that jack and mic still work. Plus one silent SN012776 regression boot (our J473 or J615). Known gap: #3654.

@github-actions github-actions Bot added area:audio Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merge readiness at 4a729396: not ready yet

Check Detail
CI at head ok 11 checks passed
Review no approved by DjDeveloperr, but GitHub does not count it yet (code owner from Core, Omarchy Mac or Aurora Maintainers needed, or approval went stale)
Requested changes ok none
Hardware row at head no no line with the head SHA 4a729396, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · TAS5770L Macs (J274, J293, J313).

Areas: area:audio

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide RyanTheTide removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026
@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-template PR body lacks Tested or Risk (bot) labels Nov 30, 2026
@sithglan

Copy link
Copy Markdown
Contributor

Silent TAS5770L hardware rows on Mac mini (M1, J274 / T8103): both refused and present PASS.

Tested at exact PR head e3d44558e610077061e22cb81b52ff1334926e02 (7.3.0-j274-pr3385+, arm64 LLVM=-19 / rustc 1.98.1, J274 Debian config) using the pinned silent probe check-tas-row.py (sha256 d78e65375386d1ed5a8916bd1dc7fa19a41562b78ebc40b3b0f78ba6d40d7e37, playback_calls=0, no PCM opened) with speakerguardd main (51a0d09f) packaging/session/wiring.py (sha256 2af866f8…). Stage 1 (1.0.0b17-ga2ad0085, macOS fw 27.2) was not touched; both trials ran via one-shot grub-reboot and (for present) one-shot aura-try Stage 2 built from aura main f417b840c7ab (1.0.0b17-gf417b840, containing merged aura#542 c0af820e31, RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1, aura.bin sha256 af8ca25b…, paired with e3d44558e610's t8103-j274.dtb and J274's stock u-boot-nodtb.bin.gz).

Mode Stage 2 Kernel apple,speaker-config (codec@31) check-tas-row.py ALSA protection / gain controls Jack controls Failed units
refused Stock 1.0.0b17-g749dd6de (pre-#542) 7.3.0-j274-pr3385+ (e3d44558e610) absent (0 readable rows) PASS (rc=0, playback_calls=0) Speaker backend refused (no amp level from the boot loader, disabling speakers); Amp Gain Volume & Speaker Protection suppressed 14/14 present (Headphone Jack, Headset Mic Jack, Jack ADC/DAC *) 0
present One-shot 1.0.0b17-gf417b840 (aura main f417b840) 7.3.0-j274-pr3385+ (e3d44558e610) 4 bytes, byte[1]=20 (21.00 dB) PASS (rc=0, readable_nonzero_tas_rows=1, tas_gain_maxima_matched=1, playback_calls=0) Amp Gain Volume min=0, max=20 (11.00 dB + 20*0.50 dB = 21.00 dB); Speaker Protection, Speaker Protection Interface, Speaker Protection Crossover, Speaker Protection Sleeps present; Speaker Playback Volume clamped at safe floor (max=1, -100.50 dB) 14/14 present 1 expected (speakersafetyd v1 — see note below)

Notes:

  • This J274 runs Debian with legacy speakersafetyd v1 (no speakerguardd v2 daemon installed). In the present row, snd-soc-macaudio cleanly refused legacy unlock (Speaker Volume Unlock refused: not selected on Speaker Protection Interface), keeping the speakers locked at the safe floor (Speaker Protection=0, Speaker Playback Volume max=1, no PCM opened). No new kernel audio errors occurred in present.
  • refused probe JSON: {"board": "j274", "card": "AppleJ274", "jack_controls": ["Jack ADC Boost Switch", "Jack ADC HPF Switch", "Jack ADC Invert Switch", "Jack ADC Notch Switch", "Jack ADC Volume", "Jack ADC WNF Switch", "Jack ADC Weak Force Switch", "Jack DAC HPF Switch", "Jack DACA Invert Switch", "Jack DACB Invert Switch", "Jack HPF Corner Freq", "Jack Mixer Volume", "Jack Slow Start Switch", "Jack WNF 3dB Freq"], "kernel": "7.3.0-j274-pr3385+", "playback_calls": 0, "readable_nonzero_tas_rows": 0, "route": "refused", "speaker_codecs": ["ti,tas5770l"], "stage2": "1.0.0b17-g749dd6de", "tas_gain_maxima_matched": 0}
  • present probe JSON: {"board": "j274", "card": "AppleJ274", "jack_controls": ["Jack ADC Boost Switch", "Jack ADC HPF Switch", "Jack ADC Invert Switch", "Jack ADC Notch Switch", "Jack ADC Volume", "Jack ADC WNF Switch", "Jack ADC Weak Force Switch", "Jack DAC HPF Switch", "Jack DACA Invert Switch", "Jack DACB Invert Switch", "Jack HPF Corner Freq", "Jack Mixer Volume", "Jack Slow Start Switch", "Jack WNF 3dB Freq"], "kernel": "7.3.0-j274-pr3385+", "playback_calls": 0, "readable_nonzero_tas_rows": 1, "route": "present", "speaker_codecs": ["ti,tas5770l"], "stage2": "1.0.0b17-gf417b840", "tas_gain_maxima_matched": 1}
  • Stock return verified: all trial files removed (/boot/efi/aura-try, trial Stage 2, trial kernel/initramfs/modules, GRUB custom entry); rebooted cleanly back to stock Stage 2 1.0.0b17-g749dd6de + stock kernel 7.3.0-j313-272+, 0 failed units, speakersafetyd active, Amp Gain Volume max=20.

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

FINISH, then merge at e3d44558e610.

  1. sound/soc/apple/macaudio.c:2642 applies each DT limit to a named gain control, but all TAS5770L gain controls share the same soc_mixer_control. With valid gains of 4 and 14, applying 14 second makes both controls report a maximum of 14. When speaker protection takes the lease, macaudio_spk_fix_amp_gains() writes that advertised maximum to each amp, so the amp rated for 4 can be set to 14. Give each TAS gain control its own mixer state before applying its limit. A two-control test should check that the maxima stay 4 and 14 and that the first control rejects 14.
Evidence

The TAS gain control comes from the static template at sound/soc/codecs/tas2770.c:790. snd_ctl_new1() copies the template’s private_value pointer at sound/core/control.c:315. Setting a limit changes the pointed-to platform_max at sound/soc/soc-ops.c:467. I checked those operations in memory with the two gains from the PR’s test fixture. Both controls reported 14. The lease uses that maximum at sound/soc/apple/macaudio.c:1772.

The DT parser rejects a missing or malformed row, zero, a gain above the codec range, or a different codec before registering the speaker backend. The change removes the board gain constants and adds no runtime switch or board check. The silent J274 runs confirmed that the jack stayed available with the row missing and that the one installed amp exposed its DT maximum of 20. J274 results

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Pushed 4a7293961eb2 to isolate each amplifier’s gain state; a host check using the codec and ALSA logic kept limits 4 and 14 independent and rejected a write of 14 to the first control, and satchlj’s approval plus a silent J313 or J274 verification are due.

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

The two TAS gain controls now keep separate limits. The host test verified maxima of 4 and 14 and rejection of 14 on the first control. This resolves my earlier change request. I pushed the fix, so a separate maintainer approval is still needed. Silent J313 and J274 verification is pending.

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Dec 3, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Silent reference row, MacBook Neo J700 (MAX98360A), on repaired head 4a7293961eb2.

Candidate Silent audio result Rollback
Linux 7.3.0-aurora-3385audio, PR head 4a7293961eb2 integrated over main 35bfbf3875a7 (tree 9272ba43dd95), Aura 1.0.0b19, saved U-Boot handoff 2026.07-g5c0d5fe1a222, SGv2 5144ca722ba0 One Speaker Protection control and all 14 baseline jack controls were present. Both candidate module build-ID checks passed. Every playback substream was closed at the check. The probe ran zero playback calls, SGv2 passed its static self-check, and the boot journal shows that the switch test was skipped. Returned to saved EDGE 1675a62307d2 with SGv2 active, SELinux enforcing, zero failed system units, and no pending one-shot. Removed the trial boot files and dead-man arm.

The probe's final report stopped on an incorrect U-Boot DT property path after the checks above. The U-Boot version comes from the restored saved boot, which supplied the loader handoff for this kernel-only trial. Both boots logged the same watchdog and multipathd shutdown errors. The candidate also logged a GNOME Global Shortcuts Provider exit during shutdown.

This covers the MAX98360A reference path. The repaired-head TAS5770L per-amp check and SN012776 candidate boot remain open.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 4, 2026
@aurora-silicon-review
aurora-silicon-review Bot requested review from DjDeveloperr and satchlj and removed request for DjDeveloperr and maralcbr December 4, 2026 21:31
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 5, 2026
@aurora-silicon-review
aurora-silicon-review Bot requested review from joshuaswarren and removed request for satchlj December 5, 2026 08:43

This branch has not been deployed

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

Labels

area:audio Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants