aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8962.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-25 12:53:43 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-26 06:48:37 -0400
commit3b8a6d80e5d02a827d882935b96c1c3c3b56c977 (patch)
tree58f5edc57e6c5e577466c8fc65999f35797edf2a /sound/soc/codecs/wm8962.c
parentc5f336cc003dfa071aaa7a01ed1c16232b227aa4 (diff)
ASoC: Support FLL lock interrupt on WM8962
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/codecs/wm8962.c')
-rw-r--r--sound/soc/codecs/wm8962.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 500011eb8b2b..d6b78b2a10df 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -58,6 +58,7 @@ struct wm8962_priv {
58 int bclk; /* Desired BCLK */ 58 int bclk; /* Desired BCLK */
59 int lrclk; 59 int lrclk;
60 60
61 struct completion fll_lock;
61 int fll_src; 62 int fll_src;
62 int fll_fref; 63 int fll_fref;
63 int fll_fout; 64 int fll_fout;
@@ -3178,6 +3179,7 @@ static int wm8962_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
3178 struct snd_soc_codec *codec = dai->codec; 3179 struct snd_soc_codec *codec = dai->codec;
3179 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 3180 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
3180 struct _fll_div fll_div; 3181 struct _fll_div fll_div;
3182 unsigned long timeout;
3181 int ret; 3183 int ret;
3182 int fll1 = snd_soc_read(codec, WM8962_FLL_CONTROL_1) & WM8962_FLL_ENA; 3184 int fll1 = snd_soc_read(codec, WM8962_FLL_CONTROL_1) & WM8962_FLL_ENA;
3183 3185
@@ -3244,6 +3246,11 @@ static int wm8962_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
3244 3246
3245 dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); 3247 dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout);
3246 3248
3249 /* This should be a massive overestimate */
3250 timeout = msecs_to_jiffies(1);
3251
3252 wait_for_completion_timeout(&wm8962->fll_lock, timeout);
3253
3247 wm8962->fll_fref = Fref; 3254 wm8962->fll_fref = Fref;
3248 wm8962->fll_fout = Fout; 3255 wm8962->fll_fout = Fout;
3249 wm8962->fll_src = source; 3256 wm8962->fll_src = source;
@@ -3340,6 +3347,11 @@ static irqreturn_t wm8962_irq(int irq, void *data)
3340 active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2); 3347 active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2);
3341 active &= ~mask; 3348 active &= ~mask;
3342 3349
3350 if (active & WM8962_FLL_LOCK_EINT) {
3351 dev_dbg(codec->dev, "FLL locked\n");
3352 complete(&wm8962->fll_lock);
3353 }
3354
3343 if (active & WM8962_FIFOS_ERR_EINT) 3355 if (active & WM8962_FIFOS_ERR_EINT)
3344 dev_err(codec->dev, "FIFO error\n"); 3356 dev_err(codec->dev, "FIFO error\n");
3345 3357
@@ -3712,6 +3724,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3712 3724
3713 wm8962->codec = codec; 3725 wm8962->codec = codec;
3714 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); 3726 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work);
3727 init_completion(&wm8962->fll_lock);
3715 3728
3716 codec->cache_sync = 1; 3729 codec->cache_sync = 1;
3717 codec->dapm.idle_bias_off = 1; 3730 codec->dapm.idle_bias_off = 1;
@@ -3868,9 +3881,10 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3868 i2c->irq, ret); 3881 i2c->irq, ret);
3869 /* Non-fatal */ 3882 /* Non-fatal */
3870 } else { 3883 } else {
3871 /* Enable error reporting IRQs by default */ 3884 /* Enable some IRQs by default */
3872 snd_soc_update_bits(codec, 3885 snd_soc_update_bits(codec,
3873 WM8962_INTERRUPT_STATUS_2_MASK, 3886 WM8962_INTERRUPT_STATUS_2_MASK,
3887 WM8962_FLL_LOCK_EINT |
3874 WM8962_TEMP_SHUT_EINT | 3888 WM8962_TEMP_SHUT_EINT |
3875 WM8962_FIFOS_ERR_EINT, 0); 3889 WM8962_FIFOS_ERR_EINT, 0);
3876 } 3890 }