Skip to content

Commit 79acc3e

Browse files
TE-N-ShengjiuWanggregkh
authored andcommitted
ASoC: fsl_micfil: Fix event generation in hwvad_put_init_mode()
[ Upstream commit 7e22620 ] ALSA controls should return 1 if the value in the control changed but the control put operation hwvad_put_init_mode() 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 vad_init_mode variable. Fixes: 29dbfee ("ASoC: fsl_micfil: Add Hardware Voice Activity Detector support") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://patch.msgid.link/20260401094226.2900532-4-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 891c51e commit 79acc3e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sound/soc/fsl/fsl_micfil.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,18 @@ static int hwvad_put_init_mode(struct snd_kcontrol *kcontrol,
336336
unsigned int *item = ucontrol->value.enumerated.item;
337337
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(comp);
338338
int val = snd_soc_enum_item_to_val(e, item[0]);
339+
bool change = false;
340+
341+
if (val < MICFIL_HWVAD_ENVELOPE_MODE || val > MICFIL_HWVAD_ENERGY_MODE)
342+
return -EINVAL;
339343

340344
/* 0 - Envelope-based Mode
341345
* 1 - Energy-based Mode
342346
*/
347+
change = (micfil->vad_init_mode != val);
343348
micfil->vad_init_mode = val;
344349

345-
return 0;
350+
return change;
346351
}
347352

348353
static int hwvad_get_init_mode(struct snd_kcontrol *kcontrol,

0 commit comments

Comments
 (0)