]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ASoC: Provide microphone bias configuration for WM8962
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 29 Sep 2010 20:24:35 +0000 (13:24 -0700)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 30 Sep 2010 16:36:13 +0000 (09:36 -0700)
Add the widget for MICBIAS power control and allow configuration of the
microphone bias setup via the platform data for the WM8962. When
microphone status signals are brought out to GPIO this should be
sufficient to enable microphone detection.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
include/sound/wm8962.h
sound/soc/codecs/wm8962.c

index cc32aff53222c6924417a5fcc2df3ec662229088..9722aac5a138c217361fae81286ac268ee724b3d 100644 (file)
 struct wm8962_pdata {
        u32 gpio_init[WM8962_MAX_GPIO];
 
+       /* Setup for microphone detection, raw value to be written to
+        * R48(0x30) - only microphone related bits will be updated.
+        * Detection may be enabled here for use with signals brought
+        * out on the GPIOs. */
+       u32 mic_cfg;
+
        bool irq_active_low;
 
        bool spk_mono;   /* Speaker outputs tied together as mono */
index 4fa5de873c8b2b8792e119d219a8da60fa958106..be34146a775bde831f861a1afa43f82e5ba65b77 100644 (file)
@@ -630,6 +630,8 @@ SND_SOC_DAPM_INPUT("IN4L"),
 SND_SOC_DAPM_INPUT("IN4R"),
 SND_SOC_DAPM_INPUT("Beep"),
 
+SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0),
+
 SND_SOC_DAPM_SUPPLY("Class G", WM8962_CHARGE_PUMP_B, 0, 1, NULL, 0),
 SND_SOC_DAPM_SUPPLY("SYSCLK", WM8962_CLOCKING2, 5, 0, sysclk_event,
                    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
@@ -1755,6 +1757,16 @@ static int wm8962_probe(struct snd_soc_codec *codec)
                if (pdata->spk_mono)
                        wm8962->reg_cache[WM8962_CLASS_D_CONTROL_2]
                                |= WM8962_SPK_MONO;
+
+               /* Micbias setup, detection enable and detection
+                * threasholds. */
+               if (pdata->mic_cfg)
+                       snd_soc_update_bits(codec, WM8962_ADDITIONAL_CONTROL_4,
+                                           WM8962_MICDET_ENA |
+                                           WM8962_MICDET_THR_MASK |
+                                           WM8962_MICSHORT_THR_MASK |
+                                           WM8962_MICBIAS_LVL,
+                                           pdata->mic_cfg);
        }
 
        /* Latch volume update bits */