diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-08-19 05:05:05 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-04 19:24:59 -0400 |
commit | 19940b3d55c87d8089a8cb0fa8e5a9918a3846bd (patch) | |
tree | cae1abaac5efabe83003f4352d068bd7034ae6ae /sound | |
parent | 5a3ad6bd6ae0687cb0ecb424d74221920fbc7f38 (diff) |
ASoC: Ensure we get an impedence reported for WM8958 jack detect
Occasionally we may see an accessory reported before we have a stable
impedance for the accessory. If this happens then reread the status in
order to ensure that the handler can take the appropriate action for the
status change.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8994.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 9cb16cc853b3..9c982e47eb99 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -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)); |