Commit 6d33cd77 authored by Alexander Sverdlin's avatar Alexander Sverdlin Committed by Mark Brown

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: default avatarAlexander Sverdlin <subaparts@yandex.ru>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 5c3a12e9
...@@ -41,17 +41,17 @@ static int edb93xx_hw_params(struct snd_pcm_substream *substream, ...@@ -41,17 +41,17 @@ static int edb93xx_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int err; int err;
unsigned int mclk_rate;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
/* /*
* We set LRCLK equal to `rate' and SCLK = LRCLK * 64, * According to CS4271 datasheet we use MCLK/LRCK=256 for
* because our sample size is 32 bit * 2 channels. * rates below 50kHz and 128 for higher sample rates
* I2S standard permits us to transmit more bits than
* the codec uses.
* MCLK = SCLK * 4 is the best recommended value,
* but we have to fall back to ratio 2 for higher
* sample rates.
*/ */
unsigned int mclk_rate = rate * 64 * ((rate <= 48000) ? 4 : 2); if (rate < 50000)
mclk_rate = rate * 64 * 4;
else
mclk_rate = rate * 64 * 2;
err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_NB_IF |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment