Skip to content

Commit 2518c90

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 b77373f commit 2518c90

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
@@ -307,13 +307,18 @@ static int hwvad_put_init_mode(struct snd_kcontrol *kcontrol,
307307
unsigned int *item = ucontrol->value.enumerated.item;
308308
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(comp);
309309
int val = snd_soc_enum_item_to_val(e, item[0]);
310+
bool change = false;
311+
312+
if (val < MICFIL_HWVAD_ENVELOPE_MODE || val > MICFIL_HWVAD_ENERGY_MODE)
313+
return -EINVAL;
310314

311315
/* 0 - Envelope-based Mode
312316
* 1 - Energy-based Mode
313317
*/
318+
change = (micfil->vad_init_mode != val);
314319
micfil->vad_init_mode = val;
315320

316-
return 0;
321+
return change;
317322
}
318323

319324
static int hwvad_get_init_mode(struct snd_kcontrol *kcontrol,

0 commit comments

Comments
 (0)