[PATCH v3 2/3] ASoC: cs35l56: Use reg_base to offset addresses on SoundWire

From: Richard Fitzgerald

Date: Tue May 19 2026 - 09:59:05 EST


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@xxxxxxxxxxxxxxxxxxxxx>
---
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