]> git.hungrycats.org Git - linux/commitdiff
ASoC: rt298: sort the register default table
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 5 Aug 2026 09:02:26 +0000 (12:02 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 7 Aug 2026 14:45:24 +0000 (15:45 +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").

Four entries were appended to the end of rt298_reg[] instead of being
inserted at their sorted position and the 0x01470100 entry is listed after
0x01470c00, which leaves 7 of the 39 entries unreachable for the binary
search.  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: 6adcafae6ed2 ("ASoC: add rt298 codec driver")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20260805090240.16991-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt298.c

index 5414a1712b571555509f96bb9214d583d652b73c..09aed08b5b79808289de3b4056c9edb968372b82 100644 (file)
@@ -78,8 +78,10 @@ static const struct reg_default rt298_reg[] = {
        { 0x0023a000, 0x0000007f },
        { 0x00270500, 0x00000400 },
        { 0x00370500, 0x00000400 },
+       { 0x00830000, 0x000000c3 },
        { 0x00870500, 0x00000400 },
        { 0x00920000, 0x00000031 },
+       { 0x00930000, 0x000000c3 },
        { 0x00935000, 0x000000c3 },
        { 0x00936000, 0x000000c3 },
        { 0x00970500, 0x00000400 },
@@ -89,16 +91,18 @@ static const struct reg_default rt298_reg[] = {
        { 0x00c37000, 0x00000000 },
        { 0x00c37100, 0x00000080 },
        { 0x01270500, 0x00000400 },
+       { 0x01270700, 0x00000000 },
        { 0x01370500, 0x00000400 },
        { 0x01371f00, 0x411111f0 },
        { 0x01439000, 0x00000080 },
        { 0x0143a000, 0x00000080 },
-       { 0x01470700, 0x00000000 },
+       { 0x01470100, 0x00000000 },
        { 0x01470500, 0x00000400 },
+       { 0x01470700, 0x00000000 },
        { 0x01470c00, 0x00000000 },
-       { 0x01470100, 0x00000000 },
        { 0x01837000, 0x00000000 },
        { 0x01870500, 0x00000400 },
+       { 0x01870700, 0x00000020 },
        { 0x02050000, 0x00000000 },
        { 0x02139000, 0x00000080 },
        { 0x0213a000, 0x00000080 },
@@ -107,10 +111,6 @@ static const struct reg_default rt298_reg[] = {
        { 0x02170700, 0x00000000 },
        { 0x02270100, 0x00000000 },
        { 0x02370100, 0x00000000 },
-       { 0x01870700, 0x00000020 },
-       { 0x00830000, 0x000000c3 },
-       { 0x00930000, 0x000000c3 },
-       { 0x01270700, 0x00000000 },
 };
 
 static bool rt298_volatile_register(struct device *dev, unsigned int reg)