Skip to content

Commit 4095fa1

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 fe6e720 commit 4095fa1

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
@@ -210,10 +210,34 @@ static int micfil_quality_set(struct snd_kcontrol *kcontrol,
210210
{
211211
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
212212
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
213+
int val = ucontrol->value.integer.value[0];
214+
bool change = false;
215+
int old_val;
216+
int ret;
217+
218+
if (val < QUALITY_HIGH || val > QUALITY_VLOW2)
219+
return -EINVAL;
220+
221+
if (micfil->quality != val) {
222+
ret = pm_runtime_resume_and_get(cmpnt->dev);
223+
if (ret)
224+
return ret;
225+
226+
old_val = micfil->quality;
227+
micfil->quality = val;
228+
ret = micfil_set_quality(micfil);
213229

214-
micfil->quality = ucontrol->value.integer.value[0];
230+
pm_runtime_put_autosuspend(cmpnt->dev);
215231

216-
return micfil_set_quality(micfil);
232+
if (ret) {
233+
micfil->quality = old_val;
234+
return ret;
235+
}
236+
237+
change = true;
238+
}
239+
240+
return change;
217241
}
218242

219243
static const char * const micfil_hwvad_enable[] = {

0 commit comments

Comments
 (0)