ASoC: fsl-asoc-card: Fix jack_event() always return 0

Today, hp_jack_event and mic_jack_event always return 0. However,
snd_soc_dapm_disable_pin and snd_soc_dapm_enable_pin may return a
non-zero value, this will cause the user who calling hp_jack_event
and mic_jack_event don't know whether the operation was really
successfully.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20220321065754.18307-1-tangmeng@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Meng Tang 2022-03-21 14:57:54 +08:00 committed by Mark Brown
parent a7663c89f4
commit 5cb90dcb6a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -462,11 +462,9 @@ static int hp_jack_event(struct notifier_block *nb, unsigned long event,
if (event & SND_JACK_HEADPHONE)
/* Disable speaker if headphone is plugged in */
snd_soc_dapm_disable_pin(dapm, "Ext Spk");
return snd_soc_dapm_disable_pin(dapm, "Ext Spk");
else
snd_soc_dapm_enable_pin(dapm, "Ext Spk");
return 0;
return snd_soc_dapm_enable_pin(dapm, "Ext Spk");
}
static struct notifier_block hp_jack_nb = {
@ -481,11 +479,9 @@ static int mic_jack_event(struct notifier_block *nb, unsigned long event,
if (event & SND_JACK_MICROPHONE)
/* Disable dmic if microphone is plugged in */
snd_soc_dapm_disable_pin(dapm, "DMIC");
return snd_soc_dapm_disable_pin(dapm, "DMIC");
else
snd_soc_dapm_enable_pin(dapm, "DMIC");
return 0;
return snd_soc_dapm_enable_pin(dapm, "DMIC");
}
static struct notifier_block mic_jack_nb = {