[PATCH 2/6] ASoC: codecs: lpass-{rx,wsa}-macro: sort reg_defaults before regmap init
From: Srinivas Kandagatla
Date: Tue Sep 08 2026 - 04:31:46 EST
Both drivers build the reg_defaults array by concatenating a base
table with a codec-version-specific one; the resulting array is not in
register-address order because the version-specific ranges overlap the
base range. Regmap detects this and prints
wsa_macro 6c90000.codec: Driver needs fixing: Unsorted reg_defaults,
sorting the copy
rx_macro 6a70000.codec: Driver needs fixing: Unsorted reg_defaults,
sorting the copy
then sorts its own copy at runtime. Call regcache_sort_defaults() on
the concatenated array before handing it to regmap so the warning goes
away and regmap does not have to sort a second time. Keeping the
base/version-specific split is deliberate for readability, so a static
reorder is not appropriate here.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
---
sound/soc/codecs/lpass-rx-macro.c | 2 ++
sound/soc/codecs/lpass-wsa-macro.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index cac0451f8139..4dac376927bb 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3855,6 +3855,8 @@ static int rx_macro_probe(struct platform_device *pdev)
return -EINVAL;
}
+ regcache_sort_defaults(reg_defaults, def_count);
+
struct regmap_config *reg_config __free(kfree) = kmemdup(&rx_regmap_config,
sizeof(*reg_config),
GFP_KERNEL);
diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
index 7a2b0cf9398a..4d7e7e30f460 100644
--- a/sound/soc/codecs/lpass-wsa-macro.c
+++ b/sound/soc/codecs/lpass-wsa-macro.c
@@ -2763,6 +2763,8 @@ static int wsa_macro_probe(struct platform_device *pdev)
return -EINVAL;
}
+ regcache_sort_defaults(reg_defaults, def_count);
+
struct regmap_config *reg_config __free(kfree) = kmemdup(&wsa_regmap_config,
sizeof(*reg_config),
GFP_KERNEL);
--
2.53.0