Commit babce821 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: wm8994: Update locking around use of DAPM pin API

The pin updates in this driver look like they are intended to be done
atomically, update to do so.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent f1a3b8d9
...@@ -2549,43 +2549,52 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, ...@@ -2549,43 +2549,52 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode)
{ {
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
switch (mode) { switch (mode) {
case WM8994_VMID_NORMAL: case WM8994_VMID_NORMAL:
snd_soc_dapm_mutex_lock(dapm);
if (wm8994->hubs.lineout1_se) { if (wm8994->hubs.lineout1_se) {
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm,
"LINEOUT1N Driver"); "LINEOUT1N Driver");
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm,
"LINEOUT1P Driver"); "LINEOUT1P Driver");
} }
if (wm8994->hubs.lineout2_se) { if (wm8994->hubs.lineout2_se) {
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm,
"LINEOUT2N Driver"); "LINEOUT2N Driver");
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm,
"LINEOUT2P Driver"); "LINEOUT2P Driver");
} }
/* Do the sync with the old mode to allow it to clean up */ /* Do the sync with the old mode to allow it to clean up */
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync_unlocked(dapm);
wm8994->vmid_mode = mode; wm8994->vmid_mode = mode;
snd_soc_dapm_mutex_unlock(dapm);
break; break;
case WM8994_VMID_FORCE: case WM8994_VMID_FORCE:
snd_soc_dapm_mutex_lock(dapm);
if (wm8994->hubs.lineout1_se) { if (wm8994->hubs.lineout1_se) {
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm,
"LINEOUT1N Driver"); "LINEOUT1N Driver");
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm,
"LINEOUT1P Driver"); "LINEOUT1P Driver");
} }
if (wm8994->hubs.lineout2_se) { if (wm8994->hubs.lineout2_se) {
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm,
"LINEOUT2N Driver"); "LINEOUT2N Driver");
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm,
"LINEOUT2P Driver"); "LINEOUT2P Driver");
} }
wm8994->vmid_mode = mode; wm8994->vmid_mode = mode;
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync_unlocked(dapm);
snd_soc_dapm_mutex_unlock(dapm);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment