aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/blackfin/Kconfig18
-rw-r--r--sound/soc/blackfin/bf5xx-ad193x.c39
2 files changed, 19 insertions, 38 deletions
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index 16b88f5c26e2..906c349a00ea 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -56,6 +56,15 @@ config SND_SOC_BFIN_EVAL_ADAV80X
56 Note: This driver assumes that the ADAV80X digital record and playback 56 Note: This driver assumes that the ADAV80X digital record and playback
57 interfaces are connected to the first SPORT port on the BF5XX board. 57 interfaces are connected to the first SPORT port on the BF5XX board.
58 58
59config SND_BF5XX_SOC_AD193X
60 tristate "SoC AD193X Audio support for Blackfin"
61 depends on SND_BF5XX_I2S
62 select SND_BF5XX_SOC_I2S
63 select SND_SOC_AD193X
64 help
65 Say Y if you want to add support for AD193X codec on Blackfin.
66 This driver supports AD1936, AD1937, AD1938 and AD1939.
67
59config SND_BF5XX_SOC_AD73311 68config SND_BF5XX_SOC_AD73311
60 tristate "SoC AD73311 Audio support for Blackfin" 69 tristate "SoC AD73311 Audio support for Blackfin"
61 depends on SND_BF5XX_I2S 70 depends on SND_BF5XX_I2S
@@ -90,15 +99,6 @@ config SND_BF5XX_SOC_AD1836
90 help 99 help
91 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. 100 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
92 101
93config SND_BF5XX_SOC_AD193X
94 tristate "SoC AD193X Audio support for Blackfin"
95 depends on SND_BF5XX_TDM
96 select SND_BF5XX_SOC_TDM
97 select SND_SOC_AD193X
98 help
99 Say Y if you want to add support for AD193X codec on Blackfin.
100 This driver supports AD1936, AD1937, AD1938 and AD1939.
101
102config SND_BF5XX_AC97 102config SND_BF5XX_AC97
103 tristate "SoC AC97 Audio for the ADI BF5xx chip" 103 tristate "SoC AC97 Audio for the ADI BF5xx chip"
104 depends on BLACKFIN 104 depends on BLACKFIN
diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c
index ce773b31916f..603ad1f2b9b9 100644
--- a/sound/soc/blackfin/bf5xx-ad193x.c
+++ b/sound/soc/blackfin/bf5xx-ad193x.c
@@ -39,29 +39,16 @@
39 39
40#include "../codecs/ad193x.h" 40#include "../codecs/ad193x.h"
41 41
42#include "bf5xx-tdm.h"
43
44static struct snd_soc_card bf5xx_ad193x; 42static struct snd_soc_card bf5xx_ad193x;
45 43
46static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream, 44static int bf5xx_ad193x_link_init(struct snd_soc_pcm_runtime *rtd)
47 struct snd_pcm_hw_params *params)
48{ 45{
49 struct snd_soc_pcm_runtime *rtd = substream->private_data;
50 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 46 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
51 struct snd_soc_dai *codec_dai = rtd->codec_dai; 47 struct snd_soc_dai *codec_dai = rtd->codec_dai;
52 unsigned int clk = 0; 48 int ret;
53 unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7};
54 int ret = 0;
55
56 switch (params_rate(params)) {
57 case 48000:
58 clk = 24576000;
59 break;
60 }
61 49
62 /* set the codec system clock for DAC and ADC */ 50 /* set the codec system clock for DAC and ADC */
63 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 51 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 24576000, SND_SOC_CLOCK_IN);
64 SND_SOC_CLOCK_IN);
65 if (ret < 0) 52 if (ret < 0)
66 return ret; 53 return ret;
67 54
@@ -70,9 +57,7 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
70 if (ret < 0) 57 if (ret < 0)
71 return ret; 58 return ret;
72 59
73 /* set cpu DAI channel mapping */ 60 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xFF, 0xFF, 8, 32);
74 ret = snd_soc_dai_set_channel_map(cpu_dai, ARRAY_SIZE(channel_map),
75 channel_map, ARRAY_SIZE(channel_map), channel_map);
76 if (ret < 0) 61 if (ret < 0)
77 return ret; 62 return ret;
78 63
@@ -82,30 +67,26 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
82#define BF5XX_AD193X_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \ 67#define BF5XX_AD193X_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
83 SND_SOC_DAIFMT_CBM_CFM) 68 SND_SOC_DAIFMT_CBM_CFM)
84 69
85static struct snd_soc_ops bf5xx_ad193x_ops = {
86 .hw_params = bf5xx_ad193x_hw_params,
87};
88
89static struct snd_soc_dai_link bf5xx_ad193x_dai[] = { 70static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
90 { 71 {
91 .name = "ad193x", 72 .name = "ad193x",
92 .stream_name = "AD193X", 73 .stream_name = "AD193X",
93 .cpu_dai_name = "bfin-tdm.0", 74 .cpu_dai_name = "bfin-i2s.0",
94 .codec_dai_name ="ad193x-hifi", 75 .codec_dai_name ="ad193x-hifi",
95 .platform_name = "bfin-tdm-pcm-audio", 76 .platform_name = "bfin-i2s-pcm-audio",
96 .codec_name = "spi0.5", 77 .codec_name = "spi0.5",
97 .ops = &bf5xx_ad193x_ops,
98 .dai_fmt = BF5XX_AD193X_DAIFMT, 78 .dai_fmt = BF5XX_AD193X_DAIFMT,
79 .init = bf5xx_ad193x_link_init,
99 }, 80 },
100 { 81 {
101 .name = "ad193x", 82 .name = "ad193x",
102 .stream_name = "AD193X", 83 .stream_name = "AD193X",
103 .cpu_dai_name = "bfin-tdm.1", 84 .cpu_dai_name = "bfin-i2s.1",
104 .codec_dai_name ="ad193x-hifi", 85 .codec_dai_name ="ad193x-hifi",
105 .platform_name = "bfin-tdm-pcm-audio", 86 .platform_name = "bfin-i2s-pcm-audio",
106 .codec_name = "spi0.5", 87 .codec_name = "spi0.5",
107 .ops = &bf5xx_ad193x_ops,
108 .dai_fmt = BF5XX_AD193X_DAIFMT, 88 .dai_fmt = BF5XX_AD193X_DAIFMT,
89 .init = bf5xx_ad193x_link_init,
109 }, 90 },
110}; 91};
111 92