aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r--sound/soc/blackfin/bf5xx-ad1836.c17
-rw-r--r--sound/soc/blackfin/bf5xx-ad193x.c17
-rw-r--r--sound/soc/blackfin/bf5xx-ad73311.c29
-rw-r--r--sound/soc/blackfin/bf5xx-ssm2602.c20
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1373.c13
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1701.c16
-rw-r--r--sound/soc/blackfin/bfin-eval-adav80x.c13
7 files changed, 27 insertions, 98 deletions
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
index 60962ce6cd4d..d542d4063771 100644
--- a/sound/soc/blackfin/bf5xx-ad1836.c
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -40,20 +40,8 @@ static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
40{ 40{
41 struct snd_soc_pcm_runtime *rtd = substream->private_data; 41 struct snd_soc_pcm_runtime *rtd = substream->private_data;
42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
43 struct snd_soc_dai *codec_dai = rtd->codec_dai;
44 unsigned int channel_map[] = {0, 4, 1, 5, 2, 6, 3, 7}; 43 unsigned int channel_map[] = {0, 4, 1, 5, 2, 6, 3, 7};
45 int ret = 0; 44 int ret = 0;
46 /* set cpu DAI configuration */
47 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
48 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
49 if (ret < 0)
50 return ret;
51
52 /* set codec DAI configuration */
53 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
54 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
55 if (ret < 0)
56 return ret;
57 45
58 /* set cpu DAI channel mapping */ 46 /* set cpu DAI channel mapping */
59 ret = snd_soc_dai_set_channel_map(cpu_dai, ARRAY_SIZE(channel_map), 47 ret = snd_soc_dai_set_channel_map(cpu_dai, ARRAY_SIZE(channel_map),
@@ -68,6 +56,9 @@ static struct snd_soc_ops bf5xx_ad1836_ops = {
68 .hw_params = bf5xx_ad1836_hw_params, 56 .hw_params = bf5xx_ad1836_hw_params,
69}; 57};
70 58
59#define BF5XX_AD1836_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
60 SND_SOC_DAIFMT_CBM_CFM)
61
71static struct snd_soc_dai_link bf5xx_ad1836_dai[] = { 62static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
72 { 63 {
73 .name = "ad1836", 64 .name = "ad1836",
@@ -77,6 +68,7 @@ static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
77 .platform_name = "bfin-tdm-pcm-audio", 68 .platform_name = "bfin-tdm-pcm-audio",
78 .codec_name = "spi0.4", 69 .codec_name = "spi0.4",
79 .ops = &bf5xx_ad1836_ops, 70 .ops = &bf5xx_ad1836_ops,
71 .dai_fmt = BF5XX_AD1836_DAIFMT,
80 }, 72 },
81 { 73 {
82 .name = "ad1836", 74 .name = "ad1836",
@@ -86,6 +78,7 @@ static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
86 .platform_name = "bfin-tdm-pcm-audio", 78 .platform_name = "bfin-tdm-pcm-audio",
87 .codec_name = "spi0.4", 79 .codec_name = "spi0.4",
88 .ops = &bf5xx_ad1836_ops, 80 .ops = &bf5xx_ad1836_ops,
81 .dai_fmt = BF5XX_AD1836_DAIFMT,
89 }, 82 },
90}; 83};
91 84
diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c
index 2d8d82dbc159..0e55e9f2a514 100644
--- a/sound/soc/blackfin/bf5xx-ad193x.c
+++ b/sound/soc/blackfin/bf5xx-ad193x.c
@@ -60,18 +60,6 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
60 break; 60 break;
61 } 61 }
62 62
63 /* set cpu DAI configuration */
64 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
65 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
66 if (ret < 0)
67 return ret;
68
69 /* set codec DAI configuration */
70 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
71 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
72 if (ret < 0)
73 return ret;
74
75 /* set the codec system clock for DAC and ADC */ 63 /* set the codec system clock for DAC and ADC */
76 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 64 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
77 SND_SOC_CLOCK_IN); 65 SND_SOC_CLOCK_IN);
@@ -92,6 +80,9 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
92 return 0; 80 return 0;
93} 81}
94 82
83#define BF5XX_AD193X_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
84 SND_SOC_DAIFMT_CBM_CFM)
85
95static struct snd_soc_ops bf5xx_ad193x_ops = { 86static struct snd_soc_ops bf5xx_ad193x_ops = {
96 .hw_params = bf5xx_ad193x_hw_params, 87 .hw_params = bf5xx_ad193x_hw_params,
97}; 88};
@@ -105,6 +96,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
105 .platform_name = "bfin-tdm-pcm-audio", 96 .platform_name = "bfin-tdm-pcm-audio",
106 .codec_name = "spi0.5", 97 .codec_name = "spi0.5",
107 .ops = &bf5xx_ad193x_ops, 98 .ops = &bf5xx_ad193x_ops,
99 .dai_fmt = BF5XX_AD193X_DAIFMT,
108 }, 100 },
109 { 101 {
110 .name = "ad193x", 102 .name = "ad193x",
@@ -114,6 +106,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
114 .platform_name = "bfin-tdm-pcm-audio", 106 .platform_name = "bfin-tdm-pcm-audio",
115 .codec_name = "spi0.5", 107 .codec_name = "spi0.5",
116 .ops = &bf5xx_ad193x_ops, 108 .ops = &bf5xx_ad193x_ops,
109 .dai_fmt = BF5XX_AD193X_DAIFMT,
117 }, 110 },
118}; 111};
119 112
diff --git a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c
index 8e49508596da..61cc91d4a028 100644
--- a/sound/soc/blackfin/bf5xx-ad73311.c
+++ b/sound/soc/blackfin/bf5xx-ad73311.c
@@ -145,29 +145,8 @@ static int bf5xx_probe(struct snd_soc_card *card)
145 return 0; 145 return 0;
146} 146}
147 147
148static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, 148#define BF5XX_AD7311_DAI_FMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | \
149 struct snd_pcm_hw_params *params) 149 SND_SOC_DAIFMT_CBM_CFM)
150{
151 struct snd_soc_pcm_runtime *rtd = substream->private_data;
152 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
153 int ret = 0;
154
155 pr_debug("%s rate %d format %x\n", __func__, params_rate(params),
156 params_format(params));
157
158 /* set cpu DAI configuration */
159 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
160 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
161 if (ret < 0)
162 return ret;
163
164 return 0;
165}
166
167
168static struct snd_soc_ops bf5xx_ad73311_ops = {
169 .hw_params = bf5xx_ad73311_hw_params,
170};
171 150
172static struct snd_soc_dai_link bf5xx_ad73311_dai[] = { 151static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
173 { 152 {
@@ -177,7 +156,7 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
177 .codec_dai_name = "ad73311-hifi", 156 .codec_dai_name = "ad73311-hifi",
178 .platform_name = "bfin-i2s-pcm-audio", 157 .platform_name = "bfin-i2s-pcm-audio",
179 .codec_name = "ad73311", 158 .codec_name = "ad73311",
180 .ops = &bf5xx_ad73311_ops, 159 .dai_fmt = BF5XX_AD7311_DAI_FMT,
181 }, 160 },
182 { 161 {
183 .name = "ad73311", 162 .name = "ad73311",
@@ -186,7 +165,7 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
186 .codec_dai_name = "ad73311-hifi", 165 .codec_dai_name = "ad73311-hifi",
187 .platform_name = "bfin-i2s-pcm-audio", 166 .platform_name = "bfin-i2s-pcm-audio",
188 .codec_name = "ad73311", 167 .codec_name = "ad73311",
189 .ops = &bf5xx_ad73311_ops, 168 .dai_fmt = BF5XX_AD7311_DAI_FMT,
190 }, 169 },
191}; 170};
192 171
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c
index 030303238042..df3ac73f8778 100644
--- a/sound/soc/blackfin/bf5xx-ssm2602.c
+++ b/sound/soc/blackfin/bf5xx-ssm2602.c
@@ -49,7 +49,6 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
49{ 49{
50 struct snd_soc_pcm_runtime *rtd = substream->private_data; 50 struct snd_soc_pcm_runtime *rtd = substream->private_data;
51 struct snd_soc_dai *codec_dai = rtd->codec_dai; 51 struct snd_soc_dai *codec_dai = rtd->codec_dai;
52 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
53 unsigned int clk = 0; 52 unsigned int clk = 0;
54 int ret = 0; 53 int ret = 0;
55 54
@@ -75,21 +74,6 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
75 break; 74 break;
76 } 75 }
77 76
78 /*
79 * CODEC is master for BCLK and LRC in this configuration.
80 */
81
82 /* set codec DAI configuration */
83 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
84 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
85 if (ret < 0)
86 return ret;
87 /* set cpu DAI configuration */
88 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
89 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
90 if (ret < 0)
91 return ret;
92
93 ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, clk, 77 ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, clk,
94 SND_SOC_CLOCK_IN); 78 SND_SOC_CLOCK_IN);
95 if (ret < 0) 79 if (ret < 0)
@@ -102,6 +86,10 @@ static struct snd_soc_ops bf5xx_ssm2602_ops = {
102 .hw_params = bf5xx_ssm2602_hw_params, 86 .hw_params = bf5xx_ssm2602_hw_params,
103}; 87};
104 88
89/* CODEC is master for BCLK and LRC in this configuration. */
90#define BF5XX_SSM2602_DAIFMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
91 SND_SOC_DAIFMT_CBM_CFM)
92
105static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { 93static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
106 { 94 {
107 .name = "ssm2602", 95 .name = "ssm2602",
diff --git a/sound/soc/blackfin/bfin-eval-adau1373.c b/sound/soc/blackfin/bfin-eval-adau1373.c
index 26b271c62efa..f3adbdbdd5e1 100644
--- a/sound/soc/blackfin/bfin-eval-adau1373.c
+++ b/sound/soc/blackfin/bfin-eval-adau1373.c
@@ -67,21 +67,10 @@ static int bfin_eval_adau1373_hw_params(struct snd_pcm_substream *substream,
67 struct snd_pcm_hw_params *params) 67 struct snd_pcm_hw_params *params)
68{ 68{
69 struct snd_soc_pcm_runtime *rtd = substream->private_data; 69 struct snd_soc_pcm_runtime *rtd = substream->private_data;
70 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
71 struct snd_soc_dai *codec_dai = rtd->codec_dai; 70 struct snd_soc_dai *codec_dai = rtd->codec_dai;
72 int ret; 71 int ret;
73 int pll_rate; 72 int pll_rate;
74 73
75 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
76 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
77 if (ret)
78 return ret;
79
80 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
81 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
82 if (ret)
83 return ret;
84
85 switch (params_rate(params)) { 74 switch (params_rate(params)) {
86 case 48000: 75 case 48000:
87 case 8000: 76 case 8000:
@@ -143,6 +132,8 @@ static struct snd_soc_dai_link bfin_eval_adau1373_dai = {
143 .codec_name = "adau1373.0-001a", 132 .codec_name = "adau1373.0-001a",
144 .ops = &bfin_eval_adau1373_ops, 133 .ops = &bfin_eval_adau1373_ops,
145 .init = bfin_eval_adau1373_codec_init, 134 .init = bfin_eval_adau1373_codec_init,
135 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
136 SND_SOC_DAIFMT_CBM_CFM,
146}; 137};
147 138
148static struct snd_soc_card bfin_eval_adau1373 = { 139static struct snd_soc_card bfin_eval_adau1373 = {
diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c
index c0064fa1dca6..b0531fc9d814 100644
--- a/sound/soc/blackfin/bfin-eval-adau1701.c
+++ b/sound/soc/blackfin/bfin-eval-adau1701.c
@@ -37,20 +37,9 @@ static int bfin_eval_adau1701_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params) 37 struct snd_pcm_hw_params *params)
38{ 38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data; 39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
41 struct snd_soc_dai *codec_dai = rtd->codec_dai; 40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
42 int ret; 41 int ret;
43 42
44 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
45 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
46 if (ret)
47 return ret;
48
49 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
50 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
51 if (ret)
52 return ret;
53
54 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000, 43 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000,
55 SND_SOC_CLOCK_IN); 44 SND_SOC_CLOCK_IN);
56 45
@@ -61,6 +50,9 @@ static struct snd_soc_ops bfin_eval_adau1701_ops = {
61 .hw_params = bfin_eval_adau1701_hw_params, 50 .hw_params = bfin_eval_adau1701_hw_params,
62}; 51};
63 52
53#define BFIN_EVAL_ADAU1701_DAI_FMT (SND_SOC_DAIFMT_I2S | \
54 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)
55
64static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = { 56static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
65 { 57 {
66 .name = "adau1701", 58 .name = "adau1701",
@@ -70,6 +62,7 @@ static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
70 .platform_name = "bfin-i2s-pcm-audio", 62 .platform_name = "bfin-i2s-pcm-audio",
71 .codec_name = "adau1701.0-0034", 63 .codec_name = "adau1701.0-0034",
72 .ops = &bfin_eval_adau1701_ops, 64 .ops = &bfin_eval_adau1701_ops,
65 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
73 }, 66 },
74 { 67 {
75 .name = "adau1701", 68 .name = "adau1701",
@@ -79,6 +72,7 @@ static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
79 .platform_name = "bfin-i2s-pcm-audio", 72 .platform_name = "bfin-i2s-pcm-audio",
80 .codec_name = "adau1701.0-0034", 73 .codec_name = "adau1701.0-0034",
81 .ops = &bfin_eval_adau1701_ops, 74 .ops = &bfin_eval_adau1701_ops,
75 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
82 }, 76 },
83}; 77};
84 78
diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c
index 4ef079f95e2e..84b09987b7f3 100644
--- a/sound/soc/blackfin/bfin-eval-adav80x.c
+++ b/sound/soc/blackfin/bfin-eval-adav80x.c
@@ -34,20 +34,9 @@ static int bfin_eval_adav80x_hw_params(struct snd_pcm_substream *substream,
34 struct snd_pcm_hw_params *params) 34 struct snd_pcm_hw_params *params)
35{ 35{
36 struct snd_soc_pcm_runtime *rtd = substream->private_data; 36 struct snd_soc_pcm_runtime *rtd = substream->private_data;
37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
38 struct snd_soc_dai *codec_dai = rtd->codec_dai; 37 struct snd_soc_dai *codec_dai = rtd->codec_dai;
39 int ret; 38 int ret;
40 39
41 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
42 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
43 if (ret)
44 return ret;
45
46 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
47 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
48 if (ret)
49 return ret;
50
51 ret = snd_soc_dai_set_pll(codec_dai, ADAV80X_PLL1, ADAV80X_PLL_SRC_XTAL, 40 ret = snd_soc_dai_set_pll(codec_dai, ADAV80X_PLL1, ADAV80X_PLL_SRC_XTAL,
52 27000000, params_rate(params) * 256); 41 27000000, params_rate(params) * 256);
53 if (ret) 42 if (ret)
@@ -88,6 +77,8 @@ static struct snd_soc_dai_link bfin_eval_adav80x_dais[] = {
88 .platform_name = "bfin-i2s-pcm-audio", 77 .platform_name = "bfin-i2s-pcm-audio",
89 .init = bfin_eval_adav80x_codec_init, 78 .init = bfin_eval_adav80x_codec_init,
90 .ops = &bfin_eval_adav80x_ops, 79 .ops = &bfin_eval_adav80x_ops,
80 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
81 SND_SOC_DAIFMT_CBM_CFM,
91 }, 82 },
92}; 83};
93 84