Commit d6e7aae8 authored by David Brownell's avatar David Brownell Committed by Kevin Hilman

ASoC clocking fixes for davinci-evm.c

Let's have audio playback not sound like chipmunks, 'k? :)

ASP1 on the DM355 EVM uses a 27 MHz external audio clock, not
the slower clock used with ASP0 on the DM6446 EVM.

Also, that slower ASP0 clock on the DM6446 is 12.288 MHz,
not 22.5792 MHz ... 48 KHz sample rate (x256), not a double
speed 44.1 KHz sample rate (which could be done, but isn't
what the board init code now sets up).
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 93b3c455
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "davinci-pcm.h" #include "davinci-pcm.h"
#include "davinci-i2s.h" #include "davinci-i2s.h"
#define EVM_CODEC_CLOCK 22579200
static int evm_hw_params(struct snd_pcm_substream *substream, static int evm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
...@@ -38,6 +37,21 @@ static int evm_hw_params(struct snd_pcm_substream *substream, ...@@ -38,6 +37,21 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
int ret = 0; int ret = 0;
unsigned sysclk;
/* ASP1 on DM355 EVM is clocked by an external oscillator */
if (machine_is_davinci_dm355_evm())
sysclk = 27000000;
/* ASP0 in DM6446 EVM is clocked by U55, as configured by
* board-dm644x-evm.c using GPIOs from U18. There are six
* options; here we "know" we use a 48 KHz sample rate.
*/
else if (machine_is_davinci_evm())
sysclk = 12288000;
else
return -EINVAL;
/* set codec DAI configuration */ /* set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
...@@ -52,8 +66,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream, ...@@ -52,8 +66,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
/* set the codec system clock */ /* set the codec system clock */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, EVM_CODEC_CLOCK, ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
SND_SOC_CLOCK_OUT);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
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