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;
                            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.