Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293443
b: refs/heads/master
c: 1defde2
h: refs/heads/master
i:
  293441: 435693e
  293439: fdd2721
v: v3
  • Loading branch information
Mark Brown committed Mar 4, 2012
1 parent c14d77f commit c3161f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 28e33269a71cb4104c2e0629b6a3ef7344436f93
refs/heads/master: 1defde2a50f9171e665cc8f4c46fe48e86bb364e
48 changes: 28 additions & 20 deletions trunk/sound/soc/codecs/wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,18 +685,37 @@ SOC_SINGLE_TLV("MIXINL IN1RP Boost Volume", WM8994_INPUT_MIXER_1, 8, 1, 0,
static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode)
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
u16 old = snd_soc_read(codec, WM8994_ANTIPOP_2)
& WM1811_JACKDET_MODE_MASK;

if (!wm8994->jackdet || !wm8994->jack_cb)
return;

if (wm8994->active_refcount)
mode = WM1811_JACKDET_MODE_AUDIO;

if (mode == old)
return;

snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK, mode);

if (mode == WM1811_JACKDET_MODE_MIC)
msleep(2);
switch (mode) {
case WM1811_JACKDET_MODE_MIC:
case WM1811_JACKDET_MODE_AUDIO:
switch (old) {
case WM1811_JACKDET_MODE_MIC:
case WM1811_JACKDET_MODE_AUDIO:
break;
default:
msleep(2);
break;
}

default:
break;
}

}

static void active_reference(struct snd_soc_codec *codec)
Expand All @@ -710,15 +729,8 @@ static void active_reference(struct snd_soc_codec *codec)
dev_dbg(codec->dev, "Active refcount incremented, now %d\n",
wm8994->active_refcount);

if (wm8994->active_refcount == 1) {
/* If we're using jack detection go into audio mode */
if (wm8994->jackdet && wm8994->jack_cb) {
snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK,
WM1811_JACKDET_MODE_AUDIO);
msleep(2);
}
}
/* If we're using jack detection go into audio mode */
wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_AUDIO);

mutex_unlock(&wm8994->accdet_lock);
}
Expand All @@ -737,16 +749,12 @@ static void active_dereference(struct snd_soc_codec *codec)

if (wm8994->active_refcount == 0) {
/* Go into appropriate detection only mode */
if (wm8994->jackdet && wm8994->jack_cb) {
if (wm8994->jack_mic || wm8994->mic_detecting)
mode = WM1811_JACKDET_MODE_MIC;
else
mode = WM1811_JACKDET_MODE_JACK;
if (wm8994->jack_mic || wm8994->mic_detecting)
mode = WM1811_JACKDET_MODE_MIC;
else
mode = WM1811_JACKDET_MODE_JACK;

snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK,
mode);
}
wm1811_jackdet_set_mode(codec, mode);
}

mutex_unlock(&wm8994->accdet_lock);
Expand Down

0 comments on commit c3161f6

Please sign in to comment.