diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-05 07:55:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-10 06:11:22 -0400 |
commit | 20dc24a951f4792070803d8f1838c8ed3f4e5d57 (patch) | |
tree | b111a1254243eb8ae8901f1a3448802900c752e4 | |
parent | 34ff0f95b1d7afc707f121ea3ae6b211fc176fbd (diff) |
ASoC: wm8994: Implement FLL bypass support
Later WM8994 class devices can bypass the FLL from BCLK. Do this
automatically when the FLL input and output frequencies match up.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8994.c | 19 | ||||
-rw-r--r-- | sound/soc/codecs/wm8994.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 8b05e78b11c..01ecdb56ecd 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -1977,6 +1977,14 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, | |||
1977 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, | 1977 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, |
1978 | WM8994_FLL1_ENA, 0); | 1978 | WM8994_FLL1_ENA, 0); |
1979 | 1979 | ||
1980 | if (wm8994->fll_byp && src == WM8994_FLL_SRC_BCLK && | ||
1981 | freq_in == freq_out) { | ||
1982 | dev_dbg(codec->dev, "Bypassing FLL%d\n", id + 1); | ||
1983 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, | ||
1984 | WM8958_FLL1_BYP, WM8958_FLL1_BYP); | ||
1985 | goto out; | ||
1986 | } | ||
1987 | |||
1980 | reg = (fll.outdiv << WM8994_FLL1_OUTDIV_SHIFT) | | 1988 | reg = (fll.outdiv << WM8994_FLL1_OUTDIV_SHIFT) | |
1981 | (fll.fll_fratio << WM8994_FLL1_FRATIO_SHIFT); | 1989 | (fll.fll_fratio << WM8994_FLL1_FRATIO_SHIFT); |
1982 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_2 + reg_offset, | 1990 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_2 + reg_offset, |
@@ -1991,6 +1999,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, | |||
1991 | fll.n << WM8994_FLL1_N_SHIFT); | 1999 | fll.n << WM8994_FLL1_N_SHIFT); |
1992 | 2000 | ||
1993 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, | 2001 | snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, |
2002 | WM8958_FLL1_BYP | | ||
1994 | WM8994_FLL1_REFCLK_DIV_MASK | | 2003 | WM8994_FLL1_REFCLK_DIV_MASK | |
1995 | WM8994_FLL1_REFCLK_SRC_MASK, | 2004 | WM8994_FLL1_REFCLK_SRC_MASK, |
1996 | (fll.clk_ref_div << WM8994_FLL1_REFCLK_DIV_SHIFT) | | 2005 | (fll.clk_ref_div << WM8994_FLL1_REFCLK_DIV_SHIFT) | |
@@ -2053,6 +2062,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, | |||
2053 | } | 2062 | } |
2054 | } | 2063 | } |
2055 | 2064 | ||
2065 | out: | ||
2056 | wm8994->fll[id].in = freq_in; | 2066 | wm8994->fll[id].in = freq_in; |
2057 | wm8994->fll[id].out = freq_out; | 2067 | wm8994->fll[id].out = freq_out; |
2058 | wm8994->fll[id].src = src; | 2068 | wm8994->fll[id].src = src; |
@@ -3579,6 +3589,14 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3579 | case WM8958: | 3589 | case WM8958: |
3580 | wm8994->hubs.dcs_readback_mode = 1; | 3590 | wm8994->hubs.dcs_readback_mode = 1; |
3581 | wm8994->hubs.hp_startup_mode = 1; | 3591 | wm8994->hubs.hp_startup_mode = 1; |
3592 | |||
3593 | switch (wm8994->revision) { | ||
3594 | case 0: | ||
3595 | break; | ||
3596 | default: | ||
3597 | wm8994->fll_byp = true; | ||
3598 | break; | ||
3599 | } | ||
3582 | break; | 3600 | break; |
3583 | 3601 | ||
3584 | case WM1811: | 3602 | case WM1811: |
@@ -3586,6 +3604,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3586 | wm8994->hubs.no_series_update = 1; | 3604 | wm8994->hubs.no_series_update = 1; |
3587 | wm8994->hubs.hp_startup_mode = 1; | 3605 | wm8994->hubs.hp_startup_mode = 1; |
3588 | wm8994->hubs.no_cache_class_w = true; | 3606 | wm8994->hubs.no_cache_class_w = true; |
3607 | wm8994->fll_byp = true; | ||
3589 | 3608 | ||
3590 | switch (wm8994->revision) { | 3609 | switch (wm8994->revision) { |
3591 | case 0: | 3610 | case 0: |
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index c724112998d..91650bba205 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h | |||
@@ -79,6 +79,7 @@ struct wm8994_priv { | |||
79 | struct wm8994_fll_config fll[2], fll_suspend[2]; | 79 | struct wm8994_fll_config fll[2], fll_suspend[2]; |
80 | struct completion fll_locked[2]; | 80 | struct completion fll_locked[2]; |
81 | bool fll_locked_irq; | 81 | bool fll_locked_irq; |
82 | bool fll_byp; | ||
82 | 83 | ||
83 | int vmid_refcount; | 84 | int vmid_refcount; |
84 | int active_refcount; | 85 | int active_refcount; |