]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SDCA: add route by the number of input pins in MU entity
authorShuming Fan <shumingf@realtek.com>
Mon, 21 Jul 2025 11:23:46 +0000 (19:23 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 21 Jul 2025 15:04:53 +0000 (16:04 +0100)
This patch removed the code where num_sources should be the same as cn_list.
For better resilience, it would be preferable to explicitly add the route
mapping the input pins to this MU entity.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250721112346.388542-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdca/sdca_asoc.c

index 1482869a7ad5a2726218133e023da3513f024d76..c493ec530cc5c80a6f5e509e9f6821992dbc07df 100644 (file)
@@ -594,7 +594,6 @@ static int entity_parse_mu(struct device *dev,
 {
        struct sdca_control *control;
        struct snd_kcontrol_new *kctl;
-       int cn;
        int i;
 
        if (!entity->num_sources) {
@@ -611,18 +610,11 @@ static int entity_parse_mu(struct device *dev,
                dev_warn(dev, "%s: unexpected access layer: %x\n",
                         entity->label, control->layers);
 
-       if (entity->num_sources != hweight64(control->cn_list)) {
-               dev_err(dev, "%s: mismatched control and sources\n", entity->label);
-               return -EINVAL;
-       }
-
        kctl = devm_kcalloc(dev, entity->num_sources, sizeof(*kctl), GFP_KERNEL);
        if (!kctl)
                return -ENOMEM;
 
-       i = 0;
-       for_each_set_bit(cn, (unsigned long *)&control->cn_list,
-                        BITS_PER_TYPE(control->cn_list)) {
+       for (i = 0; i < entity->num_sources; i++) {
                const char *control_name;
                struct soc_mixer_control *mc;
 
@@ -647,7 +639,6 @@ static int entity_parse_mu(struct device *dev,
                kctl[i].info = snd_soc_info_volsw;
                kctl[i].get = snd_soc_dapm_get_volsw;
                kctl[i].put = snd_soc_dapm_put_volsw;
-               i++;
        }
 
        (*widget)->id = snd_soc_dapm_mixer;