ASoC: wm8996: Update locking around use of DAPM pin API
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tue, 18 Feb 2014 15:22:20 +0000 (15:22 +0000)
committerMark Brown <broonie@linaro.org>
Thu, 20 Feb 2014 10:22:57 +0000 (19:22 +0900)
The pin updates in this driver look like they are intended to be done
atomically, update to do so.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/wm8996.c

index 1a7655b0aa2230890df4f5b82c34a609f7128f05..d565d0ac7a11f65da8b9aa7e05de9d042ffaafe1 100644 (file)
@@ -2251,6 +2251,7 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
                  wm8996_polarity_fn polarity_cb)
 {
        struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
+       struct snd_soc_dapm_context *dapm = &codec->dapm;
 
        wm8996->jack = jack;
        wm8996->detecting = true;
@@ -2267,8 +2268,12 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
                            WM8996_MICB2_DISCH, 0);
 
        /* LDO2 powers the microphones, SYSCLK clocks detection */
-       snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2");
-       snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK");
+       snd_soc_dapm_mutex_lock(dapm);
+
+       snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2");
+       snd_soc_dapm_force_enable_pin_unlocked(dapm, "SYSCLK");
+
+       snd_soc_dapm_mutex_unlock(dapm);
 
        /* We start off just enabling microphone detection - even a
         * plain headphone will trigger detection.