From: sashiko-bot@kernel.org
To: "Richard Fitzgerald" <rf@opensource.cirrus.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/2] ASoC: cs35l56: Add KUnit test that widget init doesn't write ASP registers
Date: Tue, 17 Nov 2026 13:23:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-218869@kernel.org> (raw)
In-Reply-To: <20261117125937.658976-2-rf@opensource.cirrus.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: cs35l56: unpopulated mock ASP regs prevent read caching
in test
--
commit df48b571346ca1593755186a19b76f7e8aefd40b
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
ASoC: cs35l56: Add KUnit test that widget init doesn't write ASP registers
This commit adds a KUnit test with a cache-only mock regmap and dummy
regulators to verify that probing the cs35l56 component as an auxiliary
device does not write to the ASP config or mixer registers during probe or
subsequent regcache syncs.
> diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-test.c
> index b58df099bf726..eda2f8ae6f21f 100644
> --- a/sound/soc/codecs/cs35l56-test.c
> +++ b/sound/soc/codecs/cs35l56-test.c
[ ... ]
> @@ -79,6 +95,211 @@ static const struct software_node *cs35l56_test_dev_and_af01_node_group[] = {
> NULL
> };
>
> +/* Some mocked registers need default values for driver init to work */
> +static const struct reg_default cs35l56_test_mock_reg_defaults[] = {
> + { CS35L56_OTPID, 0x00000003 },
> + { CS35L56_IRQ1_STATUS, 0x00000000 },
> + { CS35L56_IRQ1_MASK_1, 0x83ffffff },
> + { CS35L56_IRQ1_MASK_8, 0xfc000fff },
> + { CS35L56_DSP_VIRTUAL1_MBOX_1, 0x00000000 },
> + { CS35L56_DIE_STS1, 0x00000000 },
> + { CS35L56_DIE_STS2, 0x00000000 },
> + { CS35L56_DSP_RESTRICT_STS1, 0x00000000 },
> + { CS35L56_OTP_MEM_53, 0x00000000 },
> + { CS35L56_OTP_MEM_54, 0x00000000 },
> + { CS35L56_OTP_MEM_55, 0x00000000 },
> + { CS35L56_DSP1_FW_VER, 0x00040710 },
> + { CS35L63_PROTECTION_STATUS, 0x00000000 },
> + { CS35L56_PROTECTION_STATUS, 0x00000000 },
> +};
> +
> +/* Trap the entire ASP address space, not only particular registers */
> +static const struct range cs35l56_test_asp_config_registers_range = {
> + .start = 0x4800,
> + .end = 0x48ff,
> +};
> +
> +static const struct range cs35l56_test_asp_mixer_registers_range = {
> + .start = CS35L56_ASP1TX1_INPUT,
> + .end = CS35L56_ASP1TX4_INPUT,
> +};
> +
> +
> +static int cs35l56_test_mock_registers_read(void *context,
> + const void *reg_buf, size_t reg_size,
> + void *val_buf, size_t val_size)
> +{
[ ... ]
> + for (i = 0; i < val_size; i += sizeof(u32), reg += sizeof(u32)) {
> + ret = regmap_read(priv->registers, reg, &val);
> + if (ret)
> + return ret;
> +
> + put_unaligned_be32(val, buf + i);
> + }
> +
> + return 0;
> +}
[Severity: Medium]
Can cs35l56_test_mock_registers_read() ever succeed on an unwritten ASP
config or ASP mixer register when priv->registers is in cache-only mode and
cs35l56_test_mock_reg_defaults has no entries for those ranges?
When the driver reads an uncached ASP register through cs35l56->base.regmap
(for example during DAPM widget initialization), regmap_read(priv->registers,
reg, &val) returns -EBUSY. Because _regmap_read() only calls
regcache_write() when map->reg_read() returns 0, the read fails to populate
cs35l56->base.regmap's cache (and dapm_read() ignores the error), so the
subsequent regcache_sync() calls in cs35l56_test_component_probe_omits_asp()
will never flush those registers or set priv->asp_config_regs_written or
priv->asp_mixer_regs_written. Unchecked regmap_update_bits() calls on ASP
registers also fail at the initial read before reaching
cs35l56_test_mock_registers_write().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117125937.658976-1-rf@opensource.cirrus.com?part=1
next prev parent reply other threads:[~2026-11-17 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:59 [PATCH 0/2] ASoC: cs35l56: KUnit tests for ASP register write blocking Richard Fitzgerald
2026-11-17 12:59 ` [PATCH 1/2] ASoC: cs35l56: Add KUnit test that widget init doesn't write ASP registers Richard Fitzgerald
2026-11-17 13:23 ` sashiko-bot [this message]
2026-11-17 14:22 ` Richard Fitzgerald
2026-11-17 14:56 ` Mark Brown
2026-11-17 12:59 ` [PATCH 2/2] ASoC: cs35l56-shared: Add KUnit test cases for ASP config register writes Richard Fitzgerald
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-218869@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox