Skip to content

Commit 4428887

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 0dddb56 commit 4428887

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
@@ -208,10 +208,17 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
208208
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
209209
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
210210
unsigned int *item = ucontrol->value.enumerated.item;
211+
int val = snd_soc_enum_item_to_val(e, item[0]);
211212
struct snd_soc_card *card = dai->component->card;
212213
struct snd_soc_pcm_runtime *rtd;
214+
int ret;
215+
216+
if (val < FSL_XCVR_MODE_SPDIF || val > FSL_XCVR_MODE_EARC)
217+
return -EINVAL;
213218

214-
xcvr->mode = snd_soc_enum_item_to_val(e, item[0]);
219+
ret = (xcvr->mode != val);
220+
221+
xcvr->mode = val;
215222

216223
fsl_xcvr_activate_ctl(dai, fsl_xcvr_arc_mode_kctl.name,
217224
(xcvr->mode == FSL_XCVR_MODE_ARC));
@@ -221,7 +228,7 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
221228
rtd = snd_soc_get_pcm_runtime(card, card->dai_link);
222229
rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count =
223230
(xcvr->mode == FSL_XCVR_MODE_SPDIF ? 1 : 0);
224-
return 0;
231+
return ret;
225232
}
226233

227234
static int fsl_xcvr_mode_get(struct snd_kcontrol *kcontrol,

0 commit comments

Comments
 (0)