All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Richard Fitzgerald" <rf@opensource.cirrus.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH RESEND 4/4] ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers
Date: Wed, 25 Nov 2026 11:20:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-233220@kernel.org> (raw)
In-Reply-To: <20261125110853.741337-5-rf@opensource.cirrus.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: cs35l56: missing SDW mux call to
  cs35l56_test_fill_register_range()
--

commit 6abf5b53b66d893e6ef45aa41f1e494247ead199
Author: Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers

This commit adds a KUnit test verifying that probing the cs35l56 component
does not write to the SoundWire TX mux registers directly or via a
subsequent regcache_sync().

> diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-test.c
> index b422d19ba0b21..362da30b949e6 100644
> --- a/sound/soc/codecs/cs35l56-test.c
> +++ b/sound/soc/codecs/cs35l56-test.c

[ ... ]

> @@ -929,6 +938,79 @@ static void cs35l56_test_component_probe_omits_asp(struct kunit *test)
>  	KUNIT_EXPECT_FALSE(test, priv->asp_mixer_regs_written);
>  }
>  
> +/*
> + * Probing the component must not write the SoundWire TX mux registers,
> + * either directly or through a subsequent regcache_sync().
> + */
> +static void cs35l56_test_component_probe_omits_sdw_mux(struct kunit *test)
> +{
> +	struct cs35l56_test_priv *priv = test->priv;
> +	struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
> +	struct snd_soc_card *card = cs35l56->component->card;
> +	struct snd_soc_aux_dev *aux;
> +	struct faux_device *card_dev;
> +
> +	cs35l56_test_create_mock_supplies(test);
> +	cs35l56_test_create_mock_device_registers(test);

[ ... ]

> +	/*
> +	 * Flush cache to ensure there aren't cached values for the SoundWire muxes.
> +	 * The first case without regcache_mark_dirty() tests flushing when
> +	 * hardware registers have not reset, and requires a dummy write to
> +	 * the cache to make it dirty.
> +	 */
> +	regcache_cache_only(cs35l56->base.regmap, true);
> +	KUNIT_ASSERT_EQ(test, 0, regmap_write(cs35l56->base.regmap,
> +					      CS35L56_DSP_VIRTUAL1_MBOX_1, 0));
> +	regcache_cache_only(cs35l56->base.regmap, false);
> +	KUNIT_ASSERT_EQ(test, 0, regcache_sync(cs35l56->base.regmap));
> +	regcache_mark_dirty(cs35l56->base.regmap);
> +	KUNIT_ASSERT_EQ(test, 0, regcache_sync(cs35l56->base.regmap));
> +
> +	KUNIT_EXPECT_FALSE(test, priv->sdw_mux_regs_written);
> +}

[Severity: Medium]
Should cs35l56_test_create_mock_device_registers() also pre-populate
cs35l56_test_sdw_mux_registers_range with
cs35l56_test_fill_register_range()?

priv->registers is in cache-only mode, and the CS35L56_SWIRE_DP3_CH?_INPUT
registers are only filled for ASP ranges:

sound/soc/codecs/cs35l56-test.c:cs35l56_test_create_mock_device_registers() {
	...
	cs35l56_test_fill_register_range(test, &cs35l56_test_asp_config_registers_range, 0);
	cs35l56_test_fill_register_range(test, &cs35l56_test_asp_mixer_registers_range, 0);
}

Without pre-populating cs35l56_test_sdw_mux_registers_range, any read of
the SoundWire mux registers during probe (for example, via dapm_read()
when initializing mux widgets) fails with -EBUSY in
cs35l56_test_mock_registers_read().  _regmap_read() then skips caching the
value in cs35l56->base.regmap, so the subsequent regcache_sync() test will
silently pass instead of catching a read that populated the cache.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125110853.741337-1-rf@opensource.cirrus.com?part=4

  reply	other threads:[~2026-11-25 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:08 [PATCH RESEND 0/4] ASoC: cs35l56: Prepare for SDCA Companion Amp Richard Fitzgerald
2026-11-25 11:08 ` [PATCH RESEND 1/4] ASoC: cs35l56: Remove SDW1 TX source controls and widgets Richard Fitzgerald
2026-11-25 11:29   ` sashiko-bot
2026-11-25 11:08 ` [PATCH RESEND 2/4] ASoC: cs35l56: Rename the DP3 DAI to cs35l56-ot127 Richard Fitzgerald
2026-11-25 11:08 ` [PATCH RESEND 3/4] ASoC: cs35l56: Eliminate trivial regmap patch Richard Fitzgerald
2026-11-25 11:08 ` [PATCH RESEND 4/4] ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers Richard Fitzgerald
2026-11-25 11:20   ` sashiko-bot [this message]
2026-11-25 11:24   ` Richard Fitzgerald
2026-11-25 12:39     ` Mark Brown
2026-11-25 13:26       ` Richard Fitzgerald
2026-11-25 14:03         ` 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=sashiko-outbox-233220@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=rf@opensource.cirrus.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.