Fix MBHC wired headphone autodetection across all targets for a1125 (ampere)

Retain PM8909 MBHC digital debounce clock (DIG_CLK_CTL_D_MBHC_CLK_EN) and master bias (CDC_A_MASTER_BIAS_CTL = 0x30) across s2 standby gating while keeping the 100 uA button ISRC and button IRQs disabled when unplugged, check CDC_A_MBHC_RESULT_2 on boot/set_jack/switch IRQs with 3/4-pole FSM classification, fix iface=CARD jack queries, event coalescing, and stale unplugged Headphones boot fallback in bananarchy-soundmonitor and sxmo audio scripts, harden host tests against CPU contention, and rebuild all a1125 (ampere) target images.
This commit is contained in:
Luxferre committed 2026-11-24 11:00:06 +02:00
1 parent aba38a58f2
commit 9619cc9541
19 files changed
+516 -93

No files matched your search

+17 -23
View File
@@ -39,26 +39,17 @@ def setup_mocks(tmp: pathlib.Path) -> dict:
write_exec(
mock_bin / "logger",
"#!/usr/bin/env python3\n"
"import os, pathlib, sys\n"
"log_path = pathlib.Path(os.environ['MOCK_LOGGER_LOG'])\n"
"args = sys.argv[1:]\n"
"i = 0\n"
"while i < len(args):\n"
" a = args[i]\n"
" if a == '-s':\n"
" i += 1\n"
" elif a in ('-t', '-p'):\n"
" if i + 1 >= len(args):\n"
" sys.exit(1)\n"
" i += 2\n"
" elif a.startswith('-'):\n"
" sys.stderr.write(f'logger: unrecognized option: {a}\\n')\n"
" sys.exit(1)\n"
" else:\n"
" break\n"
"with log_path.open('a', encoding='utf-8') as f:\n"
" f.write(' '.join(args) + '\\n')\n",
"#!/bin/sh\n"
"orig=\"$*\"\n"
"while [ $# -gt 0 ]; do\n"
" case \"$1\" in\n"
" -s) shift ;;\n"
" -t|-p) [ $# -ge 2 ] || exit 1; shift 2 ;;\n"
" -*) echo \"logger: unrecognized option: $1\" >&2; exit 1 ;;\n"
" *) break ;;\n"
" esac\n"
"done\n"
"printf '%s\\n' \"$orig\" >> \"$MOCK_LOGGER_LOG\"\n",
)
write_exec(
@@ -251,7 +242,7 @@ def test_runtime_scenarios(tmp: pathlib.Path) -> None:
res, calls, elapsed, _ = run_filter(ctx, state_no_dnsmasq, ifn, act)
assert res.returncode == 0, f"{ifn} {act} failed: {res.stderr}"
assert calls == [], f"unexpected dnsmasq calls when not running: {calls}"
assert elapsed < 1.0, f"expected fast exit, took {elapsed:.2f}s"
assert elapsed < 3.0, f"expected fast exit, took {elapsed:.2f}s"
# 2. Wi-Fi early SLAAC RA before DHCPv4 completes, then dhcp4-change recovery
ctx["nm_resolv"].write_text("# Generated by NetworkManager\nnameserver 127.0.0.1\n", encoding="utf-8")
@@ -274,7 +265,7 @@ def test_runtime_scenarios(tmp: pathlib.Path) -> None:
}
res, calls, elapsed, _ = run_filter(ctx, state_slaac_race, "wlan0", "up")
assert res.returncode == 0, res.stderr
assert elapsed < 1.0, f"blocking sleep detected in 50-dns-filter.sh ({elapsed:.2f}s)"
assert elapsed < 3.0, f"blocking sleep detected in 50-dns-filter.sh ({elapsed:.2f}s)"
assert "SetFilterA b false" in calls, f"early SLAAC RA must not block IPv4 A records: {calls}"
state_dhcp4_done = {
@@ -293,7 +284,7 @@ def test_runtime_scenarios(tmp: pathlib.Path) -> None:
}
res, calls, elapsed, _ = run_filter(ctx, state_dhcp4_done, "wlan0", "dhcp4-change")
assert res.returncode == 0, res.stderr
assert elapsed < 1.0, f"dhcp4-change took too long ({elapsed:.2f}s)"
assert elapsed < 3.0, f"dhcp4-change took too long ({elapsed:.2f}s)"
assert calls == ["SetFilterA b false", "SetFilterAAAA b true", "ClearCache"], f"unexpected dhcp4-change calls: {calls}"
# 3. True dual-stack (2001:db8::2/64 GUA + IPv4)
@@ -393,6 +384,9 @@ def test_runtime_scenarios(tmp: pathlib.Path) -> None:
def test_static_invariants() -> None:
dns_filter = DNS_FILTER.read_text(encoding="utf-8")
assert "sleep " not in dns_filter, "50-dns-filter.sh must stay non-blocking"
dns_conf = DNS_CONF.read_text(encoding="utf-8")
assert "dns=dnsmasq" in dns_conf and "rc-manager=file" in dns_conf, dns_conf