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

Add a suitable check in the function before updating the arc_mode
variable.

Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/20260401094226.2900532-8-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_xcvr.c

index a268fb81a2f86855daa035e306ea67c2c87e6f59..008e45009c83f52af06c499257dc873b529f90d7 100644 (file)
@@ -115,10 +115,17 @@ static int fsl_xcvr_arc_mode_put(struct snd_kcontrol *kcontrol,
        struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        unsigned int *item = ucontrol->value.enumerated.item;
+       int val = snd_soc_enum_item_to_val(e, item[0]);
+       int ret;
 
-       xcvr->arc_mode = snd_soc_enum_item_to_val(e, item[0]);
+       if (val < 0 || val > 1)
+               return -EINVAL;
 
-       return 0;
+       ret = (xcvr->arc_mode != val);
+
+       xcvr->arc_mode = val;
+
+       return ret;
 }
 
 static int fsl_xcvr_arc_mode_get(struct snd_kcontrol *kcontrol,