Skip to content

Commit ba04af0

Browse files
TE-N-ShengjiuWanggregkh
authored andcommitted
ASoC: fsl_micfil: Fix event generation in micfil_quality_set()
[ Upstream commit e578509 ] ALSA controls should return 1 if the value in the control changed but the control put operation micfil_quality_set() 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 quality variable. Also enable pm runtime before calling the function micfil_set_quality() to make the regmap cache data align with the value in hardware. Fixes: bea1d61 ("ASoC: fsl_micfil: rework quality setting") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://patch.msgid.link/20260401094226.2900532-7-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 19453f9 commit ba04af0

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

sound/soc/fsl/fsl_micfil.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,34 @@ static int micfil_quality_set(struct snd_kcontrol *kcontrol,
289289
{
290290
struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
291291
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
292+
int val = ucontrol->value.integer.value[0];
293+
bool change = false;
294+
int old_val;
295+
int ret;
296+
297+
if (val < QUALITY_HIGH || val > QUALITY_VLOW2)
298+
return -EINVAL;
299+
300+
if (micfil->quality != val) {
301+
ret = pm_runtime_resume_and_get(cmpnt->dev);
302+
if (ret)
303+
return ret;
304+
305+
old_val = micfil->quality;
306+
micfil->quality = val;
307+
ret = micfil_set_quality(micfil);
292308

293-
micfil->quality = ucontrol->value.integer.value[0];
309+
pm_runtime_put_autosuspend(cmpnt->dev);
294310

295-
return micfil_set_quality(micfil);
311+
if (ret) {
312+
micfil->quality = old_val;
313+
return ret;
314+
}
315+
316+
change = true;
317+
}
318+
319+
return change;
296320
}
297321

298322
static const char * const micfil_hwvad_enable[] = {

0 commit comments

Comments
 (0)