Skip to content

Commit a839898

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 88bce6c commit a839898

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
@@ -181,10 +181,34 @@ static int micfil_quality_set(struct snd_kcontrol *kcontrol,
181181
{
182182
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
183183
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
184+
int val = ucontrol->value.integer.value[0];
185+
bool change = false;
186+
int old_val;
187+
int ret;
188+
189+
if (val < QUALITY_HIGH || val > QUALITY_VLOW2)
190+
return -EINVAL;
191+
192+
if (micfil->quality != val) {
193+
ret = pm_runtime_resume_and_get(cmpnt->dev);
194+
if (ret)
195+
return ret;
196+
197+
old_val = micfil->quality;
198+
micfil->quality = val;
199+
ret = micfil_set_quality(micfil);
184200

185-
micfil->quality = ucontrol->value.integer.value[0];
201+
pm_runtime_put_autosuspend(cmpnt->dev);
186202

187-
return micfil_set_quality(micfil);
203+
if (ret) {
204+
micfil->quality = old_val;
205+
return ret;
206+
}
207+
208+
change = true;
209+
}
210+
211+
return change;
188212
}
189213

190214
static const char * const micfil_hwvad_enable[] = {

0 commit comments

Comments
 (0)