Skip to content

Commit 15ff6da

Browse files
TE-N-ShengjiuWanggregkh
authored andcommitted
ASoC: fsl_xcvr: Fix event generation in fsl_xcvr_mode_put()
[ Upstream commit 64a496b ] ALSA controls should return 1 if the value in the control changed but the control put operation fsl_xcvr_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 mode variable. Fixes: 2856448 ("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-9-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4ab351b commit 15ff6da

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

sound/soc/fsl/fsl_xcvr.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,17 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
225225
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
226226
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
227227
unsigned int *item = ucontrol->value.enumerated.item;
228+
int val = snd_soc_enum_item_to_val(e, item[0]);
228229
struct snd_soc_card *card = dai->component->card;
229230
struct snd_soc_pcm_runtime *rtd;
231+
int ret;
232+
233+
if (val < FSL_XCVR_MODE_SPDIF || val > FSL_XCVR_MODE_EARC)
234+
return -EINVAL;
230235

231-
xcvr->mode = snd_soc_enum_item_to_val(e, item[0]);
236+
ret = (xcvr->mode != val);
237+
238+
xcvr->mode = val;
232239

233240
fsl_xcvr_activate_ctl(dai, fsl_xcvr_arc_mode_kctl.name,
234241
(xcvr->mode == FSL_XCVR_MODE_ARC));
@@ -238,7 +245,7 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
238245
rtd = snd_soc_get_pcm_runtime(card, card->dai_link);
239246
rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count =
240247
(xcvr->mode == FSL_XCVR_MODE_SPDIF ? 1 : 0);
241-
return 0;
248+
return ret;
242249
}
243250

244251
static int fsl_xcvr_mode_get(struct snd_kcontrol *kcontrol,

0 commit comments

Comments
 (0)