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 2/3] ASoC: cs35l56: Use reg_base to offset addresses on SoundWire
Date: Thu, 21 May 2026 12:54:19 +0100 [thread overview]
Message-ID: <20260521115420.978616-3-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20260521115420.978616-1-rf@opensource.cirrus.com>
Set the reg_base member of regmap_config for SoundWire so that
the regmap core will apply the 0x8000 offset to addresses, instead
of doing it within our low-level regmap read/write callbacks.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
No changes in V4
No changes in V3
No changes in V2
sound/soc/codecs/cs35l56-sdw.c | 7 +------
sound/soc/codecs/cs35l56-shared.c | 2 ++
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c
index d5b9e5f71de2..d9dcca1e952f 100644
--- a/sound/soc/codecs/cs35l56-sdw.c
+++ b/sound/soc/codecs/cs35l56-sdw.c
@@ -59,8 +59,6 @@ static int cs35l56_sdw_slow_read(struct sdw_slave *peripheral, unsigned int reg,
{
int ret, i;
- reg += CS35L56_SDW_ADDR_OFFSET;
-
for (i = 0; i < val_size; i += sizeof(u32)) {
/* Poll for bus bridge idle */
ret = cs35l56_sdw_poll_mem_status(peripheral,
@@ -123,11 +121,9 @@ static int cs35l56_sdw_read(void *context, const void *reg_buf,
reg = le32_to_cpu(*(const __le32 *)reg_buf);
- if (cs35l56_is_otp_register(reg))
+ if (cs35l56_is_otp_register(reg - CS35L56_SDW_ADDR_OFFSET))
return cs35l56_sdw_slow_read(peripheral, reg, buf8, val_size);
- reg += CS35L56_SDW_ADDR_OFFSET;
-
if (val_size == 4)
return cs35l56_sdw_read_one(peripheral, reg, val_buf);
@@ -186,7 +182,6 @@ static int cs35l56_sdw_gather_write(void *context,
int ret;
reg = le32_to_cpu(*(const __le32 *)reg_buf);
- reg += CS35L56_SDW_ADDR_OFFSET;
if (val_size == 4)
return cs35l56_sdw_write_one(peripheral, reg, src_be);
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 795e2764d67e..8e3538e28fad 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -1880,6 +1880,7 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_regmap_spi, "SND_SOC_CS35L56_SHARED");
const struct regmap_config cs35l56_regmap_sdw = {
.reg_bits = 32,
+ .reg_base = 0x8000,
.val_bits = 32,
.reg_stride = 4,
.reg_format_endian = REGMAP_ENDIAN_LITTLE,
@@ -1915,6 +1916,7 @@ const struct regmap_config cs35l63_regmap_sdw = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
+ .reg_base = 0x8000,
.reg_format_endian = REGMAP_ENDIAN_LITTLE,
.val_format_endian = REGMAP_ENDIAN_BIG,
.max_register = CS35L56_DSP1_PMEM_5114,
--
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 ` [PATCH v4 1/3] ASoC: cs35l56-shared-test: Subtract reg_base offset in dummy regmap Richard Fitzgerald
2026-05-21 11:54 ` Richard Fitzgerald [this message]
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-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox