aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8996.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-14 14:38:28 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-14 16:37:29 -0400
commit4eb98f45b77b00868dcebe4a0f00d2a36afd88c2 (patch)
treee503c903701b7bab1d2d7ab3e12c32e5c0419bc6 /sound/soc/codecs/wm8996.c
parent5ec65ee589fdaca7298b6303fd74ad6c121a8f38 (diff)
ASoC: wm8996: Add 44.1kHz support
The WM8996 specification has been updated to specify 44.1kHz as a supported sample rate. Update the driver to accept this configuration. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8996.c')
-rw-r--r--sound/soc/codecs/wm8996.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 40a124c9f15d..1fd635494045 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -1914,7 +1914,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream,
1914{ 1914{
1915 struct snd_soc_codec *codec = dai->codec; 1915 struct snd_soc_codec *codec = dai->codec;
1916 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); 1916 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
1917 int bits, i, bclk_rate; 1917 int bits, i, bclk_rate, best;
1918 int aifdata = 0; 1918 int aifdata = 0;
1919 int lrclk = 0; 1919 int lrclk = 0;
1920 int dsp = 0; 1920 int dsp = 0;
@@ -1963,14 +1963,11 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream,
1963 return bits; 1963 return bits;
1964 aifdata |= (bits << WM8996_AIF1TX_WL_SHIFT) | bits; 1964 aifdata |= (bits << WM8996_AIF1TX_WL_SHIFT) | bits;
1965 1965
1966 best = 0;
1966 for (i = 0; i < ARRAY_SIZE(dsp_divs); i++) { 1967 for (i = 0; i < ARRAY_SIZE(dsp_divs); i++) {
1967 if (dsp_divs[i] == params_rate(params)) 1968 if (abs(dsp_divs[i] - params_rate(params)) <
1968 break; 1969 abs(dsp_divs[best] - params_rate(params)))
1969 } 1970 best = i;
1970 if (i == ARRAY_SIZE(dsp_divs)) {
1971 dev_err(codec->dev, "Unsupported sample rate %dHz\n",
1972 params_rate(params));
1973 return -EINVAL;
1974 } 1971 }
1975 dsp |= i << dsp_shift; 1972 dsp |= i << dsp_shift;
1976 1973
@@ -2030,13 +2027,16 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
2030 } 2027 }
2031 2028
2032 switch (wm8996->sysclk) { 2029 switch (wm8996->sysclk) {
2030 case 5644800:
2033 case 6144000: 2031 case 6144000:
2034 snd_soc_update_bits(codec, WM8996_AIF_RATE, 2032 snd_soc_update_bits(codec, WM8996_AIF_RATE,
2035 WM8996_SYSCLK_RATE, 0); 2033 WM8996_SYSCLK_RATE, 0);
2036 break; 2034 break;
2035 case 22579200:
2037 case 24576000: 2036 case 24576000:
2038 ratediv = WM8996_SYSCLK_DIV; 2037 ratediv = WM8996_SYSCLK_DIV;
2039 wm8996->sysclk /= 2; 2038 wm8996->sysclk /= 2;
2039 case 11289600:
2040 case 12288000: 2040 case 12288000:
2041 snd_soc_update_bits(codec, WM8996_AIF_RATE, 2041 snd_soc_update_bits(codec, WM8996_AIF_RATE,
2042 WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); 2042 WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE);
@@ -3060,7 +3060,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = {
3060}; 3060};
3061 3061
3062#define WM8996_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 3062#define WM8996_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
3063 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000) 3063 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
3064 SNDRV_PCM_RATE_48000)
3064#define WM8996_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ 3065#define WM8996_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\
3065 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\ 3066 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\
3066 SNDRV_PCM_FMTBIT_S32_LE) 3067 SNDRV_PCM_FMTBIT_S32_LE)