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.c144
1 files changed, 94 insertions, 50 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 58fd1cbedd88..46c1b0cb1d1b 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -27,9 +27,10 @@
27#include <mach/mux.h> 27#include <mach/mux.h>
28 28
29#include "../codecs/tlv320aic3x.h" 29#include "../codecs/tlv320aic3x.h"
30#include "../codecs/spdif_transciever.h"
30#include "davinci-pcm.h" 31#include "davinci-pcm.h"
31#include "davinci-i2s.h" 32#include "davinci-i2s.h"
32 33#include "davinci-mcasp.h"
33 34
34#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ 35#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
35 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) 36 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
@@ -43,7 +44,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
43 unsigned sysclk; 44 unsigned sysclk;
44 45
45 /* ASP1 on DM355 EVM is clocked by an external oscillator */ 46 /* ASP1 on DM355 EVM is clocked by an external oscillator */
46 if (machine_is_davinci_dm355_evm()) 47 if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm())
47 sysclk = 27000000; 48 sysclk = 27000000;
48 49
49 /* ASP0 in DM6446 EVM is clocked by U55, as configured by 50 /* ASP0 in DM6446 EVM is clocked by U55, as configured by
@@ -53,6 +54,10 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
53 else if (machine_is_davinci_evm()) 54 else if (machine_is_davinci_evm())
54 sysclk = 12288000; 55 sysclk = 12288000;
55 56
57 else if (machine_is_davinci_da830_evm() ||
58 machine_is_davinci_da850_evm())
59 sysclk = 24576000;
60
56 else 61 else
57 return -EINVAL; 62 return -EINVAL;
58 63
@@ -144,6 +149,32 @@ static struct snd_soc_dai_link evm_dai = {
144 .ops = &evm_ops, 149 .ops = &evm_ops,
145}; 150};
146 151
152static struct snd_soc_dai_link dm6467_evm_dai[] = {
153 {
154 .name = "TLV320AIC3X",
155 .stream_name = "AIC3X",
156 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI],
157 .codec_dai = &aic3x_dai,
158 .init = evm_aic3x_init,
159 .ops = &evm_ops,
160 },
161 {
162 .name = "McASP",
163 .stream_name = "spdif",
164 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_DIT_DAI],
165 .codec_dai = &dit_stub_dai,
166 .ops = &evm_ops,
167 },
168};
169static struct snd_soc_dai_link da8xx_evm_dai = {
170 .name = "TLV320AIC3X",
171 .stream_name = "AIC3X",
172 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI],
173 .codec_dai = &aic3x_dai,
174 .init = evm_aic3x_init,
175 .ops = &evm_ops,
176};
177
147/* davinci-evm audio machine driver */ 178/* davinci-evm audio machine driver */
148static struct snd_soc_card snd_soc_card_evm = { 179static struct snd_soc_card snd_soc_card_evm = {
149 .name = "DaVinci EVM", 180 .name = "DaVinci EVM",
@@ -152,12 +183,45 @@ static struct snd_soc_card snd_soc_card_evm = {
152 .num_links = 1, 183 .num_links = 1,
153}; 184};
154 185
186/* davinci dm6467 evm audio machine driver */
187static struct snd_soc_card dm6467_snd_soc_card_evm = {
188 .name = "DaVinci DM6467 EVM",
189 .platform = &davinci_soc_platform,
190 .dai_link = dm6467_evm_dai,
191 .num_links = ARRAY_SIZE(dm6467_evm_dai),
192};
193
194static struct snd_soc_card da830_snd_soc_card = {
195 .name = "DA830/OMAP-L137 EVM",
196 .dai_link = &da8xx_evm_dai,
197 .platform = &davinci_soc_platform,
198 .num_links = 1,
199};
200
201static struct snd_soc_card da850_snd_soc_card = {
202 .name = "DA850/OMAP-L138 EVM",
203 .dai_link = &da8xx_evm_dai,
204 .platform = &davinci_soc_platform,
205 .num_links = 1,
206};
207
155/* evm audio private data */ 208/* evm audio private data */
156static struct aic3x_setup_data evm_aic3x_setup = { 209static struct aic3x_setup_data evm_aic3x_setup = {
157 .i2c_bus = 1, 210 .i2c_bus = 1,
158 .i2c_address = 0x1b, 211 .i2c_address = 0x1b,
159}; 212};
160 213
214/* dm6467 evm audio private data */
215static struct aic3x_setup_data dm6467_evm_aic3x_setup = {
216 .i2c_bus = 1,
217 .i2c_address = 0x18,
218};
219
220static struct aic3x_setup_data da8xx_evm_aic3x_setup = {
221 .i2c_bus = 1,
222 .i2c_address = 0x18,
223};
224
161/* evm audio subsystem */ 225/* evm audio subsystem */
162static struct snd_soc_device evm_snd_devdata = { 226static struct snd_soc_device evm_snd_devdata = {
163 .card = &snd_soc_card_evm, 227 .card = &snd_soc_card_evm,
@@ -165,60 +229,49 @@ static struct snd_soc_device evm_snd_devdata = {
165 .codec_data = &evm_aic3x_setup, 229 .codec_data = &evm_aic3x_setup,
166}; 230};
167 231
168/* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */ 232/* evm audio subsystem */
169static struct resource evm_snd_resources[] = { 233static struct snd_soc_device dm6467_evm_snd_devdata = {
170 { 234 .card = &dm6467_snd_soc_card_evm,
171 .start = DAVINCI_ASP0_BASE, 235 .codec_dev = &soc_codec_dev_aic3x,
172 .end = DAVINCI_ASP0_BASE + SZ_8K - 1, 236 .codec_data = &dm6467_evm_aic3x_setup,
173 .flags = IORESOURCE_MEM,
174 },
175};
176
177static struct evm_snd_platform_data evm_snd_data = {
178 .tx_dma_ch = DAVINCI_DMA_ASP0_TX,
179 .rx_dma_ch = DAVINCI_DMA_ASP0_RX,
180}; 237};
181 238
182/* DM335 EVM uses ASP1; line-out is a stereo mini-jack */ 239/* evm audio subsystem */
183static struct resource dm335evm_snd_resources[] = { 240static struct snd_soc_device da830_evm_snd_devdata = {
184 { 241 .card = &da830_snd_soc_card,
185 .start = DAVINCI_ASP1_BASE, 242 .codec_dev = &soc_codec_dev_aic3x,
186 .end = DAVINCI_ASP1_BASE + SZ_8K - 1, 243 .codec_data = &da8xx_evm_aic3x_setup,
187 .flags = IORESOURCE_MEM,
188 },
189}; 244};
190 245
191static struct evm_snd_platform_data dm335evm_snd_data = { 246static struct snd_soc_device da850_evm_snd_devdata = {
192 .tx_dma_ch = DAVINCI_DMA_ASP1_TX, 247 .card = &da850_snd_soc_card,
193 .rx_dma_ch = DAVINCI_DMA_ASP1_RX, 248 .codec_dev = &soc_codec_dev_aic3x,
249 .codec_data = &da8xx_evm_aic3x_setup,
194}; 250};
195 251
196static struct platform_device *evm_snd_device; 252static struct platform_device *evm_snd_device;
197 253
198static int __init evm_init(void) 254static int __init evm_init(void)
199{ 255{
200 struct resource *resources; 256 struct snd_soc_device *evm_snd_dev_data;
201 unsigned num_resources;
202 struct evm_snd_platform_data *data;
203 int index; 257 int index;
204 int ret; 258 int ret;
205 259
206 if (machine_is_davinci_evm()) { 260 if (machine_is_davinci_evm()) {
207 davinci_cfg_reg(DM644X_MCBSP); 261 evm_snd_dev_data = &evm_snd_devdata;
208
209 resources = evm_snd_resources;
210 num_resources = ARRAY_SIZE(evm_snd_resources);
211 data = &evm_snd_data;
212 index = 0; 262 index = 0;
213 } else if (machine_is_davinci_dm355_evm()) { 263 } else if (machine_is_davinci_dm355_evm()) {
214 /* we don't use ASP1 IRQs, or we'd need to mux them ... */ 264 evm_snd_dev_data = &evm_snd_devdata;
215 davinci_cfg_reg(DM355_EVT8_ASP1_TX); 265 index = 1;
216 davinci_cfg_reg(DM355_EVT9_ASP1_RX); 266 } else if (machine_is_davinci_dm6467_evm()) {
217 267 evm_snd_dev_data = &dm6467_evm_snd_devdata;
218 resources = dm335evm_snd_resources; 268 index = 0;
219 num_resources = ARRAY_SIZE(dm335evm_snd_resources); 269 } else if (machine_is_davinci_da830_evm()) {
220 data = &dm335evm_snd_data; 270 evm_snd_dev_data = &da830_evm_snd_devdata;
221 index = 1; 271 index = 1;
272 } else if (machine_is_davinci_da850_evm()) {
273 evm_snd_dev_data = &da850_evm_snd_devdata;
274 index = 0;
222 } else 275 } else
223 return -EINVAL; 276 return -EINVAL;
224 277
@@ -226,17 +279,8 @@ static int __init evm_init(void)
226 if (!evm_snd_device) 279 if (!evm_snd_device)
227 return -ENOMEM; 280 return -ENOMEM;
228 281
229 platform_set_drvdata(evm_snd_device, &evm_snd_devdata); 282 platform_set_drvdata(evm_snd_device, evm_snd_dev_data);
230 evm_snd_devdata.dev = &evm_snd_device->dev; 283 evm_snd_dev_data->dev = &evm_snd_device->dev;
231 platform_device_add_data(evm_snd_device, data, sizeof(*data));
232
233 ret = platform_device_add_resources(evm_snd_device, resources,
234 num_resources);
235 if (ret) {
236 platform_device_put(evm_snd_device);
237 return ret;
238 }
239
240 ret = platform_device_add(evm_snd_device); 284 ret = platform_device_add(evm_snd_device);
241 if (ret) 285 if (ret)
242 platform_device_put(evm_snd_device); 286 platform_device_put(evm_snd_device);