aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/ep93xx
diff options
context:
space:
mode:
authorAlexander Sverdlin <subaparts@yandex.ru>2011-03-07 12:29:53 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-09 08:08:32 -0500
commit6d33cd771b779abd8faeaf63821c200ba36a63b1 (patch)
tree6b05d7274922a94dbe9e7c5ee058328092047c23 /sound/soc/ep93xx
parent5c3a12e96c9f3158602b2feac8583ae35c10b80e (diff)
ASoC: EDB93xx: Manage I2S rates according to datasheet for CS4271 CODEC.
Manage I2S rates according to datasheet for CS4271 CODEC in EDB93xx machine driver. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/ep93xx')
-rw-r--r--sound/soc/ep93xx/edb93xx.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c
index b270085227f3..d3aa15119d26 100644
--- a/sound/soc/ep93xx/edb93xx.c
+++ b/sound/soc/ep93xx/edb93xx.c
@@ -41,17 +41,17 @@ static int edb93xx_hw_params(struct snd_pcm_substream *substream,
41 struct snd_soc_dai *codec_dai = rtd->codec_dai; 41 struct snd_soc_dai *codec_dai = rtd->codec_dai;
42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
43 int err; 43 int err;
44 unsigned int mclk_rate;
44 unsigned int rate = params_rate(params); 45 unsigned int rate = params_rate(params);
46
45 /* 47 /*
46 * We set LRCLK equal to `rate' and SCLK = LRCLK * 64, 48 * According to CS4271 datasheet we use MCLK/LRCK=256 for
47 * because our sample size is 32 bit * 2 channels. 49 * rates below 50kHz and 128 for higher sample rates
48 * I2S standard permits us to transmit more bits than
49 * the codec uses.
50 * MCLK = SCLK * 4 is the best recommended value,
51 * but we have to fall back to ratio 2 for higher
52 * sample rates.
53 */ 50 */
54 unsigned int mclk_rate = rate * 64 * ((rate <= 48000) ? 4 : 2); 51 if (rate < 50000)
52 mclk_rate = rate * 64 * 4;
53 else
54 mclk_rate = rate * 64 * 2;
55 55
56 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | 56 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_IF | 57 SND_SOC_DAIFMT_NB_IF |