Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhang Yi" <zhangyi@everest-semi.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF
Date: Tue, 09 Jun 2026 03:07:20 +0000	[thread overview]
Message-ID: <20260609030721.228B71F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609025605.16945-6-zhangyi@everest-semi.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] User-configured ALSA controls are silently clobbered with hardcoded defaults during resume from suspend, leading to state desynchronization.
--

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

ASoC: codecs: ES8389: Add private members related to HPF
    
Add private members related to HPF.
And defines ES8389_HPF_DEFAULT

> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 8e47b4e3214e0..d1bcbbfcd4754 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c

[ ... ]

> @@ -742,8 +744,8 @@ static int es8389_mute(struct snd_soc_dai *dai, int mute, int direction)
>  			regmap_update_bits(es8389->regmap, ES8389_DAC_FORMAT_MUTE,
>  						0x03, 0x00);
>  		} else {
> -			regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, 0x0a);
> -			regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, 0x0a);
> +			regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, es8389->hpfl);
> +			regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, es8389->hpfr);

[Severity: High]
Does this interact safely with the resume path?

If the "ASoC: codecs: ES8389: Modify volatile_register" patch in this series
marks control registers (like ES8389_ADC_HPF2, ES8389_DAC_INV, and
ES8389_ADC_MUTE) as non-volatile, they are placed into the regmap cache for
restoration across suspend/resume.

However, in es8389_resume(), regcache_cache_bypass() is disabled before
calling es8389_init():

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

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

es8389_init() then uses regmap_write() to forcefully initialize these
registers with hardcoded defaults. Because the cache is active, these writes
will overwrite the user's previously set values in the regcache:

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

When regcache_sync() executes immediately afterward in es8389_resume(), it
syncs this clobbered cache to the hardware.

Could this cause user-configured ALSA controls (such as silent unmute of the
ADC OSR Volume Switch, clearing output inversions) to be permanently lost on
resume without any ALSA events being generated?

>  			regmap_update_bits(es8389->regmap, ES8389_ADC_FORMAT_MUTE,
>  						0x03, 0x00);
>  		}

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

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

Thread overview: 15+ 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
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 [this message]
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 5/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi

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=20260609030721.228B71F00893@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox