]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: fsl_micfil: Fix event generation in micfil_range_set()
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 1 Apr 2026 09:42:19 +0000 (17:42 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 1 Apr 2026 17:24:23 +0000 (18:24 +0100)
ALSA controls should return 1 if the value in the control changed but the
control put operation micfil_range_set() only returns 0 or a negative
error code, causing ALSA to not generate any change events.

Use snd_soc_component_update_bits() function to replace the
regmap_update_bits(), for snd_soc_component_update_bits() has the
capability of return check status.

Also enable pm runtime before calling the function
snd_soc_component_update_bits() to make the regmap cache data align with
the value in hardware.

Fixes: ef1a7e02fdb7 ("ASoC: fsl_micfil: Set channel range control")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/20260401094226.2900532-5-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_micfil.c

index 1c826e0cb1d5e8ee82d74bb6ad3cb18ec3738328..0cfdd6343291ac2458cab43375afe9909c201d4f 100644 (file)
@@ -210,15 +210,23 @@ static int micfil_range_set(struct snd_kcontrol *kcontrol,
                (struct soc_mixer_control *)kcontrol->private_value;
        unsigned int shift = mc->shift;
        int max_range, new_range;
+       int ret;
 
        new_range = ucontrol->value.integer.value[0];
        max_range = micfil_get_max_range(micfil);
        if (new_range > max_range)
                dev_warn(&micfil->pdev->dev, "range makes channel %d data unreliable\n", shift / 4);
 
-       regmap_update_bits(micfil->regmap, REG_MICFIL_OUT_CTRL, 0xF << shift, new_range << shift);
+       ret = pm_runtime_resume_and_get(cmpnt->dev);
+       if (ret)
+               return ret;
 
-       return 0;
+       ret = snd_soc_component_update_bits(cmpnt, REG_MICFIL_OUT_CTRL, 0xF << shift,
+                                           new_range << shift);
+
+       pm_runtime_put_autosuspend(cmpnt->dev);
+
+       return ret;
 }
 
 static int micfil_set_quality(struct fsl_micfil *micfil)