All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhang Yi" <zhangyi@everest-semi.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/7] ASoC: codecs: ES8389: Modify volatile_register
Date: Tue, 09 Jun 2026 03:09:02 +0000	[thread overview]
Message-ID: <20260609030902.A5F1D1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609025605.16945-2-zhangyi@everest-semi.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Incomplete volatile register list leaves critical configuration un-cached, causing state loss on resume.
- [High] regmap cache is clobbered with hardware defaults during resume, nullifying the preservation of user settings.
--

commit 18a4d58b5b0816359115dead13dc5872d2f0a08a
Author: Zhang Yi <zhangyi@everest-semi.com>

ASoC: codecs: ES8389: Modify volatile_register

Mark some registers that are not volatile as false.

> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 449d9574b03a8..9c816491648c7 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
> @@ -50,10 +50,29 @@ static const char * const es8389_core_supplies[] = {
>  static bool es8389_volatile_register(struct device *dev,
>  			unsigned int reg)
>  {
> -	if ((reg  <= 0xff))
> -		return true;
> -	else
> +	switch (reg) {
> +	case ES8389_ADC_HPF1:
> +	case ES8389_ADC_HPF2:
> +	case ES8389_ADCL_VOL:
> +	case ES8389_ADCR_VOL:
> +	case ES8389_MIC1_GAIN:
> +	case ES8389_MIC2_GAIN:

[Severity: High]
This is a pre-existing issue, but does making these registers non-volatile
cause their cached user settings to be clobbered during resume?

In es8389_resume(), regcache_cache_bypass(es8389->regmap, false) is called
before invoking es8389_init():

sound/soc/codecs/es8389.c:es8389_resume() {
    ...
	regcache_cache_bypass(es8389->regmap, false);

	if (regv == 0xff)
		es8389_init(component);
    ...
}

Because caching is enabled during es8389_init(), its explicit writes to these
registers overwrite the user's settings in the regmap cache with hardware
defaults:

sound/soc/codecs/es8389.c:es8389_init() {
    ...
	regmap_write(es8389->regmap, ES8389_ADC_MUTE, 0xC0);
    ...
}

When regcache_sync() subsequently runs, it syncs these defaults instead of the
user's configuration, which silently mutes the microphone and resets its gain
upon every resume.

> +	case ES8389_DACL_VOL:
> +	case ES8389_DACR_VOL:
> +	case ES8389_ALC_ON:
> +	case ES8389_ALC_CTL:
> +	case ES8389_ALC_TARGET:
> +	case ES8389_ALC_GAIN:
> +	case ES8389_ADC_MUTE:
> +	case ES8389_OSR_VOL:
> +	case ES8389_DAC_INV:
> +	case ES8389_MIX_VOL:
> +	case ES8389_DAC_MIX:
> +	case ES8389_ADC_RESET:
>  		return false;
> +	default:
> +		return true;

[Severity: High]
This is a pre-existing issue, but does this default case incorrectly omit
essential configuration registers?

It leaves important configuration registers like ES8389_MASTER_MODE,
ES8389_ADC_MODE, ES8389_DMIC_EN, ES8389_ADC_FORMAT_MUTE, and
ES8389_DAC_FORMAT_MUTE as volatile.

Because volatile registers bypass the regmap cache, any user changes, such as
DAI formats and DAPM MUX selections, are not cached.

When es8389_init() writes default values to these registers, regcache_sync()
skips them, so the user's MUX and format configurations are never restored,
breaking audio routing.

> +	}
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609025605.16945-1-zhangyi@everest-semi.com?part=1

  reply	other threads:[~2026-06-09  3:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  2:55 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  2:55 ` [PATCH 1/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-09  3:09   ` sashiko-bot [this message]
2026-06-09  2:56 ` [PATCH 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
2026-06-09  3:11   ` sashiko-bot
2026-06-09  2:56 ` [PATCH 3/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
2026-06-09  3:09   ` sashiko-bot
2026-06-09  2:56 ` [PATCH 4/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
2026-06-09  2:56 ` [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-09  3:07   ` sashiko-bot
2026-06-09  2:56 ` [PATCH 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
2026-06-09  3:06   ` sashiko-bot
2026-06-09  2:56 ` [PATCH 7/7] ASoC: dt-bindings: ES8389: Add members about HPF Zhang Yi
2026-06-09  3:01   ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-06-09  3:06 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  3:06 ` [PATCH 1/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-09  3:17   ` sashiko-bot
2026-06-09  7:17 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  7:17 ` [PATCH 1/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-09  7:32   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609030902.A5F1D1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhangyi@everest-semi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.