From: kr494167@gmail.com
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: chancel.liu@nxp.com, david.rhodes@cirrus.com,
rf@opensource.cirrus.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org,
Surendra Singh Chouhan <kr494167@gmail.com>
Subject: [PATCH] ASoC: cs42xx8: fix regmap SPI flag masks to target high byte
Date: Fri, 24 Jul 2026 18:31:28 +0530 [thread overview]
Message-ID: <20260724130128.76334-1-kr494167@gmail.com> (raw)
From: Surendra Singh Chouhan <kr494167@gmail.com>
cs42xx8_spi_probe() configures reg_bits=16 so regmap sends a 2-byte
address field over SPI big-endian. The SPI frame format requires the
chip address byte (0x9E for write, 0x9F for read) to be in the high
byte of the 16-bit address field and the register address in the low
byte:
write: [0x9E, MAP_addr, data]
read: [0x9F, MAP_addr] -> [data]
However, write_flag_mask was set to 0x9E and read_flag_mask to 0x9F.
Because 0x9E is a 16-bit value of 0x009E, regmap OR'd 0x9E into the
low byte (bits 7..0) of the address instead of the high byte (bits
15..8), corrupting the register address on the wire.
Fix this by setting write_flag_mask to 0x9E00 and read_flag_mask to
0x9F00.
Fixes: 3158f585f4f2 ("ASoC: cs42xx8: Add SPI bus support for CS42448/CS42888 codec")
Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
---
sound/soc/codecs/cs42xx8-spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/cs42xx8-spi.c b/sound/soc/codecs/cs42xx8-spi.c
index 2e4b8e6c4081..cf5e39a44f94 100644
--- a/sound/soc/codecs/cs42xx8-spi.c
+++ b/sound/soc/codecs/cs42xx8-spi.c
@@ -52,8 +52,8 @@ static int cs42xx8_spi_probe(struct spi_device *spi)
* write_flag_mask/read_flag_mask are OR'd into that address field:
*/
config.reg_bits = 16;
- config.write_flag_mask = 0x9E;
- config.read_flag_mask = 0x9F;
+ config.write_flag_mask = 0x9E00;
+ config.read_flag_mask = 0x9F00;
ret = cs42xx8_probe(&spi->dev,
devm_regmap_init_spi(spi, &config), drvdata);
--
2.55.0
reply other threads:[~2026-07-24 13:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260724130128.76334-1-kr494167@gmail.com \
--to=kr494167@gmail.com \
--cc=broonie@kernel.org \
--cc=chancel.liu@nxp.com \
--cc=david.rhodes@cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=rf@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