Skip to content

Commit bc2edb8

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 50ad35b commit bc2edb8

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
@@ -407,13 +407,18 @@ static int hwvad_put_init_mode(struct snd_kcontrol *kcontrol,
407407
unsigned int *item = ucontrol->value.enumerated.item;
408408
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(comp);
409409
int val = snd_soc_enum_item_to_val(e, item[0]);
410+
bool change = false;
411+
412+
if (val < MICFIL_HWVAD_ENVELOPE_MODE || val > MICFIL_HWVAD_ENERGY_MODE)
413+
return -EINVAL;
410414

411415
/* 0 - Envelope-based Mode
412416
* 1 - Energy-based Mode
413417
*/
418+
change = (micfil->vad_init_mode != val);
414419
micfil->vad_init_mode = val;
415420

416-
return 0;
421+
return change;
417422
}
418423

419424
static int hwvad_get_init_mode(struct snd_kcontrol *kcontrol,

0 commit comments

Comments
 (0)