From: Shimrra Shai shimrrashai@gmail.com
[ Upstream commit 7e39ca4056d11fef6b90aedd9eeeb3e070d3ce9f ]
Add proper DAC and mixer controls to DAPM; no initialization in es8323_probe.
Signed-off-by: Shimrra Shai shimrrashai@gmail.com Link: https://patch.msgid.link/20250815042023.115485-3-shimrrashai@gmail.com Signed-off-by: Mark Brown broonie@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- What it fixes - The DAPM mixer inputs for the DAC paths are not wired to hardware, so user-visible “Playback Switch” controls don’t actually program the codec. In current code, both controls use `SND_SOC_NOPM`, meaning they only affect DAPM topology but never touch the registers: - `sound/soc/codecs/es8323.c:185` Left: `SOC_DAPM_SINGLE("Left Playback Switch", SND_SOC_NOPM, 7, 1, 1)` - `sound/soc/codecs/es8323.c:191` Right: `SOC_DAPM_SINGLE("Right Playback Switch", SND_SOC_NOPM, 6, 1, 1)` - The driver also forces the left playback mixer path on during probe by writing `ES8323_DACCONTROL17 = 0xB8`: - `sound/soc/codecs/es8323.c:635` `snd_soc_component_write(component, ES8323_DACCONTROL17, 0xB8);` - Together these cause a mismatch between DAPM state and hardware: - Left DAC→Mixer path is forced on at boot (ignoring user control and DAPM). - Right DAC→Mixer path starts off and cannot be enabled by the “Right Playback Switch” control (since it’s NOPM), leading to channel imbalance or silence on the right.
- What the change does - Wires mixer switches to the correct hardware bits so DAPM and user controls actually program the codec: - Left mixer control is changed to `ES8323_DACCONTROL17` bit 7 with normal polarity (was NOPM): “Left Playback Switch”, `ES8323_DACCONTROL17`, bit 7, invert 0. - Right mixer control is changed to `ES8323_DACCONTROL20` bit 7 with normal polarity (was NOPM): “Right Playback Switch”, `ES8323_DACCONTROL20`, bit 7, invert 0. - Removes ad‑hoc forced initialization in `es8323_probe`, i.e. no manual mixer enabling at probe time, as stated in the commit message (“no initialization in es8323_probe”). This addresses the forced-on left path (see current write at `sound/soc/codecs/es8323.c:635`), allowing DAPM to control power and routing coherently.
- Why it’s a stable-quality bug fix - User-visible functional bug: Right channel playback switch can’t enable hardware; left path is wrongly forced on. The fix makes the controls effective and restores proper DAPM/hardware coherence. - Small, self-contained change in a codec driver; no API/ABI changes, no architectural refactors. - Aligns es8323 behavior with similar Everest codecs (e.g., es8328 maps playback switches to DACCONTROLx bit 7 with non-inverted semantics), reducing surprise and improving power management. - Expected to reduce power/leakage and unintended audio mixing by not forcing left mixer active at probe. - Likely “Fixes:” the original addition of the driver: - Fixes: b97391a604b9e ("ASoC: codecs: Add support for ES8323")
- Risk/side effects - The default-on left mixer path enabled in probe is removed; default becomes hardware-driven and off until DAPM/user enables the switch. This is the correct behavior and matches DAPM design. Existing machine drivers and userspace will gain working, persistent controls; DAPM will correctly power the path when in use. - Change is limited to `sound/soc/codecs/es8323.c`.
- Applicability to stable trees - Backport to stable series that already contain the ES8323 driver (introduced in b97391a604b9e). It’s an important functional fix with minimal regression risk and no feature additions.
sound/soc/codecs/es8323.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8323.c b/sound/soc/codecs/es8323.c index 4c15fffda733c..eb85b71e87f39 100644 --- a/sound/soc/codecs/es8323.c +++ b/sound/soc/codecs/es8323.c @@ -182,13 +182,13 @@ static const struct snd_kcontrol_new es8323_mono_adc_mux_controls =
/* Left Mixer */ static const struct snd_kcontrol_new es8323_left_mixer_controls[] = { - SOC_DAPM_SINGLE("Left Playback Switch", SND_SOC_NOPM, 7, 1, 1), + SOC_DAPM_SINGLE("Left Playback Switch", ES8323_DACCONTROL17, 7, 1, 0), SOC_DAPM_SINGLE("Left Bypass Switch", ES8323_DACCONTROL17, 6, 1, 0), };
/* Right Mixer */ static const struct snd_kcontrol_new es8323_right_mixer_controls[] = { - SOC_DAPM_SINGLE("Right Playback Switch", SND_SOC_NOPM, 6, 1, 1), + SOC_DAPM_SINGLE("Right Playback Switch", ES8323_DACCONTROL20, 7, 1, 0), SOC_DAPM_SINGLE("Right Bypass Switch", ES8323_DACCONTROL20, 6, 1, 0), };