aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@nokia.com>2008-10-09 08:57:22 -0400
committerTakashi Iwai <tiwai@suse.de>2008-10-12 20:17:48 -0400
commit8def464dddd61686e00e96db714a2930a08ef272 (patch)
tree6de64fb6328a99cead3e2f712a476e735f1b1cba /sound
parent9296bb43f1a3b60ab2e9c4ff48a296cacff117a9 (diff)
ALSA: ASoC: OMAP: Add multilink support to McBSP DAI driver
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-mcbsp.c72
-rw-r--r--sound/soc/omap/omap-mcbsp.h16
2 files changed, 53 insertions, 35 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index fb920e1b551e..d32eb4703cfe 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -381,37 +381,49 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
381 return err; 381 return err;
382} 382}
383 383
384struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS] = { 384#define OMAP_MCBSP_DAI_BUILDER(link_id) \
385{ 385{ \
386 .name = "omap-mcbsp-dai", 386 .name = "omap-mcbsp-dai-(link_id)", \
387 .id = 0, 387 .id = (link_id), \
388 .type = SND_SOC_DAI_I2S, 388 .type = SND_SOC_DAI_I2S, \
389 .playback = { 389 .playback = { \
390 .channels_min = 2, 390 .channels_min = 2, \
391 .channels_max = 2, 391 .channels_max = 2, \
392 .rates = OMAP_MCBSP_RATES, 392 .rates = OMAP_MCBSP_RATES, \
393 .formats = SNDRV_PCM_FMTBIT_S16_LE, 393 .formats = SNDRV_PCM_FMTBIT_S16_LE, \
394 }, 394 }, \
395 .capture = { 395 .capture = { \
396 .channels_min = 2, 396 .channels_min = 2, \
397 .channels_max = 2, 397 .channels_max = 2, \
398 .rates = OMAP_MCBSP_RATES, 398 .rates = OMAP_MCBSP_RATES, \
399 .formats = SNDRV_PCM_FMTBIT_S16_LE, 399 .formats = SNDRV_PCM_FMTBIT_S16_LE, \
400 }, 400 }, \
401 .ops = { 401 .ops = { \
402 .startup = omap_mcbsp_dai_startup, 402 .startup = omap_mcbsp_dai_startup, \
403 .shutdown = omap_mcbsp_dai_shutdown, 403 .shutdown = omap_mcbsp_dai_shutdown, \
404 .trigger = omap_mcbsp_dai_trigger, 404 .trigger = omap_mcbsp_dai_trigger, \
405 .hw_params = omap_mcbsp_dai_hw_params, 405 .hw_params = omap_mcbsp_dai_hw_params, \
406 }, 406 }, \
407 .dai_ops = { 407 .dai_ops = { \
408 .set_fmt = omap_mcbsp_dai_set_dai_fmt, 408 .set_fmt = omap_mcbsp_dai_set_dai_fmt, \
409 .set_clkdiv = omap_mcbsp_dai_set_clkdiv, 409 .set_clkdiv = omap_mcbsp_dai_set_clkdiv, \
410 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, 410 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, \
411 }, 411 }, \
412 .private_data = &mcbsp_data[0].bus_id, 412 .private_data = &mcbsp_data[(link_id)].bus_id, \
413}, 413}
414
415struct snd_soc_dai omap_mcbsp_dai[] = {
416 OMAP_MCBSP_DAI_BUILDER(0),
417 OMAP_MCBSP_DAI_BUILDER(1),
418#if NUM_LINKS >= 3
419 OMAP_MCBSP_DAI_BUILDER(2),
420#endif
421#if NUM_LINKS == 5
422 OMAP_MCBSP_DAI_BUILDER(3),
423 OMAP_MCBSP_DAI_BUILDER(4),
424#endif
414}; 425};
426
415EXPORT_SYMBOL_GPL(omap_mcbsp_dai); 427EXPORT_SYMBOL_GPL(omap_mcbsp_dai);
416 428
417MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>"); 429MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>");
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h
index ed8afb550671..df7ad13ba73d 100644
--- a/sound/soc/omap/omap-mcbsp.h
+++ b/sound/soc/omap/omap-mcbsp.h
@@ -38,11 +38,17 @@ enum omap_mcbsp_div {
38 OMAP_MCBSP_CLKGDV, /* Sample rate generator divider */ 38 OMAP_MCBSP_CLKGDV, /* Sample rate generator divider */
39}; 39};
40 40
41/* 41#if defined(CONFIG_ARCH_OMAP2420)
42 * REVISIT: Preparation for the ASoC v2. Let the number of available links to 42#define NUM_LINKS 2
43 * be same than number of McBSP ports found in OMAP(s) we are compiling for. 43#endif
44 */ 44#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
45#define NUM_LINKS 1 45#undef NUM_LINKS
46#define NUM_LINKS 3
47#endif
48#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
49#undef NUM_LINKS
50#define NUM_LINKS 5
51#endif
46 52
47extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS]; 53extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS];
48 54