Skip to content

selfcheck: name a lone desktop amp's sense switches without a prefix - #243

Merged
DjDeveloperr merged 1 commit into
mainfrom
m2mini/mono-amp-sense-switch
Nov 23, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
m2mini/mono-amp-sense-switch

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem. On the M2 Mac mini (J473) the speakerguardd v2 self-check refuses the speaker before it measures anything: no 'Speaker VSENSE Switch' control, followed by the speaker PCM took none of ['S24_LE', 'S32_LE', 'S16_LE']. The lone amp of the desktop Macs (J274, J375, J473, J474, J475) has no sound-name-prefix. wiring.derive() labels it "Speaker", but ALSA gives its controls no prefix at all (VSENSE Switch, ISENSE Switch, Speaker Volume). The supervisor already handles this (kernel.rs takes an empty amp name). Only the self-check's switch test built the name from the label. The PCM line is only a side effect of the switch test returning early.

Change. For the mono amp, wiring.derive() now records the control prefix (empty) next to the label, and the switch test builds the switch names from it. Amps that name themselves are unchanged. The label, the wiring hash and the generated configs are unchanged.

Testing.

  • New test test_mono_amp_sense_switches_have_no_prefix (J274 and J473 fixtures ask for VSENSE Switch; J413 keeps its prefixed names). It fails before the change and passes after.
  • packaging/session: test_wiring, test_verify, test_provision, test_session: 290 passed, 1 skipped. gen.py --check clean.
  • J473 (fleet82 default kernel, packaged speakerguardd-v2 1.0.0~alpha.2-0.53 with these two hunks applied, then put back): aurora-speaker-upgrade --check gets through identity (AID12, the Mac's own tuning from its vendor firmware), compile and the silent hardware switch test, which now passes (derived wiring). It is then refused at the next step, voicing, by the macOS parity attestation. Nothing was played and nothing was switched.

Still to run. The J473 cannot be granted yet. Its AID12 tuning is refused by the parity attestation in parity.json, on every build. AID2, AID6 and AID26 are refused with it, with the same numbers (worst +2.51 dB at tone_1600_-12, -3.67 dB at step_down_2000; the BuzzKill gap that #138 works on). This PR only removes the refusal that comes before that step. Protected playback rows on the J473 will follow once AID12 passes.

Reviewer detail
  • J473 card controls (fleet82): Amp Fault Status, Amp Gain Volume, ISENSE Switch, VSENSE Switch, Speaker Volume, Speaker Volume Unlock, Speaker Playback Mux, Speaker Sample Rate, Speaker Switch. The DT amp node codec@38 has ti,vmon-slot-no/ti,imon-slot-no and no sound-name-prefix.
  • Before (packaged): hardware switch test: refused: ... no 'Speaker VSENSE Switch' control; the speaker PCM took none of [...].
  • After (same package + the two hunks): hardware switch test: pass: silent switch test passed on this kernel. selfcheck verify: kernel pass (both interfaces), hardware pass (j473 wiring derived), voicing refused (macOS parity attestation).
  • rpm -V speakerguardd-v2 was clean after the files were put back; the packages were removed again afterwards (the J473 stays on its production stack).

Assisted-by: LLM (Claude:Opus 5.5)

The lone speaker amp of the desktop Macs (J274, J375, J473, J474, J475)
has no sound-name-prefix. wiring.derive() labels it "Speaker", but ALSA
names its controls without any prefix ("VSENSE Switch", "ISENSE
Switch", "Speaker Volume"), as the supervisor already expects
(kernel.rs takes an empty amp name for these). The switch test built
"Speaker VSENSE Switch", found no such control, and refused every mono
desktop; the "speaker PCM took none of ..." line that followed was only
a consequence of that early return.

Record the control prefix (empty) next to the label for the mono amp
and build the switch names from it. Amps that name themselves keep
their prefix in the control name.

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

Copy link
Copy Markdown
Contributor Author

Review at 0be5cb6.

First pass, non-author. The fix is in the right place and narrow:

  • Only the switch name changes. control_prefix exists only on the mono (lone-amp) derivation. Every other use of a["prefix"] in the self-check is a label in messages or a runs key, not an ALSA control name. Lines 740-770 look switches up through the same names dict, so the on/off restore uses the corrected names too.
  • wiring_hash() (wiring.py:1232-1240) hashes prefix, slot, v_ch and i_ch per amp and not control_prefix, so the hash and the generated configs really are unchanged, as the body says.
  • No safety value moves. The change lets the silent switch test find the J473's real VSENSE Switch/ISENSE Switch controls. Nothing is played, and voicing is still refused by the parity attestation, as it should be until AID12 passes.
  • test_wiring.py at this head: 98 passed, 1 skipped. The new test covers J274/J473 (no prefix) and J413 (keeps its prefix).

Nit: .lstrip() on the formatted name works, but " ".join(filter(None, (ctl_prefix, f"{kind}SENSE Switch"))) says the intent more directly. Verdict: approve. The J473 row in the body (switch test passes, voicing refused, rpm -V clean afterwards) is enough for this change.

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

Formal §1–§6 pre-PR checklist review at 0be5cb60c9d218fbc4b9b021e7ab36d7f9bfcc22.

Verdict: APPROVE.

Checklist Summary

  • §1 No model gating: Pass — control_prefix = "" is derived solely from the mono-amp DT shape (len(codecs) == 1 and "prefix" not in codecs[0]), with no chip/board gate.
  • §2 Production-ready, no hacks: Pass — narrow, clean fix with no workarounds.
  • §3 Safety: Pass — no safety values, limits, or protection thresholds change. wiring_hash() (packaging/session/wiring.py:1232-1240) does not hash control_prefix, so generated configs and hashes stay identical. Every lookup/toggle/restore in check_sense() (packaging/session/speakerguardd-selfcheck:706-789) flows through names[(a["prefix"], kind)], so switch restore uses the unprefixed names as well. Voicing on J473 remains refused by the parity attestation until AID12 passes.
  • §4 Clean-room & attribution: Pass — commit 0be5cb60c9d2 carries human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only (zero AI trailers in commit); PR body carries Assisted-by: disclosure.
  • §5 Evidence & CI: Pass — 9/9 active CI checks green (policy, Clean-publish check, selftest, Rust x86_64/arm64, Rig tools, Session side, aurora-speaker-upgrade; 1 skipped duplicate selftest). test_mono_amp_sense_switches_have_no_prefix covers J274/J473 (unprefixed) and J413 (prefixed). J473 hardware row on fleet82 default kernel verifies the silent hardware switch test passes, voicing stays refused, and rpm -V is clean after restore.
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

@DjDeveloperr
DjDeveloperr merged commit 7c01759 into main Nov 23, 2026
10 checks passed
@RyanTheTide
RyanTheTide deleted the m2mini/mono-amp-sense-switch branch November 27, 2026 13:21
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