Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293459
b: refs/heads/master
c: 4752a88
h: refs/heads/master
i:
  293457: 4a8a36f
  293455: 1562816
v: v3
  • Loading branch information
Mark Brown committed Mar 6, 2012
1 parent ac60a68 commit d6b96be
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 30 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: 56cea3f1e7db0ccde9e2ac66df2f920c73c419ef
refs/heads/master: 4752a887190ff38175be47aae26a821e8941b96e
77 changes: 48 additions & 29 deletions trunk/sound/soc/codecs/wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,37 +685,24 @@ 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)
if (mode == wm8994->jackdet_mode)
return;

snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK, mode);

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;
}
wm8994->jackdet_mode = mode;

default:
break;
}
/* Always use audio mode to detect while the system is active */
if (mode != WM1811_JACKDET_MODE_NONE)
mode = WM1811_JACKDET_MODE_AUDIO;

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

static void active_reference(struct snd_soc_codec *codec)
Expand Down Expand Up @@ -2749,7 +2736,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
};

#ifdef CONFIG_PM
static int wm8994_suspend(struct snd_soc_codec *codec)
static int wm8994_codec_suspend(struct snd_soc_codec *codec)
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = wm8994->wm8994;
Expand Down Expand Up @@ -2783,7 +2770,7 @@ static int wm8994_suspend(struct snd_soc_codec *codec)
return 0;
}

static int wm8994_resume(struct snd_soc_codec *codec)
static int wm8994_codec_resume(struct snd_soc_codec *codec)
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = wm8994->wm8994;
Expand Down Expand Up @@ -2842,8 +2829,8 @@ static int wm8994_resume(struct snd_soc_codec *codec)
return 0;
}
#else
#define wm8994_suspend NULL
#define wm8994_resume NULL
#define wm8994_codec_suspend NULL
#define wm8994_codec_resume NULL
#endif

static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
Expand Down Expand Up @@ -3955,8 +3942,8 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
.probe = wm8994_codec_probe,
.remove = wm8994_codec_remove,
.suspend = wm8994_suspend,
.resume = wm8994_resume,
.suspend = wm8994_codec_suspend,
.resume = wm8994_codec_resume,
.set_bias_level = wm8994_set_bias_level,
};

Expand All @@ -3983,11 +3970,43 @@ static int __devexit wm8994_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM_SLEEP
static int wm8994_suspend(struct device *dev)
{
struct wm8994_priv *wm8994 = dev_get_drvdata(dev);

/* Drop down to power saving mode when system is suspended */
if (wm8994->jackdet && !wm8994->active_refcount)
regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK,
wm8994->jackdet_mode);

return 0;
}

static int wm8994_resume(struct device *dev)
{
struct wm8994_priv *wm8994 = dev_get_drvdata(dev);

if (wm8994->jackdet && wm8994->jack_cb)
regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2,
WM1811_JACKDET_MODE_MASK,
WM1811_JACKDET_MODE_AUDIO);

return 0;
}
#endif

static const struct dev_pm_ops wm8994_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(wm8994_suspend, wm8994_resume)
};

static struct platform_driver wm8994_codec_driver = {
.driver = {
.name = "wm8994-codec",
.owner = THIS_MODULE,
},
.name = "wm8994-codec",
.owner = THIS_MODULE,
.pm = &wm8994_pm_ops,
},
.probe = wm8994_probe,
.remove = __devexit_p(wm8994_remove),
};
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/codecs/wm8994.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct wm8994_priv {
bool jack_mic;
int btn_mask;
bool jackdet;
int jackdet_mode;

wm8958_micdet_cb jack_cb;
void *jack_cb_data;
Expand Down

0 comments on commit d6b96be

Please sign in to comment.