public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: sebastian.krzyszkowiak@puri.sm
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@puri.sm
Subject: Re: [PATCH RESEND 4/4] ASoC: wm8962: Don't mark WM8962_ADDITIONAL_CONTROL_4 as volatile
Date: Tue, 6 Jan 2026 14:11:44 +0000	[thread overview]
Message-ID: <aV0YIN7OxIElQ5dm@opensource.cirrus.com> (raw)
In-Reply-To: <20260105-wm8962-l5-fixes-v1-4-f4f4eeacf089@puri.sm>

On Mon, Jan 05, 2026 at 04:02:11AM +0100, Sebastian Krzyszkowiak via B4 Relay wrote:
> From: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
> 
> Only some bits of that register are actually volatile, so to prevent issues
> with caching let's simply bypass the cache explicitly when we access these
> particular bits.
> 
> This fixes mic-cfg value not being reapplied after runtime resume.
> 
> Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
> ---
>  sound/soc/codecs/wm8962.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index dd73b4dc1b97..22101284c095 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -793,7 +793,6 @@ static bool wm8962_volatile_register(struct device *dev, unsigned int reg)
>  	case WM8962_CLOCKING1:
>  	case WM8962_SOFTWARE_RESET:
>  	case WM8962_THERMAL_SHUTDOWN_STATUS:
> -	case WM8962_ADDITIONAL_CONTROL_4:
>  	case WM8962_DC_SERVO_6:
>  	case WM8962_INTERRUPT_STATUS_1:
>  	case WM8962_INTERRUPT_STATUS_2:
> @@ -3074,7 +3073,9 @@ static void wm8962_mic_work(struct work_struct *work)
>  	int irq_pol = 0;
>  	int reg;
>  
> +	regcache_cache_bypass(wm8962->regmap, true);
>  	reg = snd_soc_component_read(component, WM8962_ADDITIONAL_CONTROL_4);
> +	regcache_cache_bypass(wm8962->regmap, false);

Ah the glory of registers with a mix of configuration and status
bits, love those :-)

Alas I don't think this is safe, the trouble is the cache bypass
applies to the whole register map, so any alsa control write can
slip into the window where you have the cache bypassed and
accidentally be done as a bypassed write.

Fortunately, Richard added a regmap_read_bypassed() fairly recently
which does everything under the regmap lock, so update to use
that and you should be good.

Thanks,
Charles

  reply	other threads:[~2026-01-06 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  3:02 [PATCH RESEND 0/4] sound: codecs: wm8962: Assorted fixes Sebastian Krzyszkowiak via B4 Relay
2026-01-05  3:02 ` [PATCH RESEND 1/4] ASoC: wm8962: Add WM8962_ADC_MONOMIX to "3D Coefficients" mask Sebastian Krzyszkowiak via B4 Relay
2026-01-06 13:29   ` Charles Keepax
2026-01-05  3:02 ` [PATCH RESEND 2/4] ASoC: wm8962: Don't disable SYSCLK if it's enabled via DAPM Sebastian Krzyszkowiak via B4 Relay
2026-01-06 14:30   ` Charles Keepax
2026-01-05  3:02 ` [PATCH RESEND 3/4] ASoC: wm8962: Don't report a microphone if it's shorted to ground on plug Sebastian Krzyszkowiak via B4 Relay
2026-01-06 14:02   ` Charles Keepax
2026-01-05  3:02 ` [PATCH RESEND 4/4] ASoC: wm8962: Don't mark WM8962_ADDITIONAL_CONTROL_4 as volatile Sebastian Krzyszkowiak via B4 Relay
2026-01-06 14:11   ` Charles Keepax [this message]
2026-01-05  3:09 ` [PATCH RESEND 0/4] sound: codecs: wm8962: Assorted fixes Sebastian Krzyszkowiak
2026-01-13 13:50 ` (subset) " Mark Brown

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=aV0YIN7OxIElQ5dm@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=kernel@puri.sm \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=sebastian.krzyszkowiak@puri.sm \
    --cc=tiwai@suse.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