]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: cs35l45: sort the register default table
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 5 Aug 2026 08:24:12 +0000 (11:24 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 5 Aug 2026 12:34:35 +0000 (13:34 +0100)
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").

cs35l45_defaults[] lists the DSP1_RX*_RATE and DSP1_TX*_RATE registers
(0x02b80080 - 0x02b802b8) in the middle of the table, ahead of entries with
much lower addresses, so the binary search does not find 36 of its 73
entries.  regcache_reg_needs_sync() then cannot compare those 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: 74b14e2850a3 ("ASoC: cs35l45: DSP Support")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20260805082413.26174-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l45-tables.c

index d2ecc7b3f61938a77edf4d89fc6bb6de6ccf48c7..764dbaa3504227563bb4f36a6cbd7092113fbd2e 100644 (file)
@@ -66,22 +66,6 @@ static const struct reg_default cs35l45_defaults[] = {
        { CS35L45_ASPTX3_INPUT,                 0x00000020 },
        { CS35L45_ASPTX4_INPUT,                 0x00000028 },
        { CS35L45_ASPTX5_INPUT,                 0x00000048 },
-       { CS35L45_DSP1_RX1_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX2_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX3_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX4_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX5_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX6_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX7_RATE,                0x00000001 },
-       { CS35L45_DSP1_RX8_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX1_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX2_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX3_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX4_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX5_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX6_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX7_RATE,                0x00000001 },
-       { CS35L45_DSP1_TX8_RATE,                0x00000001 },
        { CS35L45_DSP1RX1_INPUT,                0x00000008 },
        { CS35L45_DSP1RX2_INPUT,                0x00000009 },
        { CS35L45_DSP1RX3_INPUT,                0x00000018 },
@@ -114,6 +98,22 @@ static const struct reg_default cs35l45_defaults[] = {
        { CS35L45_GPIO1_CTRL1,                  0x81000001 },
        { CS35L45_GPIO2_CTRL1,                  0x81000001 },
        { CS35L45_GPIO3_CTRL1,                  0x81000001 },
+       { CS35L45_DSP1_RX1_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX2_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX3_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX4_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX5_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX6_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX7_RATE,                0x00000001 },
+       { CS35L45_DSP1_RX8_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX1_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX2_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX3_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX4_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX5_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX6_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX7_RATE,                0x00000001 },
+       { CS35L45_DSP1_TX8_RATE,                0x00000001 },
 };
 
 static bool cs35l45_readable_reg(struct device *dev, unsigned int reg)