Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[deliverable/linux.git] / sound / soc / blackfin / bf5xx-ad193x.c
index d3ccb926b5e43c9004a6bf6e35e2606bdfa28629..d6651c033cb711a35c69dcde2320c213e50a5f5b 100644 (file)
 #include <asm/portmux.h>
 
 #include "../codecs/ad193x.h"
-#include "bf5xx-sport.h"
 
 #include "bf5xx-tdm-pcm.h"
 #include "bf5xx-tdm.h"
 
 static struct snd_soc_card bf5xx_ad193x;
 
-static int bf5xx_ad193x_startup(struct snd_pcm_substream *substream)
-{
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
-       snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
-       return 0;
-}
-
 static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       unsigned int clk = 0;
        unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7};
        int ret = 0;
+
+       switch (params_rate(params)) {
+       case 48000:
+               clk = 12288000;
+               break;
+       }
+
        /* set cpu DAI configuration */
        ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
                SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
@@ -74,6 +72,12 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
        if (ret < 0)
                return ret;
 
+       /* set the codec system clock for DAC and ADC */
+       ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
+               SND_SOC_CLOCK_IN);
+       if (ret < 0)
+               return ret;
+
        /* set codec DAI slots, 8 channels, all channels are enabled */
        ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xFF, 0xFF, 8, 32);
        if (ret < 0)
@@ -89,23 +93,33 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
 }
 
 static struct snd_soc_ops bf5xx_ad193x_ops = {
-       .startup = bf5xx_ad193x_startup,
        .hw_params = bf5xx_ad193x_hw_params,
 };
 
-static struct snd_soc_dai_link bf5xx_ad193x_dai = {
-       .name = "ad193x",
-       .stream_name = "AD193X",
-       .cpu_dai_name = "bf5xx-tdm",
-       .codec_dai_name ="ad193x-hifi",
-       .platform_name = "bf5xx-tdm-pcm-audio",
-       .codec_name = "ad193x-codec.5",
-       .ops = &bf5xx_ad193x_ops,
+static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
+       {
+               .name = "ad193x",
+               .stream_name = "AD193X",
+               .cpu_dai_name = "bfin-tdm.0",
+               .codec_dai_name ="ad193x-hifi",
+               .platform_name = "bfin-tdm-pcm-audio",
+               .codec_name = "ad193x.5",
+               .ops = &bf5xx_ad193x_ops,
+       },
+       {
+               .name = "ad193x",
+               .stream_name = "AD193X",
+               .cpu_dai_name = "bfin-tdm.1",
+               .codec_dai_name ="ad193x-hifi",
+               .platform_name = "bfin-tdm-pcm-audio",
+               .codec_name = "ad193x.5",
+               .ops = &bf5xx_ad193x_ops,
+       },
 };
 
 static struct snd_soc_card bf5xx_ad193x = {
-       .name = "bf5xx_ad193x",
-       .dai_link = &bf5xx_ad193x_dai,
+       .name = "bfin-ad193x",
+       .dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM],
        .num_links = 1,
 };
 
This page took 0.028023 seconds and 5 git commands to generate.