[PATCH] ASoC: es9039q2m: Enable the DAC clock at component probe

From: Karl Asseily

Date: Wed Nov 18 2026 - 09:27:57 EST


es9039q2m_suspend() gates the part's internal clock tree by clearing
ENABLE_DAC_CLK in register 1, bypassing the cache so that
regcache_sync() sets it again on resume. The part keeps its registers
through a warm reset - only removing power clears them - so a reset
while the system is suspended skips the resume and leaves the bit clear
for the next boot.

Nothing in the driver sets it again. The register cache has no
defaults, so the first access to register 1 at probe reads the gated
value from the part and caches it, and every later suspend/resume cycle
restores that same value. A stream then runs as far as ALSA can tell,
but the part automutes both channels and the analogue output stays
silent until power is removed. Boards that remove the supplies in
suspend reset the part and are not affected.

Set ENABLE_DAC_CLK at component probe, after the mute and before the
datapath is enabled. Of the two writes the driver makes behind the
cache, this is the one probe did not already repeat; the other is the
mute at resume. On a part that came up from power the bit is already
set and the write changes nothing.

Tested on an RK3588 board whose ES9039Q2M is clocked by a fixed
24.576 MHz oscillator: suspend, reset while asleep, then play a 1 kHz
tone. Without this patch register 1 reads 0x35 where 0xb5 is expected,
both Automute Active controls read 1, and nothing is heard; setting
ENABLE_DAC_CLK by hand mid-stream clears both at once and the tone
comes back. With this patch the same sequence reads 0 on both controls
and the tone is heard, and a part left gated before the fix was
installed recovers on the next warm boot without power being removed.

Fixes: 004e260a5475 ("ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver")
Signed-off-by: Karl Asseily <karl@xxxxxxxxxxx>
---

Notes:
Tool use (Documentation/process/generated-content.rst): the cause was
traced, and this patch and its changelog written, with an LLM - Claude
Opus 5.5, in Claude Code. The fault was found, reproduced and the fix
tested on my board, as described above.

sound/soc/codecs/es9039q2m.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/es9039q2m.c b/sound/soc/codecs/es9039q2m.c
index 2a451dfcc..e3f963909 100644
--- a/sound/soc/codecs/es9039q2m.c
+++ b/sound/soc/codecs/es9039q2m.c
@@ -1634,6 +1634,18 @@ static int es9039q2m_component_probe(struct snd_soc_component *component)
if (ret)
return ret;

+ /*
+ * Turn the DAC clock on. It is set at power-up, but suspend clears it
+ * and only resume sets it again, and a reset while asleep skips the
+ * resume without resetting this part. It then comes back gated: the
+ * stream runs, the part automutes, and the analogue output is silent
+ * until power is removed.
+ */
+ ret = regmap_update_bits(priv->regmap, ES9039_SYS_MODE,
+ ES9039_ENABLE_DAC_CLK, ES9039_ENABLE_DAC_CLK);
+ if (ret)
+ return ret;
+
/*
* Enable the datapath. SYSTEM_CONFIG[1] is clear at reset, so in
* software mode nothing turns the DAC on at power-up: the analogue
--
2.47.3