From 3055b8ce9c1ea4e5911783b14705cb8a47fd59ea Mon Sep 17 00:00:00 2001 From: "torlando-agent[bot]" <281092095+torlando-agent[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 23:18:10 -0400 Subject: [PATCH] =?UTF-8?q?feat(audio):=20ES7210=20Linux=20analog=20regist?= =?UTF-8?q?er=20config=20(REG20-23/47-4C)=20=E2=80=94=20A/B=20candidate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applies the explicit ADC-dynamics/HPF (REG20-23) + mic-ALC/power (REG47-4C) writes the Linux es7210 driver makes, which the LilyGO/ESP-ADF init leaves at reset defaults. Added while chasing an asymmetric-THD theory; the dominant garble was later proven to be acoustic feedback, so the benefit of these writes is UNVERIFIED. DO NOT MERGE until A/B-tested against a clean acoustic source — origin/main is the 'without' baseline. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01UWZuYkHBRqNb6BZHV8sTG5 --- lib/lxst_audio/es7210.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/lxst_audio/es7210.cpp b/lib/lxst_audio/es7210.cpp index 62bbcb57..47ace0a2 100644 --- a/lib/lxst_audio/es7210.cpp +++ b/lib/lxst_audio/es7210.cpp @@ -231,6 +231,23 @@ esp_err_t es7210_adc_init(TwoWire *tw, audio_hal_codec_config_t *codec_cfg) ret |= es7210_config_sample(i2s_cfg->samples); ret |= es7210_mic_select(mic_select); ret |= es7210_adc_set_gain_all(GAIN_0DB); + + // A/B CANDIDATE (2026-06-24): the LilyGO/ESP-ADF-derived init above leaves several ADC + + // mic-power analog registers at reset defaults that the Linux es7210 driver + // (rockchip-linux/kernel) writes explicitly: ADC dynamics/HPF (REG20-23) + mic ALC/power + // (REG47-4C). These were added while chasing an asymmetric-THD theory that the acoustic + // feedback later explained; whether they measurably help mic quality is UNVERIFIED and + // needs an A/B test against a clean acoustic source. Isolated here so main = the "without" leg. + ret |= es7210_write_reg(0x20, 0x0a); + ret |= es7210_write_reg(0x21, 0x2a); + ret |= es7210_write_reg(0x22, 0x0a); + ret |= es7210_write_reg(0x23, 0x2a); + ret |= es7210_write_reg(0x47, 0x08); + ret |= es7210_write_reg(0x48, 0x08); + ret |= es7210_write_reg(0x49, 0x08); + ret |= es7210_write_reg(0x4A, 0x08); + ret |= es7210_write_reg(0x4B, 0x0F); + ret |= es7210_write_reg(0x4C, 0x0F); return ESP_OK; }