* [PATCH] ASoC: adau1761: sort the register default table
@ 2026-08-05 12:27 Peter Ujfalusi
2026-08-05 13:30 ` Nuno Sá
2026-08-05 16:40 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2026-08-05 12:27 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Lars-Peter Clausen, Nuno Sá
Cc: linux-sound, stable
reg_defaults must be sorted by ascending register address, as
regcache_lookup_reg() locates entries in it with bsearch(). See commit
fd80df352ba1 ("regcache: Add support for sorting defaults arrays").
The table lists the ADAU1761 specific registers (0x4008 and up) before
the block shared with the ADAU1381/ADAU1781, which starts at
ADAU17X1_CLOCK_CONTROL (0x4000), so bsearch() descends into the wrong
half and 28 of the 52 entries are unreachable.
regcache_reg_needs_sync() then cannot compare them against their default
and reports that a sync is needed, so they are written to the device on
every regcache_sync() even when they were never touched.
Sort the table by register address.
Fixes: dab464b60b24 ("ASoC: Add ADAU1361/ADAU1761 audio CODEC support")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/codecs/adau1761.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c
index a70c46dd5d76..27ce03b0fb91 100644
--- a/sound/soc/codecs/adau1761.c
+++ b/sound/soc/codecs/adau1761.c
@@ -68,23 +68,33 @@
#define ADAU1761_FIRMWARE "adau1761.bin"
static const struct reg_default adau1761_reg_defaults[] = {
- { ADAU1761_DEJITTER, 0x03 },
+ { ADAU17X1_CLOCK_CONTROL, 0x00 },
+ { ADAU17X1_PLL_CONTROL, 0x00 },
{ ADAU1761_DIGMIC_JACKDETECT, 0x00 },
+ { ADAU17X1_REC_POWER_MGMT, 0x00 },
{ ADAU1761_REC_MIXER_LEFT0, 0x00 },
{ ADAU1761_REC_MIXER_LEFT1, 0x00 },
{ ADAU1761_REC_MIXER_RIGHT0, 0x00 },
{ ADAU1761_REC_MIXER_RIGHT1, 0x00 },
{ ADAU1761_LEFT_DIFF_INPUT_VOL, 0x00 },
+ { ADAU1761_RIGHT_DIFF_INPUT_VOL, 0x00 },
+ { ADAU17X1_MICBIAS, 0x00 },
{ ADAU1761_ALC_CTRL0, 0x00 },
{ ADAU1761_ALC_CTRL1, 0x00 },
{ ADAU1761_ALC_CTRL2, 0x00 },
{ ADAU1761_ALC_CTRL3, 0x00 },
- { ADAU1761_RIGHT_DIFF_INPUT_VOL, 0x00 },
- { ADAU1761_PLAY_LR_MIXER_LEFT, 0x00 },
+ { ADAU17X1_SERIAL_PORT0, 0x00 },
+ { ADAU17X1_SERIAL_PORT1, 0x00 },
+ { ADAU17X1_CONVERTER0, 0x00 },
+ { ADAU17X1_CONVERTER1, 0x00 },
+ { ADAU17X1_ADC_CONTROL, 0x00 },
+ { ADAU17X1_LEFT_INPUT_DIGITAL_VOL, 0x00 },
+ { ADAU17X1_RIGHT_INPUT_DIGITAL_VOL, 0x00 },
{ ADAU1761_PLAY_MIXER_LEFT0, 0x00 },
{ ADAU1761_PLAY_MIXER_LEFT1, 0x00 },
{ ADAU1761_PLAY_MIXER_RIGHT0, 0x00 },
{ ADAU1761_PLAY_MIXER_RIGHT1, 0x00 },
+ { ADAU1761_PLAY_LR_MIXER_LEFT, 0x00 },
{ ADAU1761_PLAY_LR_MIXER_RIGHT, 0x00 },
{ ADAU1761_PLAY_MIXER_MONO, 0x00 },
{ ADAU1761_PLAY_HP_LEFT_VOL, 0x00 },
@@ -93,20 +103,6 @@ static const struct reg_default adau1761_reg_defaults[] = {
{ ADAU1761_PLAY_LINE_RIGHT_VOL, 0x00 },
{ ADAU1761_PLAY_MONO_OUTPUT_VOL, 0x00 },
{ ADAU1761_POP_CLICK_SUPPRESS, 0x00 },
- { ADAU1761_JACK_DETECT_PIN, 0x00 },
- { ADAU1761_CLK_ENABLE0, 0x00 },
- { ADAU1761_CLK_ENABLE1, 0x00 },
- { ADAU17X1_CLOCK_CONTROL, 0x00 },
- { ADAU17X1_PLL_CONTROL, 0x00 },
- { ADAU17X1_REC_POWER_MGMT, 0x00 },
- { ADAU17X1_MICBIAS, 0x00 },
- { ADAU17X1_SERIAL_PORT0, 0x00 },
- { ADAU17X1_SERIAL_PORT1, 0x00 },
- { ADAU17X1_CONVERTER0, 0x00 },
- { ADAU17X1_CONVERTER1, 0x00 },
- { ADAU17X1_LEFT_INPUT_DIGITAL_VOL, 0x00 },
- { ADAU17X1_RIGHT_INPUT_DIGITAL_VOL, 0x00 },
- { ADAU17X1_ADC_CONTROL, 0x00 },
{ ADAU17X1_PLAY_POWER_MGMT, 0x00 },
{ ADAU17X1_DAC_CONTROL0, 0x00 },
{ ADAU17X1_DAC_CONTROL1, 0x00 },
@@ -114,12 +110,16 @@ static const struct reg_default adau1761_reg_defaults[] = {
{ ADAU17X1_SERIAL_PORT_PAD, 0xaa },
{ ADAU17X1_CONTROL_PORT_PAD0, 0xaa },
{ ADAU17X1_CONTROL_PORT_PAD1, 0x00 },
+ { ADAU1761_JACK_DETECT_PIN, 0x00 },
+ { ADAU1761_DEJITTER, 0x03 },
{ ADAU17X1_DSP_SAMPLING_RATE, 0x01 },
{ ADAU17X1_SERIAL_INPUT_ROUTE, 0x00 },
{ ADAU17X1_SERIAL_OUTPUT_ROUTE, 0x00 },
{ ADAU17X1_DSP_ENABLE, 0x00 },
{ ADAU17X1_DSP_RUN, 0x00 },
{ ADAU17X1_SERIAL_SAMPLING_RATE, 0x00 },
+ { ADAU1761_CLK_ENABLE0, 0x00 },
+ { ADAU1761_CLK_ENABLE1, 0x00 },
};
static const DECLARE_TLV_DB_SCALE(adau1761_sing_in_tlv, -1500, 300, 1);
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: adau1761: sort the register default table
2026-08-05 12:27 [PATCH] ASoC: adau1761: sort the register default table Peter Ujfalusi
@ 2026-08-05 13:30 ` Nuno Sá
2026-08-05 16:40 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Nuno Sá @ 2026-08-05 13:30 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: Mark Brown, Liam Girdwood, Lars-Peter Clausen, Nuno Sá,
linux-sound, stable
On Wed, Aug 05, 2026 at 03:27:13PM +0300, Peter Ujfalusi wrote:
> reg_defaults must be sorted by ascending register address, as
> regcache_lookup_reg() locates entries in it with bsearch(). See commit
> fd80df352ba1 ("regcache: Add support for sorting defaults arrays").
>
> The table lists the ADAU1761 specific registers (0x4008 and up) before
> the block shared with the ADAU1381/ADAU1781, which starts at
> ADAU17X1_CLOCK_CONTROL (0x4000), so bsearch() descends into the wrong
> half and 28 of the 52 entries are unreachable.
> regcache_reg_needs_sync() then cannot compare them against their default
> and reports that a sync is needed, so they are written to the device on
> every regcache_sync() even when they were never touched.
>
> Sort the table by register address.
>
> Fixes: dab464b60b24 ("ASoC: Add ADAU1361/ADAU1761 audio CODEC support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
> ---
Acked-by: Nuno Sá <nuno.sa@analog.com>
> sound/soc/codecs/adau1761.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c
> index a70c46dd5d76..27ce03b0fb91 100644
> --- a/sound/soc/codecs/adau1761.c
> +++ b/sound/soc/codecs/adau1761.c
> @@ -68,23 +68,33 @@
> #define ADAU1761_FIRMWARE "adau1761.bin"
>
> static const struct reg_default adau1761_reg_defaults[] = {
> - { ADAU1761_DEJITTER, 0x03 },
> + { ADAU17X1_CLOCK_CONTROL, 0x00 },
> + { ADAU17X1_PLL_CONTROL, 0x00 },
> { ADAU1761_DIGMIC_JACKDETECT, 0x00 },
> + { ADAU17X1_REC_POWER_MGMT, 0x00 },
> { ADAU1761_REC_MIXER_LEFT0, 0x00 },
> { ADAU1761_REC_MIXER_LEFT1, 0x00 },
> { ADAU1761_REC_MIXER_RIGHT0, 0x00 },
> { ADAU1761_REC_MIXER_RIGHT1, 0x00 },
> { ADAU1761_LEFT_DIFF_INPUT_VOL, 0x00 },
> + { ADAU1761_RIGHT_DIFF_INPUT_VOL, 0x00 },
> + { ADAU17X1_MICBIAS, 0x00 },
> { ADAU1761_ALC_CTRL0, 0x00 },
> { ADAU1761_ALC_CTRL1, 0x00 },
> { ADAU1761_ALC_CTRL2, 0x00 },
> { ADAU1761_ALC_CTRL3, 0x00 },
> - { ADAU1761_RIGHT_DIFF_INPUT_VOL, 0x00 },
> - { ADAU1761_PLAY_LR_MIXER_LEFT, 0x00 },
> + { ADAU17X1_SERIAL_PORT0, 0x00 },
> + { ADAU17X1_SERIAL_PORT1, 0x00 },
> + { ADAU17X1_CONVERTER0, 0x00 },
> + { ADAU17X1_CONVERTER1, 0x00 },
> + { ADAU17X1_ADC_CONTROL, 0x00 },
> + { ADAU17X1_LEFT_INPUT_DIGITAL_VOL, 0x00 },
> + { ADAU17X1_RIGHT_INPUT_DIGITAL_VOL, 0x00 },
> { ADAU1761_PLAY_MIXER_LEFT0, 0x00 },
> { ADAU1761_PLAY_MIXER_LEFT1, 0x00 },
> { ADAU1761_PLAY_MIXER_RIGHT0, 0x00 },
> { ADAU1761_PLAY_MIXER_RIGHT1, 0x00 },
> + { ADAU1761_PLAY_LR_MIXER_LEFT, 0x00 },
> { ADAU1761_PLAY_LR_MIXER_RIGHT, 0x00 },
> { ADAU1761_PLAY_MIXER_MONO, 0x00 },
> { ADAU1761_PLAY_HP_LEFT_VOL, 0x00 },
> @@ -93,20 +103,6 @@ static const struct reg_default adau1761_reg_defaults[] = {
> { ADAU1761_PLAY_LINE_RIGHT_VOL, 0x00 },
> { ADAU1761_PLAY_MONO_OUTPUT_VOL, 0x00 },
> { ADAU1761_POP_CLICK_SUPPRESS, 0x00 },
> - { ADAU1761_JACK_DETECT_PIN, 0x00 },
> - { ADAU1761_CLK_ENABLE0, 0x00 },
> - { ADAU1761_CLK_ENABLE1, 0x00 },
> - { ADAU17X1_CLOCK_CONTROL, 0x00 },
> - { ADAU17X1_PLL_CONTROL, 0x00 },
> - { ADAU17X1_REC_POWER_MGMT, 0x00 },
> - { ADAU17X1_MICBIAS, 0x00 },
> - { ADAU17X1_SERIAL_PORT0, 0x00 },
> - { ADAU17X1_SERIAL_PORT1, 0x00 },
> - { ADAU17X1_CONVERTER0, 0x00 },
> - { ADAU17X1_CONVERTER1, 0x00 },
> - { ADAU17X1_LEFT_INPUT_DIGITAL_VOL, 0x00 },
> - { ADAU17X1_RIGHT_INPUT_DIGITAL_VOL, 0x00 },
> - { ADAU17X1_ADC_CONTROL, 0x00 },
> { ADAU17X1_PLAY_POWER_MGMT, 0x00 },
> { ADAU17X1_DAC_CONTROL0, 0x00 },
> { ADAU17X1_DAC_CONTROL1, 0x00 },
> @@ -114,12 +110,16 @@ static const struct reg_default adau1761_reg_defaults[] = {
> { ADAU17X1_SERIAL_PORT_PAD, 0xaa },
> { ADAU17X1_CONTROL_PORT_PAD0, 0xaa },
> { ADAU17X1_CONTROL_PORT_PAD1, 0x00 },
> + { ADAU1761_JACK_DETECT_PIN, 0x00 },
> + { ADAU1761_DEJITTER, 0x03 },
> { ADAU17X1_DSP_SAMPLING_RATE, 0x01 },
> { ADAU17X1_SERIAL_INPUT_ROUTE, 0x00 },
> { ADAU17X1_SERIAL_OUTPUT_ROUTE, 0x00 },
> { ADAU17X1_DSP_ENABLE, 0x00 },
> { ADAU17X1_DSP_RUN, 0x00 },
> { ADAU17X1_SERIAL_SAMPLING_RATE, 0x00 },
> + { ADAU1761_CLK_ENABLE0, 0x00 },
> + { ADAU1761_CLK_ENABLE1, 0x00 },
> };
>
> static const DECLARE_TLV_DB_SCALE(adau1761_sing_in_tlv, -1500, 300, 1);
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: adau1761: sort the register default table
2026-08-05 12:27 [PATCH] ASoC: adau1761: sort the register default table Peter Ujfalusi
2026-08-05 13:30 ` Nuno Sá
@ 2026-08-05 16:40 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-08-05 16:40 UTC (permalink / raw)
To: Liam Girdwood, Lars-Peter Clausen, Nuno Sá, Peter Ujfalusi
Cc: linux-sound, stable
On Wed, 05 Aug 2026 15:27:13 +0300, Peter Ujfalusi wrote:
> ASoC: adau1761: sort the register default table
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/1] ASoC: adau1761: sort the register default table
https://git.kernel.org/broonie/sound/c/cc606b6c2328
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-06 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 12:27 [PATCH] ASoC: adau1761: sort the register default table Peter Ujfalusi
2026-08-05 13:30 ` Nuno Sá
2026-08-05 16:40 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox