diff --git a/patch_v2/meow_audiod/meow_audiod b/patch_v2/meow_audiod/meow_audiod index 1f1d049..b64d658 100755 Binary files a/patch_v2/meow_audiod/meow_audiod and b/patch_v2/meow_audiod/meow_audiod differ diff --git a/patch_v2/meow_audiod/meow_audiod.c b/patch_v2/meow_audiod/meow_audiod.c index 561e7d0..20da178 100644 --- a/patch_v2/meow_audiod/meow_audiod.c +++ b/patch_v2/meow_audiod/meow_audiod.c @@ -405,6 +405,8 @@ static const char *port_name(int port) switch (port) { case 2: return "3.5 headset"; case 3: return "4.4 balance"; + case 4: return "i2s/spdif digital"; + case 5: return "none(disable)"; default: return "idle"; } } @@ -1121,6 +1123,21 @@ static void *route_thread(void *arg) (void)arg; int last_hb = -1, last_bal = -1, last_target = -1; logmsg("route thread init (numid=9, %s)", g_amixer); + /* M2.91 挂死根治(AUDIO_HANG_INVESTIGATION.md):hbc3000 FPGA 未烧录+enable 时 + * 启动 PCM 会在第二次 hbc3000_start 死锁整机。写 Output Port Switch 是烧录触发器 + * (驱动 put:set_spdif_mode→program_ram→enabled)。开机端口恒 0=未烧,故启动时 + * 无条件写一次:4.4 在→3,3.5 在→2,都没→4(官方播放器拔插孔后的选择,保 FPGA 已烧)。 + * 端口已是目标值(audiod 重启场景,驱动同值短路不写)→ 先写 5(disable) 强制重烧。 */ + { + int hb = read_switch("/sys/class/switch/headset/state"); + int bal = read_switch("/sys/class/switch/balance/state"); + int target = (bal == 1) ? 3 : (hb == 1) ? 2 : 4; + int cur = amixer_get(9, 1); + if (cur == target) { logmsg("route: port already %d, force re-arm via 5", target); apply_route(5); } + apply_route(target); + last_hb = hb; last_bal = bal; last_target = (hb == 0 && bal == 0) ? -1 : target; + logmsg("route: boot arm done (port %d %s, FPGA programmed)", target, port_name(target)); + } while (!g_stop) { pthread_mutex_lock(&g_mu); route_evaluate(&last_hb, &last_bal, &last_target);