From: Raffaele Tranfaglia via B4 Relay <devnull+raffaele.tranfaglia.gmail.com@kernel.org>
To: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
driver-core@lists.linux.dev, linux-sound@vger.kernel.org,
Neo Chang <YLCHANG2@nuvoton.com>,
Raffaele Tranfaglia <raffaele.tranfaglia@gmail.com>
Subject: [PATCH v2 1/3] ASoC: codecs: nau8360: set val_bits to the widest register size
Date: Wed, 25 Nov 2026 08:09:30 +0000 [thread overview]
Message-ID: <20261125-regmap-kunit-val-bits-v2-1-81db3b79cd3f@gmail.com> (raw)
In-Reply-To: <20261125-regmap-kunit-val-bits-v2-0-81db3b79cd3f@gmail.com>
From: Raffaele Tranfaglia <raffaele.tranfaglia@gmail.com>
The regmap is configured with val_bits = 16, but the two DSP registers
are 32 bits wide: nau8360_reg_write() sends four bytes for them, and the
DSP messages written with snd_soc_component_write() use all 32 bits.
This works because the driver provides its own reg_read() and
reg_write() and regmap passes the value through unmodified. As regmap is
going to mask values to val_bits, set it to 32, the size of the widest
register. The size of each access is still selected in the driver's
reg_read() and reg_write().
Signed-off-by: Raffaele Tranfaglia <raffaele.tranfaglia@gmail.com>
---
sound/soc/codecs/nau8360.c | 3 ++-
sound/soc/codecs/nau8360.h | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/nau8360.c b/sound/soc/codecs/nau8360.c
index f0942739d7ab..d4cab3c8e29d 100644
--- a/sound/soc/codecs/nau8360.c
+++ b/sound/soc/codecs/nau8360.c
@@ -1918,7 +1918,8 @@ static int nau8360_reg_read(void *context, unsigned int reg, unsigned int *value
static const struct regmap_config nau8360_regmap_config = {
.reg_bits = NAU8360_REG_ADDR_LEN,
- .val_bits = NAU8360_REG_DATA_LEN,
+ /* Codec registers are 16 bits wide, DSP registers are 32 bits wide */
+ .val_bits = 32,
.max_register = NAU8360_REG_MAX,
.readable_reg = nau8360_readable_reg,
diff --git a/sound/soc/codecs/nau8360.h b/sound/soc/codecs/nau8360.h
index 71396747c0fa..3d9711804073 100644
--- a/sound/soc/codecs/nau8360.h
+++ b/sound/soc/codecs/nau8360.h
@@ -123,9 +123,8 @@
#define NAU8360_RF002_DSP_COMM 0xf002
#define NAU8360_REG_MAX NAU8360_RF002_DSP_COMM
-/* 16-bit control register address, and 16-bits control register data */
+/* 16-bit control register address */
#define NAU8360_REG_ADDR_LEN 16
-#define NAU8360_REG_DATA_LEN 16
/* NAU8360_R03_CLK_CTRL0 (0x03) */
#define NAU8360_MCLK_DIV_SFT 10
--
2.56.0
next prev parent reply other threads:[~2026-11-25 8:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:09 [PATCH v2 0/3] regmap: handle values wider than val_bits consistently Raffaele Tranfaglia via B4 Relay
2026-11-25 8:09 ` Raffaele Tranfaglia via B4 Relay [this message]
2026-11-25 8:09 ` [PATCH v2 2/3] regmap: mask values to val_bits on write Raffaele Tranfaglia via B4 Relay
2026-11-25 8:09 ` [PATCH v2 3/3] regmap: kunit: add tests for values wider than val_bits Raffaele Tranfaglia via B4 Relay
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=20261125-regmap-kunit-val-bits-v2-1-81db3b79cd3f@gmail.com \
--to=devnull+raffaele.tranfaglia.gmail.com@kernel.org \
--cc=YLCHANG2@nuvoton.com \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=johan@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=rafael@kernel.org \
--cc=raffaele.tranfaglia@gmail.com \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®