summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--include/linux/mfd/wm8994/registers.h15
-rw-r--r--sound/soc/codecs/wm8994.c43
3 files changed, 45 insertions, 15 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 4808256446f2..c802e5fa2d11 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6122,7 +6122,7 @@ F: sound/
6122SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) 6122SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
6123M: Liam Girdwood <lrg@ti.com> 6123M: Liam Girdwood <lrg@ti.com>
6124M: Mark Brown <broonie@opensource.wolfsonmicro.com> 6124M: Mark Brown <broonie@opensource.wolfsonmicro.com>
6125T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git 6125T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
6126L: alsa-devel@alsa-project.org (moderated for non-subscribers) 6126L: alsa-devel@alsa-project.org (moderated for non-subscribers)
6127W: http://alsa-project.org/main/index.php/ASoC 6127W: http://alsa-project.org/main/index.php/ASoC
6128S: Supported 6128S: Supported
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index fae295048a8b..83a9caec0e43 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -1963,6 +1963,21 @@
1963#define WM8958_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */ 1963#define WM8958_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */
1964 1964
1965/* 1965/*
1966 * R210 (0xD2) - Mic Detect 3
1967 */
1968#define WM8958_MICD_LVL_MASK 0x07FC /* MICD_LVL - [10:2] */
1969#define WM8958_MICD_LVL_SHIFT 2 /* MICD_LVL - [10:2] */
1970#define WM8958_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */
1971#define WM8958_MICD_VALID 0x0002 /* MICD_VALID */
1972#define WM8958_MICD_VALID_MASK 0x0002 /* MICD_VALID */
1973#define WM8958_MICD_VALID_SHIFT 1 /* MICD_VALID */
1974#define WM8958_MICD_VALID_WIDTH 1 /* MICD_VALID */
1975#define WM8958_MICD_STS 0x0001 /* MICD_STS */
1976#define WM8958_MICD_STS_MASK 0x0001 /* MICD_STS */
1977#define WM8958_MICD_STS_SHIFT 0 /* MICD_STS */
1978#define WM8958_MICD_STS_WIDTH 1 /* MICD_STS */
1979
1980/*
1966 * R76 (0x4C) - Charge Pump (1) 1981 * R76 (0x4C) - Charge Pump (1)
1967 */ 1982 */
1968#define WM8994_CP_ENA 0x8000 /* CP_ENA */ 1983#define WM8994_CP_ENA 0x8000 /* CP_ENA */
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6b73efd26991..9c982e47eb99 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -56,7 +56,7 @@ static int wm8994_retune_mobile_base[] = {
56static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) 56static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg)
57{ 57{
58 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 58 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
59 struct wm8994 *control = wm8994->control_data; 59 struct wm8994 *control = codec->control_data;
60 60
61 switch (reg) { 61 switch (reg) {
62 case WM8994_GPIO_1: 62 case WM8994_GPIO_1:
@@ -3030,19 +3030,34 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3030{ 3030{
3031 struct wm8994_priv *wm8994 = data; 3031 struct wm8994_priv *wm8994 = data;
3032 struct snd_soc_codec *codec = wm8994->codec; 3032 struct snd_soc_codec *codec = wm8994->codec;
3033 int reg; 3033 int reg, count;
3034 3034
3035 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3); 3035 /* We may occasionally read a detection without an impedence
3036 if (reg < 0) { 3036 * range being provided - if that happens loop again.
3037 dev_err(codec->dev, "Failed to read mic detect status: %d\n", 3037 */
3038 reg); 3038 count = 10;
3039 return IRQ_NONE; 3039 do {
3040 } 3040 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3);
3041 if (reg < 0) {
3042 dev_err(codec->dev,
3043 "Failed to read mic detect status: %d\n",
3044 reg);
3045 return IRQ_NONE;
3046 }
3041 3047
3042 if (!(reg & WM8958_MICD_VALID)) { 3048 if (!(reg & WM8958_MICD_VALID)) {
3043 dev_dbg(codec->dev, "Mic detect data not valid\n"); 3049 dev_dbg(codec->dev, "Mic detect data not valid\n");
3044 goto out; 3050 goto out;
3045 } 3051 }
3052
3053 if (!(reg & WM8958_MICD_STS) || (reg & WM8958_MICD_LVL_MASK))
3054 break;
3055
3056 msleep(1);
3057 } while (count--);
3058
3059 if (count == 0)
3060 dev_warn(codec->dev, "No impedence range reported for jack\n");
3046 3061
3047#ifndef CONFIG_SND_SOC_WM8994_MODULE 3062#ifndef CONFIG_SND_SOC_WM8994_MODULE
3048 trace_snd_soc_jack_irq(dev_name(codec->dev)); 3063 trace_snd_soc_jack_irq(dev_name(codec->dev));
@@ -3180,9 +3195,9 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3180 3195
3181 wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, 3196 wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR,
3182 wm8994_fifo_error, "FIFO error", codec); 3197 wm8994_fifo_error, "FIFO error", codec);
3183 wm8994_request_irq(wm8994->control_data, WM8994_IRQ_TEMP_WARN, 3198 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_WARN,
3184 wm8994_temp_warn, "Thermal warning", codec); 3199 wm8994_temp_warn, "Thermal warning", codec);
3185 wm8994_request_irq(wm8994->control_data, WM8994_IRQ_TEMP_SHUT, 3200 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT,
3186 wm8994_temp_shut, "Thermal shutdown", codec); 3201 wm8994_temp_shut, "Thermal shutdown", codec);
3187 3202
3188 ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3203 ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE,