* [PATCH] ASoC: codecs: ES8389: Modify the startup configuration
@ 2026-12-04 8:20 Zhang Yi
2026-12-04 8:44 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Yi @ 2026-12-04 8:20 UTC (permalink / raw)
To: linux-sound, broonie; +Cc: tiwai, Zhang Yi
There is an occasional issue where the audio is silent during playback;
modify the startup configuration to resolve this issue.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 1a8e56506fe3..040ee141318a 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -840,10 +840,6 @@ static int es8389_set_bias_level(struct snd_soc_component *component,
regmap_update_bits(es8389->regmap, ES8389_HPSW, 0x20, 0x20);
regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0xD9);
- regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
- regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
- regmap_write(es8389->regmap, ES8389_RESET, 0x01);
- regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
break;
case SND_SOC_BIAS_PREPARE:
break;
@@ -876,13 +872,12 @@ static int es8389_mute(struct snd_soc_dai *dai, int mute, int direction)
} else {
regmap_read(es8389->regmap, ES8389_CSM_STATE1, ®v);
if (regv != ES8389_STATE_ON) {
- regmap_update_bits(es8389->regmap, ES8389_HPSW, 0x20, 0x20);
- regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0xD9);
- regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
- regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
- regmap_write(es8389->regmap, ES8389_RESET, 0x01);
- regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
+ regmap_write(es8389->regmap, ES8389_DAC_RESET, 0X02);
}
+ regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
+ regmap_write(es8389->regmap, ES8389_RESET, 0x01);
+ regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
+ regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
if (!es8389->version) {
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: codecs: ES8389: Modify the startup configuration
2026-12-04 8:20 [PATCH] ASoC: codecs: ES8389: Modify the startup configuration Zhang Yi
@ 2026-12-04 8:44 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 8:44 UTC (permalink / raw)
To: Zhang Yi, linux-sound
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] ASoC: es8389: split wakeup in es8389_set_bias_level() and
es8389_mute()
- [Medium] ASoC: es8389: es8389_mute() can hold active DAC in reset on
capture unmute
- [Medium] ASoC: es8389: es8389_mute() wakeup writes race with
es8389_standby()
- [Low] ASoC: es8389: commit message omits root cause and sequencing
rationale
--
commit b420db27eff9e9ee2261ee4c28eaded8c91efc65
Author: Zhang Yi <zhangyi@everest-semi.com>
> ASoC: codecs: ES8389: Modify the startup configuration
>
> There is an occasional issue where the audio is silent during playback;
> modify the startup configuration to resolve this issue.
>
> Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
[Severity: Low]
Could the commit message explain the root cause of the occasional silent
playback and why these register sequencing changes are needed? The patch
moves wakeup writes out of es8389_set_bias_level(), drops ES8389_HPSW and
ES8389_ANA_CTL1 from es8389_mute(), and adds an ES8389_DAC_RESET write.
> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 1a8e56506fe3a..040ee141318a1 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
> @@ -840,10 +840,6 @@ static int es8389_set_bias_level(struct snd_soc_component *component,
>
> regmap_update_bits(es8389->regmap, ES8389_HPSW, 0x20, 0x20);
> regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0xD9);
> - regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
> - regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
> - regmap_write(es8389->regmap, ES8389_RESET, 0x01);
> - regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
> break;
> case SND_SOC_BIAS_PREPARE:
> break;
[Severity: High]
Does removing these four writes from SND_SOC_BIAS_ON leave the codec stuck
in standby/reset on wakeup paths that do not call es8389_mute(0)?
es8389_standby() puts those four volatile registers into standby/reset, so
regcache_sync() never restores them. When an active capture stream resumes
from system suspend, snd_soc_card_resume_deferred() restores bias via DAPM
and only unmutes playback streams, leaving capture stuck in standby/reset.
Separately, dropping ES8389_HPSW and ES8389_ANA_CTL1 from es8389_mute()
while writing the wakeup registers unconditionally breaks codec-to-codec
playback links, where dapm_power_widgets() calls es8389_mute(0) before
SND_SOC_BIAS_ON, enabling digital blocks while mclk and analog bias are off.
> @@ -876,13 +872,12 @@ static int es8389_mute(struct snd_soc_dai *dai, int mute, int direction)
> } else {
> regmap_read(es8389->regmap, ES8389_CSM_STATE1, ®v);
> if (regv != ES8389_STATE_ON) {
> - regmap_update_bits(es8389->regmap, ES8389_HPSW, 0x20, 0x20);
> - regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0xD9);
> - regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
> - regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
> - regmap_write(es8389->regmap, ES8389_RESET, 0x01);
> - regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
> + regmap_write(es8389->regmap, ES8389_DAC_RESET, 0X02);
> }
[Severity: Medium]
Can unmuting a capture stream hold an active playback DAC in reset?
es8389_mute() writes ES8389_DAC_RESET = 0x02 before checking direction, but
only clears it back to 0x00 on the playback branch when !es8389->version.
At 88.2 or 96 kHz, es8389_pcm_hw_params() writes 0xC0 into bits [7:6] of
ES8389_CSM_STATE1, so an unmasked check on capture unmute silences playback.
> + regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xE4);
> + regmap_write(es8389->regmap, ES8389_RESET, 0x01);
> + regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0xC3);
> + regmap_write(es8389->regmap, ES8389_ADC_EN, 0x8F);
[Severity: Medium]
Can these wakeup writes in es8389_mute() race with es8389_standby()?
Previously these writes ran in es8389_set_bias_level(SND_SOC_BIAS_ON) under
card->dapm_mutex. Now __soc_pcm_prepare() calls es8389_mute(0) under
card->pcm_mutex after snd_soc_dapm_stream_event() releases dapm_mutex,
racing with a concurrent snd_soc_dapm_sync() entering es8389_standby():
CPU0 CPU1
soc_pcm_prepare() snd_soc_dapm_sync()
lock(card->pcm_mutex) lock(card->dapm_mutex)
snd_soc_dapm_stream_event() ...
/* acquires & releases dapm_mutex */ es8389_standby()
es8389_mute(0) write ES8389_CSM_JUMP = 0xD4
write ES8389_CSM_JUMP = 0xE4 usleep_range(70000, 72000)
write ES8389_RESET = 0x01
write ES8389_CLK_OFF1 = 0xC3
write ES8389_ADC_EN = 0x8F
write ES8389_ANA_CTL1 = 0x59
write ES8389_ADC_EN = 0x00
write ES8389_CLK_OFF1 = 0x00
write ES8389_RESET = 0x3E
clk_disable_unprepare(mclk)
<-- active stream left in reset
In the reverse order, es8389_mute() re-enables CSM, clocks, digital core,
and ADC after es8389_standby() and clk_disable_unprepare() have powered down
analog bias and mclk.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204082056.4430-1-zhangyi@everest-semi.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 8:20 [PATCH] ASoC: codecs: ES8389: Modify the startup configuration Zhang Yi
2026-12-04 8:44 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox