ASoC: Use a lower detection rate when monitoring headphones on WM8915
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 1 Jun 2011 19:16:40 +0000 (20:16 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 2 Jun 2011 17:57:08 +0000 (18:57 +0100)
We only need to increase the detection rate to maximum if we're monitoring
for button presses as the response times needed for user interaction there
are much lower.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/codecs/wm8915.c

index 5ff6a773c8fb0829d083ae94077ae1a21d76d6e2..5a59ef73e702de0351f9ab31dec56bcf5d144be9 100644 (file)
@@ -2288,6 +2288,12 @@ static void wm8915_micd(struct snd_soc_codec *codec)
                                    SND_JACK_HEADSET | SND_JACK_BTN_0);
                wm8915->jack_mic = true;
                wm8915->detecting = false;
+
+               /* Increase poll rate to give better responsiveness
+                * for buttons */
+               snd_soc_update_bits(codec, WM8915_MIC_DETECT_1,
+                                   WM8915_MICD_RATE_MASK,
+                                   5 << WM8915_MICD_RATE_SHIFT);
        }
 
        /* If we detected a lower impedence during initial startup
@@ -2328,15 +2334,17 @@ static void wm8915_micd(struct snd_soc_codec *codec)
                                            SND_JACK_HEADPHONE,
                                            SND_JACK_HEADSET |
                                            SND_JACK_BTN_0);
+
+                       /* Increase the detection rate a bit for
+                        * responsiveness.
+                        */
+                       snd_soc_update_bits(codec, WM8915_MIC_DETECT_1,
+                                           WM8915_MICD_RATE_MASK,
+                                           7 << WM8915_MICD_RATE_SHIFT);
+
                        wm8915->detecting = false;
                }
        }
-
-       /* Increase poll rate to give better responsiveness for buttons */
-       if (!wm8915->detecting)
-               snd_soc_update_bits(codec, WM8915_MIC_DETECT_1,
-                                   WM8915_MICD_RATE_MASK,
-                                   5 << WM8915_MICD_RATE_SHIFT);
 }
 
 static irqreturn_t wm8915_irq(int irq, void *data)