aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-evm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/davinci/davinci-evm.c')
-rw-r--r--sound/soc/davinci/davinci-evm.c48
1 files changed, 18 insertions, 30 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 623eb5e7c089..70ff3772079f 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -28,14 +28,11 @@
28 28
29#include "davinci-pcm.h" 29#include "davinci-pcm.h"
30#include "davinci-i2s.h" 30#include "davinci-i2s.h"
31#include "davinci-mcasp.h"
32 31
33struct snd_soc_card_drvdata_davinci { 32struct snd_soc_card_drvdata_davinci {
34 unsigned sysclk; 33 unsigned sysclk;
35}; 34};
36 35
37#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
38 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
39static int evm_hw_params(struct snd_pcm_substream *substream, 36static int evm_hw_params(struct snd_pcm_substream *substream,
40 struct snd_pcm_hw_params *params) 37 struct snd_pcm_hw_params *params)
41{ 38{
@@ -48,16 +45,6 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
48 unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) 45 unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *)
49 snd_soc_card_get_drvdata(soc_card))->sysclk; 46 snd_soc_card_get_drvdata(soc_card))->sysclk;
50 47
51 /* set codec DAI configuration */
52 ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
53 if (ret < 0)
54 return ret;
55
56 /* set cpu DAI configuration */
57 ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT);
58 if (ret < 0)
59 return ret;
60
61 /* set the codec system clock */ 48 /* set the codec system clock */
62 ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT); 49 ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
63 if (ret < 0) 50 if (ret < 0)
@@ -71,24 +58,10 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
71 return 0; 58 return 0;
72} 59}
73 60
74static int evm_spdif_hw_params(struct snd_pcm_substream *substream,
75 struct snd_pcm_hw_params *params)
76{
77 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
79
80 /* set cpu DAI configuration */
81 return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT);
82}
83
84static struct snd_soc_ops evm_ops = { 61static struct snd_soc_ops evm_ops = {
85 .hw_params = evm_hw_params, 62 .hw_params = evm_hw_params,
86}; 63};
87 64
88static struct snd_soc_ops evm_spdif_ops = {
89 .hw_params = evm_spdif_hw_params,
90};
91
92/* davinci-evm machine dapm widgets */ 65/* davinci-evm machine dapm widgets */
93static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { 66static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
94 SND_SOC_DAPM_HP("Headphone Jack", NULL), 67 SND_SOC_DAPM_HP("Headphone Jack", NULL),
@@ -165,6 +138,8 @@ static struct snd_soc_dai_link dm6446_evm_dai = {
165 .platform_name = "davinci-mcbsp", 138 .platform_name = "davinci-mcbsp",
166 .init = evm_aic3x_init, 139 .init = evm_aic3x_init,
167 .ops = &evm_ops, 140 .ops = &evm_ops,
141 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
142 SND_SOC_DAIFMT_IB_NF,
168}; 143};
169 144
170static struct snd_soc_dai_link dm355_evm_dai = { 145static struct snd_soc_dai_link dm355_evm_dai = {
@@ -176,6 +151,8 @@ static struct snd_soc_dai_link dm355_evm_dai = {
176 .platform_name = "davinci-mcbsp.1", 151 .platform_name = "davinci-mcbsp.1",
177 .init = evm_aic3x_init, 152 .init = evm_aic3x_init,
178 .ops = &evm_ops, 153 .ops = &evm_ops,
154 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
155 SND_SOC_DAIFMT_IB_NF,
179}; 156};
180 157
181static struct snd_soc_dai_link dm365_evm_dai = { 158static struct snd_soc_dai_link dm365_evm_dai = {
@@ -184,10 +161,12 @@ static struct snd_soc_dai_link dm365_evm_dai = {
184 .stream_name = "AIC3X", 161 .stream_name = "AIC3X",
185 .cpu_dai_name = "davinci-mcbsp", 162 .cpu_dai_name = "davinci-mcbsp",
186 .codec_dai_name = "tlv320aic3x-hifi", 163 .codec_dai_name = "tlv320aic3x-hifi",
187 .init = evm_aic3x_init,
188 .codec_name = "tlv320aic3x-codec.1-0018", 164 .codec_name = "tlv320aic3x-codec.1-0018",
189 .ops = &evm_ops,
190 .platform_name = "davinci-mcbsp", 165 .platform_name = "davinci-mcbsp",
166 .init = evm_aic3x_init,
167 .ops = &evm_ops,
168 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
169 SND_SOC_DAIFMT_IB_NF,
191#elif defined(CONFIG_SND_DM365_VOICE_CODEC) 170#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
192 .name = "Voice Codec - CQ93VC", 171 .name = "Voice Codec - CQ93VC",
193 .stream_name = "CQ93", 172 .stream_name = "CQ93",
@@ -208,6 +187,8 @@ static struct snd_soc_dai_link dm6467_evm_dai[] = {
208 .codec_name = "tlv320aic3x-codec.0-001a", 187 .codec_name = "tlv320aic3x-codec.0-001a",
209 .init = evm_aic3x_init, 188 .init = evm_aic3x_init,
210 .ops = &evm_ops, 189 .ops = &evm_ops,
190 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
191 SND_SOC_DAIFMT_IB_NF,
211 }, 192 },
212 { 193 {
213 .name = "McASP", 194 .name = "McASP",
@@ -216,7 +197,8 @@ static struct snd_soc_dai_link dm6467_evm_dai[] = {
216 .codec_dai_name = "dit-hifi", 197 .codec_dai_name = "dit-hifi",
217 .codec_name = "spdif_dit", 198 .codec_name = "spdif_dit",
218 .platform_name = "davinci-mcasp.1", 199 .platform_name = "davinci-mcasp.1",
219 .ops = &evm_spdif_ops, 200 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
201 SND_SOC_DAIFMT_IB_NF,
220 }, 202 },
221}; 203};
222 204
@@ -229,6 +211,8 @@ static struct snd_soc_dai_link da830_evm_dai = {
229 .platform_name = "davinci-mcasp.1", 211 .platform_name = "davinci-mcasp.1",
230 .init = evm_aic3x_init, 212 .init = evm_aic3x_init,
231 .ops = &evm_ops, 213 .ops = &evm_ops,
214 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
215 SND_SOC_DAIFMT_IB_NF,
232}; 216};
233 217
234static struct snd_soc_dai_link da850_evm_dai = { 218static struct snd_soc_dai_link da850_evm_dai = {
@@ -240,6 +224,8 @@ static struct snd_soc_dai_link da850_evm_dai = {
240 .platform_name = "davinci-mcasp.0", 224 .platform_name = "davinci-mcasp.0",
241 .init = evm_aic3x_init, 225 .init = evm_aic3x_init,
242 .ops = &evm_ops, 226 .ops = &evm_ops,
227 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
228 SND_SOC_DAIFMT_IB_NF,
243}; 229};
244 230
245/* davinci dm6446 evm audio machine driver */ 231/* davinci dm6446 evm audio machine driver */
@@ -336,6 +322,8 @@ static struct snd_soc_dai_link evm_dai_tlv320aic3x = {
336 .codec_dai_name = "tlv320aic3x-hifi", 322 .codec_dai_name = "tlv320aic3x-hifi",
337 .ops = &evm_ops, 323 .ops = &evm_ops,
338 .init = evm_aic3x_init, 324 .init = evm_aic3x_init,
325 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
326 SND_SOC_DAIFMT_IB_NF,
339}; 327};
340 328
341static const struct of_device_id davinci_evm_dt_ids[] = { 329static const struct of_device_id davinci_evm_dt_ids[] = {