From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@opensource.cirrus.com
Subject: [PATCH v4 1/3] ASoC: cs35l56-shared-test: Subtract reg_base offset in dummy regmap
Date: Thu, 21 May 2026 12:54:18 +0100 [thread overview]
Message-ID: <20260521115420.978616-2-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20260521115420.978616-1-rf@opensource.cirrus.com>
Subtract the value of cs35l56 regmap_config->reg_base from addresses
passed into the mock regmap bus.
Chip register addresses transferred over SoundWire are offset by 0x8000
to move them after the address range reserved in the SoundWire spec.
This commit prepares for changing the cs35l56-sdw driver to use
regmap_config->reg_base to add this offset. When that is done the
addresses passed into the mock regmap_bus will include this offset.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
Changes in V4:
- Move the dereference of regmap_config->reg_base inside the check that
regmap_config is not NULL.
(Reported by Dan Carpenter <error27@gmail.com>)
New in V3
sound/soc/codecs/cs35l56-shared-test.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/soc/codecs/cs35l56-shared-test.c b/sound/soc/codecs/cs35l56-shared-test.c
index cfe7938065f9..4f52c8a192e5 100644
--- a/sound/soc/codecs/cs35l56-shared-test.c
+++ b/sound/soc/codecs/cs35l56-shared-test.c
@@ -29,6 +29,7 @@ struct cs35l56_shared_test_priv {
struct faux_device *gpio_dev;
struct cs35l56_shared_test_mock_gpio *gpio_priv;
struct regmap *registers;
+ unsigned int reg_offset;
struct cs35l56_base *cs35l56_base;
u8 applied_pad_pull_state[CS35L56_MAX_GPIO];
};
@@ -194,6 +195,8 @@ static int cs35l56_shared_test_reg_read(void *context, unsigned int reg, unsigne
{
struct cs35l56_shared_test_priv *priv = context;
+ reg -= priv->reg_offset;
+
switch (reg) {
case CS35L56_SYNC_GPIO1_CFG ... CS35L56_ASP2_DIO_GPIO13_CFG:
case CS35L56_GPIO1_CTRL1 ... CS35L56_GPIO13_CTRL1:
@@ -214,6 +217,8 @@ static int cs35l56_shared_test_reg_write(void *context, unsigned int reg, unsign
{
struct cs35l56_shared_test_priv *priv = context;
+ reg -= priv->reg_offset;
+
switch (reg) {
case CS35L56_UPDATE_REGS:
return cs35l56_shared_test_updt_gpio_pres(priv, reg, val);
@@ -673,6 +678,7 @@ static int cs35l56_shared_test_case_base_init(struct kunit *test, u8 type, u8 re
priv->cs35l56_base->rev = rev;
if (regmap_config) {
+ priv->reg_offset = regmap_config->reg_base;
ret = cs35l56_shared_test_case_regmap_init(test, regmap_config);
if (ret)
return ret;
--
2.47.3
next prev parent reply other threads:[~2026-05-21 11:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 11:54 [PATCH v4 0/3] ASoC: cs35l56: Replace open-coded SoundWire regmap with generic regmap-sdw Richard Fitzgerald
2026-05-21 11:54 ` Richard Fitzgerald [this message]
2026-05-21 11:54 ` [PATCH v4 2/3] ASoC: cs35l56: Use reg_base to offset addresses on SoundWire Richard Fitzgerald
2026-05-21 11:54 ` [PATCH v4 3/3] ASoC: cs35l56: Use standard SoundWire regmap implementation Richard Fitzgerald
2026-05-21 23:17 ` [PATCH v4 0/3] ASoC: cs35l56: Replace open-coded SoundWire regmap with generic regmap-sdw 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=20260521115420.978616-2-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.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.