aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-02-14 11:20:58 -0500
committerLiam Girdwood <lrg@ti.com>2012-03-12 09:34:19 -0400
commit45656b44f6d1968d838f3abcf3a264ee9fa2fc62 (patch)
treeaf489389d8565bdd83f756115239524814b902d9 /sound/soc/omap
parent219f43164e8c611c6b8e7b628def9183098b430b (diff)
ASoC: omap-mcbsp: Create a single driver for McBSP
The OMAP McBSP driver stack used to contain two different drivers. One of them was used as kind low-level access to the IP, while the other driver was the ASoC DAI driver. There were global, shared structures, in different places, the McBSP instances are reffered with id numbers (sometimes 0 based, in other cases 1 based id numbers). Create one single driver for OMAP McBSP with name: omap-mcbsp. Convert the old omap-mcbsp driver initially to be a library for the omap-mcbsp DAI driver. With this change we can get rid of all global variables, structures. Further cleanup is coming... Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Grazvydas Ignotas <notasas@gmail.com> Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/am3517evm.c2
-rw-r--r--sound/soc/omap/ams-delta.c2
-rw-r--r--sound/soc/omap/igep0020.c2
-rw-r--r--sound/soc/omap/mcbsp.c284
-rw-r--r--sound/soc/omap/mcbsp.h104
-rw-r--r--sound/soc/omap/n810.c2
-rw-r--r--sound/soc/omap/omap-mcbsp.c201
-rw-r--r--sound/soc/omap/omap-mcbsp.h2
-rw-r--r--sound/soc/omap/omap-pcm.h2
-rw-r--r--sound/soc/omap/omap3beagle.c2
-rw-r--r--sound/soc/omap/omap3evm.c2
-rw-r--r--sound/soc/omap/omap3pandora.c4
-rw-r--r--sound/soc/omap/osk5912.c2
-rw-r--r--sound/soc/omap/overo.c2
-rw-r--r--sound/soc/omap/rx51.c4
-rw-r--r--sound/soc/omap/sdp3430.c4
-rw-r--r--sound/soc/omap/zoom2.c4
17 files changed, 234 insertions, 391 deletions
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index add4866d7e67..009533ab8d18 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -95,7 +95,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
95static struct snd_soc_dai_link am3517evm_dai = { 95static struct snd_soc_dai_link am3517evm_dai = {
96 .name = "TLV320AIC23", 96 .name = "TLV320AIC23",
97 .stream_name = "AIC23", 97 .stream_name = "AIC23",
98 .cpu_dai_name ="omap-mcbsp-dai.0", 98 .cpu_dai_name = "omap-mcbsp.1",
99 .codec_dai_name = "tlv320aic23-hifi", 99 .codec_dai_name = "tlv320aic23-hifi",
100 .platform_name = "omap-pcm-audio", 100 .platform_name = "omap-pcm-audio",
101 .codec_name = "tlv320aic23-codec.2-001a", 101 .codec_name = "tlv320aic23-codec.2-001a",
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 78563bbbbf01..49fe63ce51f7 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -584,7 +584,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
584static struct snd_soc_dai_link ams_delta_dai_link = { 584static struct snd_soc_dai_link ams_delta_dai_link = {
585 .name = "CX20442", 585 .name = "CX20442",
586 .stream_name = "CX20442", 586 .stream_name = "CX20442",
587 .cpu_dai_name ="omap-mcbsp-dai.0", 587 .cpu_dai_name = "omap-mcbsp.1",
588 .codec_dai_name = "cx20442-voice", 588 .codec_dai_name = "cx20442-voice",
589 .init = ams_delta_cx20442_init, 589 .init = ams_delta_cx20442_init,
590 .platform_name = "omap-pcm-audio", 590 .platform_name = "omap-pcm-audio",
diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c
index ccae58a1339c..e8357819175b 100644
--- a/sound/soc/omap/igep0020.c
+++ b/sound/soc/omap/igep0020.c
@@ -60,7 +60,7 @@ static struct snd_soc_ops igep2_ops = {
60static struct snd_soc_dai_link igep2_dai = { 60static struct snd_soc_dai_link igep2_dai = {
61 .name = "TWL4030", 61 .name = "TWL4030",
62 .stream_name = "TWL4030", 62 .stream_name = "TWL4030",
63 .cpu_dai_name = "omap-mcbsp-dai.1", 63 .cpu_dai_name = "omap-mcbsp.2",
64 .codec_dai_name = "twl4030-hifi", 64 .codec_dai_name = "twl4030-hifi",
65 .platform_name = "omap-pcm-audio", 65 .platform_name = "omap-pcm-audio",
66 .codec_name = "twl4030-codec", 66 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 20d46bf3626b..be92a28e19ed 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -30,12 +30,6 @@
30 30
31#include "mcbsp.h" 31#include "mcbsp.h"
32 32
33struct omap_mcbsp **mcbsp_ptr;
34int omap_mcbsp_count;
35
36#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
37#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
38
39static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 33static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
40{ 34{
41 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step; 35 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
@@ -84,10 +78,8 @@ static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
84#define MCBSP_ST_WRITE(mcbsp, reg, val) \ 78#define MCBSP_ST_WRITE(mcbsp, reg, val) \
85 omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val) 79 omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val)
86 80
87static void omap_mcbsp_dump_reg(u8 id) 81static void omap_mcbsp_dump_reg(struct omap_mcbsp *mcbsp)
88{ 82{
89 struct omap_mcbsp *mcbsp = id_to_mcbsp_ptr(id);
90
91 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id); 83 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id);
92 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n", 84 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n",
93 MCBSP_READ(mcbsp, DRR2)); 85 MCBSP_READ(mcbsp, DRR2));
@@ -160,16 +152,9 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
160 * You either call this function or set the McBSP registers 152 * You either call this function or set the McBSP registers
161 * by yourself before calling omap_mcbsp_start(). 153 * by yourself before calling omap_mcbsp_start().
162 */ 154 */
163void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) 155void omap_mcbsp_config(struct omap_mcbsp *mcbsp,
156 const struct omap_mcbsp_reg_cfg *config)
164{ 157{
165 struct omap_mcbsp *mcbsp;
166
167 if (!omap_mcbsp_check_valid_id(id)) {
168 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
169 return;
170 }
171 mcbsp = id_to_mcbsp_ptr(id);
172
173 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n", 158 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
174 mcbsp->id, mcbsp->phys_base); 159 mcbsp->id, mcbsp->phys_base);
175 160
@@ -190,7 +175,6 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
190 MCBSP_WRITE(mcbsp, RCCR, config->rccr); 175 MCBSP_WRITE(mcbsp, RCCR, config->rccr);
191 } 176 }
192} 177}
193EXPORT_SYMBOL(omap_mcbsp_config);
194 178
195/** 179/**
196 * omap_mcbsp_dma_params - returns the dma channel number 180 * omap_mcbsp_dma_params - returns the dma channel number
@@ -200,22 +184,13 @@ EXPORT_SYMBOL(omap_mcbsp_config);
200 * Returns the dma channel number for the rx channel or tx channel 184 * Returns the dma channel number for the rx channel or tx channel
201 * based on the value of @stream for the requested mcbsp given by @id 185 * based on the value of @stream for the requested mcbsp given by @id
202 */ 186 */
203int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream) 187int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream)
204{ 188{
205 struct omap_mcbsp *mcbsp;
206
207 if (!omap_mcbsp_check_valid_id(id)) {
208 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
209 return -ENODEV;
210 }
211 mcbsp = id_to_mcbsp_ptr(id);
212
213 if (stream) 189 if (stream)
214 return mcbsp->dma_rx_sync; 190 return mcbsp->dma_rx_sync;
215 else 191 else
216 return mcbsp->dma_tx_sync; 192 return mcbsp->dma_tx_sync;
217} 193}
218EXPORT_SYMBOL(omap_mcbsp_dma_ch_params);
219 194
220/** 195/**
221 * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register 196 * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register
@@ -226,17 +201,10 @@ EXPORT_SYMBOL(omap_mcbsp_dma_ch_params);
226 * to be used by DMA for transferring/receiving data based on the value of 201 * to be used by DMA for transferring/receiving data based on the value of
227 * @stream for the requested mcbsp given by @id 202 * @stream for the requested mcbsp given by @id
228 */ 203 */
229int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream) 204int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream)
230{ 205{
231 struct omap_mcbsp *mcbsp;
232 int data_reg; 206 int data_reg;
233 207
234 if (!omap_mcbsp_check_valid_id(id)) {
235 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
236 return -ENODEV;
237 }
238 mcbsp = id_to_mcbsp_ptr(id);
239
240 if (mcbsp->pdata->reg_size == 2) { 208 if (mcbsp->pdata->reg_size == 2) {
241 if (stream) 209 if (stream)
242 data_reg = OMAP_MCBSP_REG_DRR1; 210 data_reg = OMAP_MCBSP_REG_DRR1;
@@ -251,7 +219,6 @@ int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream)
251 219
252 return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step; 220 return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step;
253} 221}
254EXPORT_SYMBOL(omap_mcbsp_dma_reg_params);
255 222
256static void omap_st_on(struct omap_mcbsp *mcbsp) 223static void omap_st_on(struct omap_mcbsp *mcbsp)
257{ 224{
@@ -320,18 +287,11 @@ static void omap_st_chgain(struct omap_mcbsp *mcbsp)
320 ST_CH1GAIN(st_data->ch1gain)); 287 ST_CH1GAIN(st_data->ch1gain));
321} 288}
322 289
323int omap_st_set_chgain(unsigned int id, int channel, s16 chgain) 290int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain)
324{ 291{
325 struct omap_mcbsp *mcbsp;
326 struct omap_mcbsp_st_data *st_data; 292 struct omap_mcbsp_st_data *st_data;
327 int ret = 0; 293 int ret = 0;
328 294
329 if (!omap_mcbsp_check_valid_id(id)) {
330 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
331 return -ENODEV;
332 }
333
334 mcbsp = id_to_mcbsp_ptr(id);
335 st_data = mcbsp->st_data; 295 st_data = mcbsp->st_data;
336 296
337 if (!st_data) 297 if (!st_data)
@@ -351,20 +311,12 @@ int omap_st_set_chgain(unsigned int id, int channel, s16 chgain)
351 311
352 return ret; 312 return ret;
353} 313}
354EXPORT_SYMBOL(omap_st_set_chgain);
355 314
356int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain) 315int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain)
357{ 316{
358 struct omap_mcbsp *mcbsp;
359 struct omap_mcbsp_st_data *st_data; 317 struct omap_mcbsp_st_data *st_data;
360 int ret = 0; 318 int ret = 0;
361 319
362 if (!omap_mcbsp_check_valid_id(id)) {
363 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
364 return -ENODEV;
365 }
366
367 mcbsp = id_to_mcbsp_ptr(id);
368 st_data = mcbsp->st_data; 320 st_data = mcbsp->st_data;
369 321
370 if (!st_data) 322 if (!st_data)
@@ -381,7 +333,6 @@ int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain)
381 333
382 return ret; 334 return ret;
383} 335}
384EXPORT_SYMBOL(omap_st_get_chgain);
385 336
386static int omap_st_start(struct omap_mcbsp *mcbsp) 337static int omap_st_start(struct omap_mcbsp *mcbsp)
387{ 338{
@@ -400,17 +351,10 @@ static int omap_st_start(struct omap_mcbsp *mcbsp)
400 return 0; 351 return 0;
401} 352}
402 353
403int omap_st_enable(unsigned int id) 354int omap_st_enable(struct omap_mcbsp *mcbsp)
404{ 355{
405 struct omap_mcbsp *mcbsp;
406 struct omap_mcbsp_st_data *st_data; 356 struct omap_mcbsp_st_data *st_data;
407 357
408 if (!omap_mcbsp_check_valid_id(id)) {
409 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
410 return -ENODEV;
411 }
412
413 mcbsp = id_to_mcbsp_ptr(id);
414 st_data = mcbsp->st_data; 358 st_data = mcbsp->st_data;
415 359
416 if (!st_data) 360 if (!st_data)
@@ -423,7 +367,6 @@ int omap_st_enable(unsigned int id)
423 367
424 return 0; 368 return 0;
425} 369}
426EXPORT_SYMBOL(omap_st_enable);
427 370
428static int omap_st_stop(struct omap_mcbsp *mcbsp) 371static int omap_st_stop(struct omap_mcbsp *mcbsp)
429{ 372{
@@ -439,18 +382,11 @@ static int omap_st_stop(struct omap_mcbsp *mcbsp)
439 return 0; 382 return 0;
440} 383}
441 384
442int omap_st_disable(unsigned int id) 385int omap_st_disable(struct omap_mcbsp *mcbsp)
443{ 386{
444 struct omap_mcbsp *mcbsp;
445 struct omap_mcbsp_st_data *st_data; 387 struct omap_mcbsp_st_data *st_data;
446 int ret = 0; 388 int ret = 0;
447 389
448 if (!omap_mcbsp_check_valid_id(id)) {
449 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
450 return -ENODEV;
451 }
452
453 mcbsp = id_to_mcbsp_ptr(id);
454 st_data = mcbsp->st_data; 390 st_data = mcbsp->st_data;
455 391
456 if (!st_data) 392 if (!st_data)
@@ -463,19 +399,11 @@ int omap_st_disable(unsigned int id)
463 399
464 return ret; 400 return ret;
465} 401}
466EXPORT_SYMBOL(omap_st_disable);
467 402
468int omap_st_is_enabled(unsigned int id) 403int omap_st_is_enabled(struct omap_mcbsp *mcbsp)
469{ 404{
470 struct omap_mcbsp *mcbsp;
471 struct omap_mcbsp_st_data *st_data; 405 struct omap_mcbsp_st_data *st_data;
472 406
473 if (!omap_mcbsp_check_valid_id(id)) {
474 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
475 return -ENODEV;
476 }
477
478 mcbsp = id_to_mcbsp_ptr(id);
479 st_data = mcbsp->st_data; 407 st_data = mcbsp->st_data;
480 408
481 if (!st_data) 409 if (!st_data)
@@ -484,115 +412,65 @@ int omap_st_is_enabled(unsigned int id)
484 412
485 return st_data->enabled; 413 return st_data->enabled;
486} 414}
487EXPORT_SYMBOL(omap_st_is_enabled);
488 415
489/* 416/*
490 * omap_mcbsp_set_rx_threshold configures the transmit threshold in words. 417 * omap_mcbsp_set_rx_threshold configures the transmit threshold in words.
491 * The threshold parameter is 1 based, and it is converted (threshold - 1) 418 * The threshold parameter is 1 based, and it is converted (threshold - 1)
492 * for the THRSH2 register. 419 * for the THRSH2 register.
493 */ 420 */
494void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) 421void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold)
495{ 422{
496 struct omap_mcbsp *mcbsp;
497
498 if (!omap_mcbsp_check_valid_id(id)) {
499 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
500 return;
501 }
502 mcbsp = id_to_mcbsp_ptr(id);
503 if (mcbsp->pdata->buffer_size == 0) 423 if (mcbsp->pdata->buffer_size == 0)
504 return; 424 return;
505 425
506 if (threshold && threshold <= mcbsp->max_tx_thres) 426 if (threshold && threshold <= mcbsp->max_tx_thres)
507 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); 427 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
508} 428}
509EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold);
510 429
511/* 430/*
512 * omap_mcbsp_set_rx_threshold configures the receive threshold in words. 431 * omap_mcbsp_set_rx_threshold configures the receive threshold in words.
513 * The threshold parameter is 1 based, and it is converted (threshold - 1) 432 * The threshold parameter is 1 based, and it is converted (threshold - 1)
514 * for the THRSH1 register. 433 * for the THRSH1 register.
515 */ 434 */
516void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) 435void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold)
517{ 436{
518 struct omap_mcbsp *mcbsp;
519
520 if (!omap_mcbsp_check_valid_id(id)) {
521 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
522 return;
523 }
524 mcbsp = id_to_mcbsp_ptr(id);
525 if (mcbsp->pdata->buffer_size == 0) 437 if (mcbsp->pdata->buffer_size == 0)
526 return; 438 return;
527 439
528 if (threshold && threshold <= mcbsp->max_rx_thres) 440 if (threshold && threshold <= mcbsp->max_rx_thres)
529 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); 441 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
530} 442}
531EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold);
532 443
533/* 444/*
534 * omap_mcbsp_get_max_tx_thres just return the current configured 445 * omap_mcbsp_get_max_tx_thres just return the current configured
535 * maximum threshold for transmission 446 * maximum threshold for transmission
536 */ 447 */
537u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) 448u16 omap_mcbsp_get_max_tx_threshold(struct omap_mcbsp *mcbsp)
538{ 449{
539 struct omap_mcbsp *mcbsp;
540
541 if (!omap_mcbsp_check_valid_id(id)) {
542 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
543 return -ENODEV;
544 }
545 mcbsp = id_to_mcbsp_ptr(id);
546
547 return mcbsp->max_tx_thres; 450 return mcbsp->max_tx_thres;
548} 451}
549EXPORT_SYMBOL(omap_mcbsp_get_max_tx_threshold);
550 452
551/* 453/*
552 * omap_mcbsp_get_max_rx_thres just return the current configured 454 * omap_mcbsp_get_max_rx_thres just return the current configured
553 * maximum threshold for reception 455 * maximum threshold for reception
554 */ 456 */
555u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) 457u16 omap_mcbsp_get_max_rx_threshold(struct omap_mcbsp *mcbsp)
556{ 458{
557 struct omap_mcbsp *mcbsp;
558
559 if (!omap_mcbsp_check_valid_id(id)) {
560 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
561 return -ENODEV;
562 }
563 mcbsp = id_to_mcbsp_ptr(id);
564
565 return mcbsp->max_rx_thres; 459 return mcbsp->max_rx_thres;
566} 460}
567EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
568 461
569u16 omap_mcbsp_get_fifo_size(unsigned int id) 462u16 omap_mcbsp_get_fifo_size(struct omap_mcbsp *mcbsp)
570{ 463{
571 struct omap_mcbsp *mcbsp;
572
573 if (!omap_mcbsp_check_valid_id(id)) {
574 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
575 return -ENODEV;
576 }
577 mcbsp = id_to_mcbsp_ptr(id);
578
579 return mcbsp->pdata->buffer_size; 464 return mcbsp->pdata->buffer_size;
580} 465}
581EXPORT_SYMBOL(omap_mcbsp_get_fifo_size);
582 466
583/* 467/*
584 * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO 468 * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO
585 */ 469 */
586u16 omap_mcbsp_get_tx_delay(unsigned int id) 470u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp)
587{ 471{
588 struct omap_mcbsp *mcbsp;
589 u16 buffstat; 472 u16 buffstat;
590 473
591 if (!omap_mcbsp_check_valid_id(id)) {
592 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
593 return -ENODEV;
594 }
595 mcbsp = id_to_mcbsp_ptr(id);
596 if (mcbsp->pdata->buffer_size == 0) 474 if (mcbsp->pdata->buffer_size == 0)
597 return 0; 475 return 0;
598 476
@@ -602,22 +480,15 @@ u16 omap_mcbsp_get_tx_delay(unsigned int id)
602 /* Number of slots are different in McBSP ports */ 480 /* Number of slots are different in McBSP ports */
603 return mcbsp->pdata->buffer_size - buffstat; 481 return mcbsp->pdata->buffer_size - buffstat;
604} 482}
605EXPORT_SYMBOL(omap_mcbsp_get_tx_delay);
606 483
607/* 484/*
608 * omap_mcbsp_get_rx_delay returns the number of free slots in the McBSP FIFO 485 * omap_mcbsp_get_rx_delay returns the number of free slots in the McBSP FIFO
609 * to reach the threshold value (when the DMA will be triggered to read it) 486 * to reach the threshold value (when the DMA will be triggered to read it)
610 */ 487 */
611u16 omap_mcbsp_get_rx_delay(unsigned int id) 488u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp)
612{ 489{
613 struct omap_mcbsp *mcbsp;
614 u16 buffstat, threshold; 490 u16 buffstat, threshold;
615 491
616 if (!omap_mcbsp_check_valid_id(id)) {
617 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
618 return -ENODEV;
619 }
620 mcbsp = id_to_mcbsp_ptr(id);
621 if (mcbsp->pdata->buffer_size == 0) 492 if (mcbsp->pdata->buffer_size == 0)
622 return 0; 493 return 0;
623 494
@@ -632,41 +503,25 @@ u16 omap_mcbsp_get_rx_delay(unsigned int id)
632 else 503 else
633 return threshold - buffstat; 504 return threshold - buffstat;
634} 505}
635EXPORT_SYMBOL(omap_mcbsp_get_rx_delay);
636 506
637/* 507/*
638 * omap_mcbsp_get_dma_op_mode just return the current configured 508 * omap_mcbsp_get_dma_op_mode just return the current configured
639 * operating mode for the mcbsp channel 509 * operating mode for the mcbsp channel
640 */ 510 */
641int omap_mcbsp_get_dma_op_mode(unsigned int id) 511int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp)
642{ 512{
643 struct omap_mcbsp *mcbsp;
644 int dma_op_mode; 513 int dma_op_mode;
645 514
646 if (!omap_mcbsp_check_valid_id(id)) {
647 printk(KERN_ERR "%s: Invalid id (%u)\n", __func__, id + 1);
648 return -ENODEV;
649 }
650 mcbsp = id_to_mcbsp_ptr(id);
651
652 dma_op_mode = mcbsp->dma_op_mode; 515 dma_op_mode = mcbsp->dma_op_mode;
653 516
654 return dma_op_mode; 517 return dma_op_mode;
655} 518}
656EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
657 519
658int omap_mcbsp_request(unsigned int id) 520int omap_mcbsp_request(struct omap_mcbsp *mcbsp)
659{ 521{
660 struct omap_mcbsp *mcbsp;
661 void *reg_cache; 522 void *reg_cache;
662 int err; 523 int err;
663 524
664 if (!omap_mcbsp_check_valid_id(id)) {
665 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
666 return -ENODEV;
667 }
668 mcbsp = id_to_mcbsp_ptr(id);
669
670 reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL); 525 reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL);
671 if (!reg_cache) { 526 if (!reg_cache) {
672 return -ENOMEM; 527 return -ENOMEM;
@@ -685,9 +540,7 @@ int omap_mcbsp_request(unsigned int id)
685 spin_unlock(&mcbsp->lock); 540 spin_unlock(&mcbsp->lock);
686 541
687 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) 542 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
688 mcbsp->pdata->ops->request(id); 543 mcbsp->pdata->ops->request(mcbsp->id - 1);
689
690 pm_runtime_get_sync(mcbsp->dev);
691 544
692 /* Enable wakeup behavior */ 545 /* Enable wakeup behavior */
693 if (mcbsp->pdata->has_wakeup) 546 if (mcbsp->pdata->has_wakeup)
@@ -726,14 +579,12 @@ err_free_irq:
726 free_irq(mcbsp->tx_irq, (void *)mcbsp); 579 free_irq(mcbsp->tx_irq, (void *)mcbsp);
727err_clk_disable: 580err_clk_disable:
728 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 581 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
729 mcbsp->pdata->ops->free(id); 582 mcbsp->pdata->ops->free(mcbsp->id - 1);
730 583
731 /* Disable wakeup behavior */ 584 /* Disable wakeup behavior */
732 if (mcbsp->pdata->has_wakeup) 585 if (mcbsp->pdata->has_wakeup)
733 MCBSP_WRITE(mcbsp, WAKEUPEN, 0); 586 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
734 587
735 pm_runtime_put_sync(mcbsp->dev);
736
737 spin_lock(&mcbsp->lock); 588 spin_lock(&mcbsp->lock);
738 mcbsp->free = true; 589 mcbsp->free = true;
739 mcbsp->reg_cache = NULL; 590 mcbsp->reg_cache = NULL;
@@ -743,28 +594,18 @@ err_kfree:
743 594
744 return err; 595 return err;
745} 596}
746EXPORT_SYMBOL(omap_mcbsp_request);
747 597
748void omap_mcbsp_free(unsigned int id) 598void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
749{ 599{
750 struct omap_mcbsp *mcbsp;
751 void *reg_cache; 600 void *reg_cache;
752 601
753 if (!omap_mcbsp_check_valid_id(id)) {
754 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
755 return;
756 }
757 mcbsp = id_to_mcbsp_ptr(id);
758
759 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 602 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
760 mcbsp->pdata->ops->free(id); 603 mcbsp->pdata->ops->free(mcbsp->id - 1);
761 604
762 /* Disable wakeup behavior */ 605 /* Disable wakeup behavior */
763 if (mcbsp->pdata->has_wakeup) 606 if (mcbsp->pdata->has_wakeup)
764 MCBSP_WRITE(mcbsp, WAKEUPEN, 0); 607 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
765 608
766 pm_runtime_put_sync(mcbsp->dev);
767
768 if (mcbsp->rx_irq) 609 if (mcbsp->rx_irq)
769 free_irq(mcbsp->rx_irq, (void *)mcbsp); 610 free_irq(mcbsp->rx_irq, (void *)mcbsp);
770 free_irq(mcbsp->tx_irq, (void *)mcbsp); 611 free_irq(mcbsp->tx_irq, (void *)mcbsp);
@@ -782,25 +623,17 @@ void omap_mcbsp_free(unsigned int id)
782 if (reg_cache) 623 if (reg_cache)
783 kfree(reg_cache); 624 kfree(reg_cache);
784} 625}
785EXPORT_SYMBOL(omap_mcbsp_free);
786 626
787/* 627/*
788 * Here we start the McBSP, by enabling transmitter, receiver or both. 628 * Here we start the McBSP, by enabling transmitter, receiver or both.
789 * If no transmitter or receiver is active prior calling, then sample-rate 629 * If no transmitter or receiver is active prior calling, then sample-rate
790 * generator and frame sync are started. 630 * generator and frame sync are started.
791 */ 631 */
792void omap_mcbsp_start(unsigned int id, int tx, int rx) 632void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx)
793{ 633{
794 struct omap_mcbsp *mcbsp;
795 int enable_srg = 0; 634 int enable_srg = 0;
796 u16 w; 635 u16 w;
797 636
798 if (!omap_mcbsp_check_valid_id(id)) {
799 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
800 return;
801 }
802 mcbsp = id_to_mcbsp_ptr(id);
803
804 if (mcbsp->st_data) 637 if (mcbsp->st_data)
805 omap_st_start(mcbsp); 638 omap_st_start(mcbsp);
806 639
@@ -850,23 +683,14 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
850 } 683 }
851 684
852 /* Dump McBSP Regs */ 685 /* Dump McBSP Regs */
853 omap_mcbsp_dump_reg(id); 686 omap_mcbsp_dump_reg(mcbsp);
854} 687}
855EXPORT_SYMBOL(omap_mcbsp_start);
856 688
857void omap_mcbsp_stop(unsigned int id, int tx, int rx) 689void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx)
858{ 690{
859 struct omap_mcbsp *mcbsp;
860 int idle; 691 int idle;
861 u16 w; 692 u16 w;
862 693
863 if (!omap_mcbsp_check_valid_id(id)) {
864 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
865 return;
866 }
867
868 mcbsp = id_to_mcbsp_ptr(id);
869
870 /* Reset transmitter */ 694 /* Reset transmitter */
871 tx &= 1; 695 tx &= 1;
872 if (mcbsp->pdata->has_ccr) { 696 if (mcbsp->pdata->has_ccr) {
@@ -899,19 +723,11 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
899 if (mcbsp->st_data) 723 if (mcbsp->st_data)
900 omap_st_stop(mcbsp); 724 omap_st_stop(mcbsp);
901} 725}
902EXPORT_SYMBOL(omap_mcbsp_stop);
903 726
904int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) 727int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
905{ 728{
906 struct omap_mcbsp *mcbsp;
907 const char *src; 729 const char *src;
908 730
909 if (!omap_mcbsp_check_valid_id(id)) {
910 pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
911 return -EINVAL;
912 }
913 mcbsp = id_to_mcbsp_ptr(id);
914
915 if (fck_src_id == MCBSP_CLKS_PAD_SRC) 731 if (fck_src_id == MCBSP_CLKS_PAD_SRC)
916 src = "clks_ext"; 732 src = "clks_ext";
917 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) 733 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
@@ -924,13 +740,14 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
924 else 740 else
925 return -EINVAL; 741 return -EINVAL;
926} 742}
927EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
928 743
929void omap2_mcbsp1_mux_clkr_src(u8 mux) 744void omap2_mcbsp1_mux_clkr_src(struct omap_mcbsp *mcbsp, u8 mux)
930{ 745{
931 struct omap_mcbsp *mcbsp;
932 const char *src; 746 const char *src;
933 747
748 if (mcbsp->id != 1)
749 return;
750
934 if (mux == CLKR_SRC_CLKR) 751 if (mux == CLKR_SRC_CLKR)
935 src = "clkr"; 752 src = "clkr";
936 else if (mux == CLKR_SRC_CLKX) 753 else if (mux == CLKR_SRC_CLKX)
@@ -938,17 +755,17 @@ void omap2_mcbsp1_mux_clkr_src(u8 mux)
938 else 755 else
939 return; 756 return;
940 757
941 mcbsp = id_to_mcbsp_ptr(0);
942 if (mcbsp->pdata->mux_signal) 758 if (mcbsp->pdata->mux_signal)
943 mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src); 759 mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src);
944} 760}
945EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
946 761
947void omap2_mcbsp1_mux_fsr_src(u8 mux) 762void omap2_mcbsp1_mux_fsr_src(struct omap_mcbsp *mcbsp, u8 mux)
948{ 763{
949 struct omap_mcbsp *mcbsp;
950 const char *src; 764 const char *src;
951 765
766 if (mcbsp->id != 1)
767 return;
768
952 if (mux == FSR_SRC_FSR) 769 if (mux == FSR_SRC_FSR)
953 src = "fsr"; 770 src = "fsr";
954 else if (mux == FSR_SRC_FSX) 771 else if (mux == FSR_SRC_FSX)
@@ -956,11 +773,9 @@ void omap2_mcbsp1_mux_fsr_src(u8 mux)
956 else 773 else
957 return; 774 return;
958 775
959 mcbsp = id_to_mcbsp_ptr(0);
960 if (mcbsp->pdata->mux_signal) 776 if (mcbsp->pdata->mux_signal)
961 mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src); 777 mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src);
962} 778}
963EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
964 779
965#define max_thres(m) (mcbsp->pdata->buffer_size) 780#define max_thres(m) (mcbsp->pdata->buffer_size)
966#define valid_threshold(m, val) ((val) <= max_thres(m)) 781#define valid_threshold(m, val) ((val) <= max_thres(m))
@@ -1177,11 +992,10 @@ static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
1177 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 992 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
1178 * 730 has only 2 McBSP, and both of them are MPU peripherals. 993 * 730 has only 2 McBSP, and both of them are MPU peripherals.
1179 */ 994 */
1180static int __devinit omap_mcbsp_probe(struct platform_device *pdev) 995int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1181{ 996{
1182 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; 997 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
1183 struct omap_mcbsp *mcbsp; 998 struct omap_mcbsp *mcbsp;
1184 int id = pdev->id - 1;
1185 struct resource *res; 999 struct resource *res;
1186 int ret = 0; 1000 int ret = 0;
1187 1001
@@ -1194,12 +1008,6 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1194 1008
1195 dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id); 1009 dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id);
1196 1010
1197 if (id >= omap_mcbsp_count) {
1198 dev_err(&pdev->dev, "Invalid McBSP device id (%d)\n", id);
1199 ret = -EINVAL;
1200 goto exit;
1201 }
1202
1203 mcbsp = kzalloc(sizeof(struct omap_mcbsp), GFP_KERNEL); 1011 mcbsp = kzalloc(sizeof(struct omap_mcbsp), GFP_KERNEL);
1204 if (!mcbsp) { 1012 if (!mcbsp) {
1205 ret = -ENOMEM; 1013 ret = -ENOMEM;
@@ -1207,7 +1015,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1207 } 1015 }
1208 1016
1209 spin_lock_init(&mcbsp->lock); 1017 spin_lock_init(&mcbsp->lock);
1210 mcbsp->id = id + 1; 1018 mcbsp->id = pdev->id;
1211 mcbsp->free = true; 1019 mcbsp->free = true;
1212 1020
1213 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); 1021 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
@@ -1268,7 +1076,6 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1268 1076
1269 mcbsp->pdata = pdata; 1077 mcbsp->pdata = pdata;
1270 mcbsp->dev = &pdev->dev; 1078 mcbsp->dev = &pdev->dev;
1271 mcbsp_ptr[id] = mcbsp;
1272 platform_set_drvdata(pdev, mcbsp); 1079 platform_set_drvdata(pdev, mcbsp);
1273 pm_runtime_enable(mcbsp->dev); 1080 pm_runtime_enable(mcbsp->dev);
1274 1081
@@ -1323,7 +1130,7 @@ exit:
1323 return ret; 1130 return ret;
1324} 1131}
1325 1132
1326static int __devexit omap_mcbsp_remove(struct platform_device *pdev) 1133int __devexit omap_mcbsp_remove(struct platform_device *pdev)
1327{ 1134{
1328 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 1135 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
1329 1136
@@ -1349,18 +1156,3 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
1349 1156
1350 return 0; 1157 return 0;
1351} 1158}
1352
1353static struct platform_driver omap_mcbsp_driver = {
1354 .probe = omap_mcbsp_probe,
1355 .remove = __devexit_p(omap_mcbsp_remove),
1356 .driver = {
1357 .name = "omap-mcbsp",
1358 },
1359};
1360
1361module_platform_driver(omap_mcbsp_driver);
1362
1363MODULE_AUTHOR("Samuel Ortiz <samuel.ortiz@nokia.com>");
1364MODULE_DESCRIPTION("OMAP McBSP core driver");
1365MODULE_LICENSE("GPL");
1366MODULE_ALIAS("platform:omap-mcbsp");
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h
index 5590ab271eec..6d579938a154 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -24,6 +24,8 @@
24#ifndef __ASOC_MCBSP_H 24#ifndef __ASOC_MCBSP_H
25#define __ASOC_MCBSP_H 25#define __ASOC_MCBSP_H
26 26
27#include "omap-pcm.h"
28
27/* McBSP register numbers. Register address offset = num * reg_step */ 29/* McBSP register numbers. Register address offset = num * reg_step */
28enum { 30enum {
29 /* Common registers */ 31 /* Common registers */
@@ -257,36 +259,92 @@ struct omap_mcbsp_reg_cfg {
257 u16 rccr; 259 u16 rccr;
258}; 260};
259 261
260void omap_mcbsp_config(unsigned int id, 262struct omap_mcbsp_st_data {
263 void __iomem *io_base_st;
264 bool running;
265 bool enabled;
266 s16 taps[128]; /* Sidetone filter coefficients */
267 int nr_taps; /* Number of filter coefficients in use */
268 s16 ch0gain;
269 s16 ch1gain;
270};
271
272struct omap_mcbsp_data {
273 struct omap_mcbsp_reg_cfg regs;
274 struct omap_pcm_dma_data dma_data[2];
275 unsigned int fmt;
276 /*
277 * Flags indicating is the bus already activated and configured by
278 * another substream
279 */
280 int active;
281 int configured;
282 unsigned int in_freq;
283 int clk_div;
284 int wlen;
285};
286
287struct omap_mcbsp {
288 struct device *dev;
289 unsigned long phys_base;
290 unsigned long phys_dma_base;
291 void __iomem *io_base;
292 u8 id;
293 u8 free;
294
295 int rx_irq;
296 int tx_irq;
297
298 /* DMA stuff */
299 u8 dma_rx_sync;
300 u8 dma_tx_sync;
301
302 /* Protect the field .free, while checking if the mcbsp is in use */
303 spinlock_t lock;
304 struct omap_mcbsp_platform_data *pdata;
305 struct clk *fclk;
306 struct omap_mcbsp_st_data *st_data;
307 struct omap_mcbsp_data mcbsp_data;
308 int dma_op_mode;
309 u16 max_tx_thres;
310 u16 max_rx_thres;
311 void *reg_cache;
312 int reg_cache_size;
313};
314
315void omap_mcbsp_config(struct omap_mcbsp *mcbsp,
261 const struct omap_mcbsp_reg_cfg *config); 316 const struct omap_mcbsp_reg_cfg *config);
262void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); 317void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold);
263void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); 318void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold);
264u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); 319u16 omap_mcbsp_get_max_tx_threshold(struct omap_mcbsp *mcbsp);
265u16 omap_mcbsp_get_max_rx_threshold(unsigned int id); 320u16 omap_mcbsp_get_max_rx_threshold(struct omap_mcbsp *mcbsp);
266u16 omap_mcbsp_get_fifo_size(unsigned int id); 321u16 omap_mcbsp_get_fifo_size(struct omap_mcbsp *mcbsp);
267u16 omap_mcbsp_get_tx_delay(unsigned int id); 322u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp);
268u16 omap_mcbsp_get_rx_delay(unsigned int id); 323u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp);
269int omap_mcbsp_get_dma_op_mode(unsigned int id); 324int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp);
270int omap_mcbsp_request(unsigned int id); 325int omap_mcbsp_request(struct omap_mcbsp *mcbsp);
271void omap_mcbsp_free(unsigned int id); 326void omap_mcbsp_free(struct omap_mcbsp *mcbsp);
272void omap_mcbsp_start(unsigned int id, int tx, int rx); 327void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx);
273void omap_mcbsp_stop(unsigned int id, int tx, int rx); 328void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx);
274 329
275/* McBSP functional clock source changing function */ 330/* McBSP functional clock source changing function */
276int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id); 331int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id);
277 332
278/* McBSP signal muxing API */ 333/* McBSP signal muxing API */
279void omap2_mcbsp1_mux_clkr_src(u8 mux); 334void omap2_mcbsp1_mux_clkr_src(struct omap_mcbsp *mcbsp, u8 mux);
280void omap2_mcbsp1_mux_fsr_src(u8 mux); 335void omap2_mcbsp1_mux_fsr_src(struct omap_mcbsp *mcbsp, u8 mux);
281 336
282int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); 337int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream);
283int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); 338int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream);
284 339
285/* Sidetone specific API */ 340/* Sidetone specific API */
286int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); 341int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain);
287int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); 342int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain);
288int omap_st_enable(unsigned int id); 343int omap_st_enable(struct omap_mcbsp *mcbsp);
289int omap_st_disable(unsigned int id); 344int omap_st_disable(struct omap_mcbsp *mcbsp);
290int omap_st_is_enabled(unsigned int id); 345int omap_st_is_enabled(struct omap_mcbsp *mcbsp);
346
347int __devinit omap_mcbsp_probe(struct platform_device *pdev);
348int __devexit omap_mcbsp_remove(struct platform_device *pdev);
291 349
292#endif /* __ASOC_MCBSP_H */ 350#endif /* __ASOC_MCBSP_H */
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index c292bf0fd19c..abac4b690750 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -275,7 +275,7 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
275static struct snd_soc_dai_link n810_dai = { 275static struct snd_soc_dai_link n810_dai = {
276 .name = "TLV320AIC33", 276 .name = "TLV320AIC33",
277 .stream_name = "AIC33", 277 .stream_name = "AIC33",
278 .cpu_dai_name = "omap-mcbsp-dai.1", 278 .cpu_dai_name = "omap-mcbsp.2",
279 .platform_name = "omap-pcm-audio", 279 .platform_name = "omap-pcm-audio",
280 .codec_name = "tlv320aic3x-codec.2-0018", 280 .codec_name = "tlv320aic3x-codec.2-0018",
281 .codec_dai_name = "tlv320aic3x-hifi", 281 .codec_dai_name = "tlv320aic3x-hifi",
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index f1318c1d4e15..892400259494 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -56,36 +56,18 @@ enum {
56 OMAP_MCBSP_WORD_32, 56 OMAP_MCBSP_WORD_32,
57}; 57};
58 58
59struct omap_mcbsp_data {
60 unsigned int bus_id;
61 struct omap_mcbsp_reg_cfg regs;
62 unsigned int fmt;
63 /*
64 * Flags indicating is the bus already activated and configured by
65 * another substream
66 */
67 int active;
68 int configured;
69 unsigned int in_freq;
70 int clk_div;
71 int wlen;
72};
73
74static struct omap_mcbsp_data mcbsp_data[NUM_LINKS];
75
76/* 59/*
77 * Stream DMA parameters. DMA request line and port address are set runtime 60 * Stream DMA parameters. DMA request line and port address are set runtime
78 * since they are different between OMAP1 and later OMAPs 61 * since they are different between OMAP1 and later OMAPs
79 */ 62 */
80static struct omap_pcm_dma_data omap_mcbsp_dai_dma_params[NUM_LINKS][2];
81
82static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) 63static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
83{ 64{
84 struct snd_soc_pcm_runtime *rtd = substream->private_data; 65 struct snd_soc_pcm_runtime *rtd = substream->private_data;
85 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 66 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
86 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 67 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
68 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
87 struct omap_pcm_dma_data *dma_data; 69 struct omap_pcm_dma_data *dma_data;
88 int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); 70 int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp);
89 int words; 71 int words;
90 72
91 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 73 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
@@ -107,9 +89,9 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
107 89
108 /* Configure McBSP internal buffer usage */ 90 /* Configure McBSP internal buffer usage */
109 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 91 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
110 omap_mcbsp_set_tx_threshold(mcbsp_data->bus_id, words); 92 omap_mcbsp_set_tx_threshold(mcbsp, words);
111 else 93 else
112 omap_mcbsp_set_rx_threshold(mcbsp_data->bus_id, words); 94 omap_mcbsp_set_rx_threshold(mcbsp, words);
113} 95}
114 96
115static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params, 97static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
@@ -119,12 +101,12 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
119 SNDRV_PCM_HW_PARAM_BUFFER_SIZE); 101 SNDRV_PCM_HW_PARAM_BUFFER_SIZE);
120 struct snd_interval *channels = hw_param_interval(params, 102 struct snd_interval *channels = hw_param_interval(params,
121 SNDRV_PCM_HW_PARAM_CHANNELS); 103 SNDRV_PCM_HW_PARAM_CHANNELS);
122 struct omap_mcbsp_data *mcbsp_data = rule->private; 104 struct omap_mcbsp *mcbsp = rule->private;
123 struct snd_interval frames; 105 struct snd_interval frames;
124 int size; 106 int size;
125 107
126 snd_interval_any(&frames); 108 snd_interval_any(&frames);
127 size = omap_mcbsp_get_fifo_size(mcbsp_data->bus_id); 109 size = omap_mcbsp_get_fifo_size(mcbsp);
128 110
129 frames.min = size / channels->min; 111 frames.min = size / channels->min;
130 frames.integer = 1; 112 frames.integer = 1;
@@ -134,12 +116,11 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
134static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, 116static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
135 struct snd_soc_dai *cpu_dai) 117 struct snd_soc_dai *cpu_dai)
136{ 118{
137 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 119 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
138 int bus_id = mcbsp_data->bus_id;
139 int err = 0; 120 int err = 0;
140 121
141 if (!cpu_dai->active) 122 if (!cpu_dai->active)
142 err = omap_mcbsp_request(bus_id); 123 err = omap_mcbsp_request(mcbsp);
143 124
144 /* 125 /*
145 * OMAP3 McBSP FIFO is word structured. 126 * OMAP3 McBSP FIFO is word structured.
@@ -156,7 +137,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
156 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words) 137 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words)
157 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words) 138 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
158 */ 139 */
159 if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 140 if (mcbsp->pdata->buffer_size) {
160 /* 141 /*
161 * Rule for the buffer size. We should not allow 142 * Rule for the buffer size. We should not allow
162 * smaller buffer than the FIFO size to avoid underruns 143 * smaller buffer than the FIFO size to avoid underruns
@@ -164,7 +145,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
164 snd_pcm_hw_rule_add(substream->runtime, 0, 145 snd_pcm_hw_rule_add(substream->runtime, 0,
165 SNDRV_PCM_HW_PARAM_CHANNELS, 146 SNDRV_PCM_HW_PARAM_CHANNELS,
166 omap_mcbsp_hwrule_min_buffersize, 147 omap_mcbsp_hwrule_min_buffersize,
167 mcbsp_data, 148 mcbsp,
168 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); 149 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
169 150
170 /* Make sure, that the period size is always even */ 151 /* Make sure, that the period size is always even */
@@ -178,10 +159,11 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
178static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream, 159static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream,
179 struct snd_soc_dai *cpu_dai) 160 struct snd_soc_dai *cpu_dai)
180{ 161{
181 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 162 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
163 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
182 164
183 if (!cpu_dai->active) { 165 if (!cpu_dai->active) {
184 omap_mcbsp_free(mcbsp_data->bus_id); 166 omap_mcbsp_free(mcbsp);
185 mcbsp_data->configured = 0; 167 mcbsp_data->configured = 0;
186 } 168 }
187} 169}
@@ -189,7 +171,8 @@ static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream,
189static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, 171static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
190 struct snd_soc_dai *cpu_dai) 172 struct snd_soc_dai *cpu_dai)
191{ 173{
192 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 174 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
175 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
193 int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); 176 int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
194 177
195 switch (cmd) { 178 switch (cmd) {
@@ -197,13 +180,13 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
197 case SNDRV_PCM_TRIGGER_RESUME: 180 case SNDRV_PCM_TRIGGER_RESUME:
198 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 181 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
199 mcbsp_data->active++; 182 mcbsp_data->active++;
200 omap_mcbsp_start(mcbsp_data->bus_id, play, !play); 183 omap_mcbsp_start(mcbsp, play, !play);
201 break; 184 break;
202 185
203 case SNDRV_PCM_TRIGGER_STOP: 186 case SNDRV_PCM_TRIGGER_STOP:
204 case SNDRV_PCM_TRIGGER_SUSPEND: 187 case SNDRV_PCM_TRIGGER_SUSPEND:
205 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 188 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
206 omap_mcbsp_stop(mcbsp_data->bus_id, play, !play); 189 omap_mcbsp_stop(mcbsp, play, !play);
207 mcbsp_data->active--; 190 mcbsp_data->active--;
208 break; 191 break;
209 default: 192 default:
@@ -219,14 +202,14 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay(
219{ 202{
220 struct snd_soc_pcm_runtime *rtd = substream->private_data; 203 struct snd_soc_pcm_runtime *rtd = substream->private_data;
221 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 204 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
222 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 205 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
223 u16 fifo_use; 206 u16 fifo_use;
224 snd_pcm_sframes_t delay; 207 snd_pcm_sframes_t delay;
225 208
226 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 209 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
227 fifo_use = omap_mcbsp_get_tx_delay(mcbsp_data->bus_id); 210 fifo_use = omap_mcbsp_get_tx_delay(mcbsp);
228 else 211 else
229 fifo_use = omap_mcbsp_get_rx_delay(mcbsp_data->bus_id); 212 fifo_use = omap_mcbsp_get_rx_delay(mcbsp);
230 213
231 /* 214 /*
232 * Divide the used locations with the channel count to get the 215 * Divide the used locations with the channel count to get the
@@ -242,19 +225,20 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
242 struct snd_pcm_hw_params *params, 225 struct snd_pcm_hw_params *params,
243 struct snd_soc_dai *cpu_dai) 226 struct snd_soc_dai *cpu_dai)
244{ 227{
245 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 228 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
229 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
246 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 230 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
247 struct omap_pcm_dma_data *dma_data; 231 struct omap_pcm_dma_data *dma_data;
248 int dma, bus_id = mcbsp_data->bus_id; 232 int dma;
249 int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT; 233 int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT;
250 int pkt_size = 0; 234 int pkt_size = 0;
251 unsigned long port; 235 unsigned long port;
252 unsigned int format, div, framesize, master; 236 unsigned int format, div, framesize, master;
253 237
254 dma_data = &omap_mcbsp_dai_dma_params[cpu_dai->id][substream->stream]; 238 dma_data = &mcbsp_data->dma_data[substream->stream];
255 239
256 dma = omap_mcbsp_dma_ch_params(bus_id, substream->stream); 240 dma = omap_mcbsp_dma_ch_params(mcbsp, substream->stream);
257 port = omap_mcbsp_dma_reg_params(bus_id, substream->stream); 241 port = omap_mcbsp_dma_reg_params(mcbsp, substream->stream);
258 242
259 switch (params_format(params)) { 243 switch (params_format(params)) {
260 case SNDRV_PCM_FORMAT_S16_LE: 244 case SNDRV_PCM_FORMAT_S16_LE:
@@ -268,20 +252,20 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
268 default: 252 default:
269 return -EINVAL; 253 return -EINVAL;
270 } 254 }
271 if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 255 if (mcbsp->pdata->buffer_size) {
272 dma_data->set_threshold = omap_mcbsp_set_threshold; 256 dma_data->set_threshold = omap_mcbsp_set_threshold;
273 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ 257 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
274 if (omap_mcbsp_get_dma_op_mode(bus_id) == 258 if (omap_mcbsp_get_dma_op_mode(mcbsp) ==
275 MCBSP_DMA_MODE_THRESHOLD) { 259 MCBSP_DMA_MODE_THRESHOLD) {
276 int period_words, max_thrsh; 260 int period_words, max_thrsh;
277 261
278 period_words = params_period_bytes(params) / (wlen / 8); 262 period_words = params_period_bytes(params) / (wlen / 8);
279 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 263 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
280 max_thrsh = omap_mcbsp_get_max_tx_threshold( 264 max_thrsh = omap_mcbsp_get_max_tx_threshold(
281 mcbsp_data->bus_id); 265 mcbsp);
282 else 266 else
283 max_thrsh = omap_mcbsp_get_max_rx_threshold( 267 max_thrsh = omap_mcbsp_get_max_rx_threshold(
284 mcbsp_data->bus_id); 268 mcbsp);
285 /* 269 /*
286 * If the period contains less or equal number of words, 270 * If the period contains less or equal number of words,
287 * we are using the original threshold mode setup: 271 * we are using the original threshold mode setup:
@@ -398,7 +382,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
398 break; 382 break;
399 } 383 }
400 384
401 omap_mcbsp_config(bus_id, &mcbsp_data->regs); 385 omap_mcbsp_config(mcbsp, &mcbsp_data->regs);
402 mcbsp_data->wlen = wlen; 386 mcbsp_data->wlen = wlen;
403 mcbsp_data->configured = 1; 387 mcbsp_data->configured = 1;
404 388
@@ -412,7 +396,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
412static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, 396static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
413 unsigned int fmt) 397 unsigned int fmt)
414{ 398{
415 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 399 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
400 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
416 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 401 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
417 bool inv_fs = false; 402 bool inv_fs = false;
418 403
@@ -514,7 +499,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
514static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, 499static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
515 int div_id, int div) 500 int div_id, int div)
516{ 501{
517 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 502 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
503 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
518 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 504 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
519 505
520 if (div_id != OMAP_MCBSP_CLKGDV) 506 if (div_id != OMAP_MCBSP_CLKGDV)
@@ -531,7 +517,8 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
531 int clk_id, unsigned int freq, 517 int clk_id, unsigned int freq,
532 int dir) 518 int dir)
533{ 519{
534 struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); 520 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
521 struct omap_mcbsp_data *mcbsp_data = &mcbsp->mcbsp_data;
535 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 522 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
536 int err = 0; 523 int err = 0;
537 524
@@ -547,7 +534,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
547 clk_id == OMAP_MCBSP_CLKR_SRC_CLKX || 534 clk_id == OMAP_MCBSP_CLKR_SRC_CLKX ||
548 clk_id == OMAP_MCBSP_FSR_SRC_FSR || 535 clk_id == OMAP_MCBSP_FSR_SRC_FSR ||
549 clk_id == OMAP_MCBSP_FSR_SRC_FSX) 536 clk_id == OMAP_MCBSP_FSR_SRC_FSX)
550 if (cpu_class_is_omap1() || mcbsp_data->bus_id != 0) 537 if (cpu_class_is_omap1() || cpu_dai->id != 1)
551 return -EINVAL; 538 return -EINVAL;
552 539
553 mcbsp_data->in_freq = freq; 540 mcbsp_data->in_freq = freq;
@@ -563,7 +550,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
563 err = -EINVAL; 550 err = -EINVAL;
564 break; 551 break;
565 } 552 }
566 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id, 553 err = omap2_mcbsp_set_clks_src(mcbsp,
567 MCBSP_CLKS_PRCM_SRC); 554 MCBSP_CLKS_PRCM_SRC);
568 break; 555 break;
569 case OMAP_MCBSP_SYSCLK_CLKS_EXT: 556 case OMAP_MCBSP_SYSCLK_CLKS_EXT:
@@ -571,7 +558,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
571 err = 0; 558 err = 0;
572 break; 559 break;
573 } 560 }
574 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id, 561 err = omap2_mcbsp_set_clks_src(mcbsp,
575 MCBSP_CLKS_PAD_SRC); 562 MCBSP_CLKS_PAD_SRC);
576 break; 563 break;
577 564
@@ -585,22 +572,22 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
585 case OMAP_MCBSP_CLKR_SRC_CLKR: 572 case OMAP_MCBSP_CLKR_SRC_CLKR:
586 if (cpu_class_is_omap1()) 573 if (cpu_class_is_omap1())
587 break; 574 break;
588 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); 575 omap2_mcbsp1_mux_clkr_src(mcbsp, CLKR_SRC_CLKR);
589 break; 576 break;
590 case OMAP_MCBSP_CLKR_SRC_CLKX: 577 case OMAP_MCBSP_CLKR_SRC_CLKX:
591 if (cpu_class_is_omap1()) 578 if (cpu_class_is_omap1())
592 break; 579 break;
593 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); 580 omap2_mcbsp1_mux_clkr_src(mcbsp, CLKR_SRC_CLKX);
594 break; 581 break;
595 case OMAP_MCBSP_FSR_SRC_FSR: 582 case OMAP_MCBSP_FSR_SRC_FSR:
596 if (cpu_class_is_omap1()) 583 if (cpu_class_is_omap1())
597 break; 584 break;
598 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); 585 omap2_mcbsp1_mux_fsr_src(mcbsp, FSR_SRC_FSR);
599 break; 586 break;
600 case OMAP_MCBSP_FSR_SRC_FSX: 587 case OMAP_MCBSP_FSR_SRC_FSX:
601 if (cpu_class_is_omap1()) 588 if (cpu_class_is_omap1())
602 break; 589 break;
603 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); 590 omap2_mcbsp1_mux_fsr_src(mcbsp, FSR_SRC_FSX);
604 break; 591 break;
605 default: 592 default:
606 err = -ENODEV; 593 err = -ENODEV;
@@ -620,15 +607,7 @@ static const struct snd_soc_dai_ops mcbsp_dai_ops = {
620 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, 607 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk,
621}; 608};
622 609
623static int mcbsp_dai_probe(struct snd_soc_dai *dai)
624{
625 mcbsp_data[dai->id].bus_id = dai->id;
626 snd_soc_dai_set_drvdata(dai, &mcbsp_data[dai->id].bus_id);
627 return 0;
628}
629
630static struct snd_soc_dai_driver omap_mcbsp_dai = { 610static struct snd_soc_dai_driver omap_mcbsp_dai = {
631 .probe = mcbsp_dai_probe,
632 .playback = { 611 .playback = {
633 .channels_min = 1, 612 .channels_min = 1,
634 .channels_max = 16, 613 .channels_max = 16,
@@ -659,11 +638,13 @@ static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol,
659 return 0; 638 return 0;
660} 639}
661 640
662#define OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(id, channel) \ 641#define OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(channel) \
663static int \ 642static int \
664omap_mcbsp##id##_set_st_ch##channel##_volume(struct snd_kcontrol *kc, \ 643omap_mcbsp_set_st_ch##channel##_volume(struct snd_kcontrol *kc, \
665 struct snd_ctl_elem_value *uc) \ 644 struct snd_ctl_elem_value *uc) \
666{ \ 645{ \
646 struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kc); \
647 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \
667 struct soc_mixer_control *mc = \ 648 struct soc_mixer_control *mc = \
668 (struct soc_mixer_control *)kc->private_value; \ 649 (struct soc_mixer_control *)kc->private_value; \
669 int max = mc->max; \ 650 int max = mc->max; \
@@ -674,46 +655,44 @@ omap_mcbsp##id##_set_st_ch##channel##_volume(struct snd_kcontrol *kc, \
674 return -EINVAL; \ 655 return -EINVAL; \
675 \ 656 \
676 /* OMAP McBSP implementation uses index values 0..4 */ \ 657 /* OMAP McBSP implementation uses index values 0..4 */ \
677 return omap_st_set_chgain((id)-1, channel, val); \ 658 return omap_st_set_chgain(mcbsp, channel, val); \
678} 659}
679 660
680#define OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(id, channel) \ 661#define OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(channel) \
681static int \ 662static int \
682omap_mcbsp##id##_get_st_ch##channel##_volume(struct snd_kcontrol *kc, \ 663omap_mcbsp_get_st_ch##channel##_volume(struct snd_kcontrol *kc, \
683 struct snd_ctl_elem_value *uc) \ 664 struct snd_ctl_elem_value *uc) \
684{ \ 665{ \
666 struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kc); \
667 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \
685 s16 chgain; \ 668 s16 chgain; \
686 \ 669 \
687 if (omap_st_get_chgain((id)-1, channel, &chgain)) \ 670 if (omap_st_get_chgain(mcbsp, channel, &chgain)) \
688 return -EAGAIN; \ 671 return -EAGAIN; \
689 \ 672 \
690 uc->value.integer.value[0] = chgain; \ 673 uc->value.integer.value[0] = chgain; \
691 return 0; \ 674 return 0; \
692} 675}
693 676
694OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(2, 0) 677OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(0)
695OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(2, 1) 678OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(1)
696OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(3, 0) 679OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(0)
697OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(3, 1) 680OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(1)
698OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(2, 0)
699OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(2, 1)
700OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(3, 0)
701OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(3, 1)
702 681
703static int omap_mcbsp_st_put_mode(struct snd_kcontrol *kcontrol, 682static int omap_mcbsp_st_put_mode(struct snd_kcontrol *kcontrol,
704 struct snd_ctl_elem_value *ucontrol) 683 struct snd_ctl_elem_value *ucontrol)
705{ 684{
706 struct soc_mixer_control *mc = 685 struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
707 (struct soc_mixer_control *)kcontrol->private_value; 686 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
708 u8 value = ucontrol->value.integer.value[0]; 687 u8 value = ucontrol->value.integer.value[0];
709 688
710 if (value == omap_st_is_enabled(mc->reg)) 689 if (value == omap_st_is_enabled(mcbsp))
711 return 0; 690 return 0;
712 691
713 if (value) 692 if (value)
714 omap_st_enable(mc->reg); 693 omap_st_enable(mcbsp);
715 else 694 else
716 omap_st_disable(mc->reg); 695 omap_st_disable(mcbsp);
717 696
718 return 1; 697 return 1;
719} 698}
@@ -721,10 +700,10 @@ static int omap_mcbsp_st_put_mode(struct snd_kcontrol *kcontrol,
721static int omap_mcbsp_st_get_mode(struct snd_kcontrol *kcontrol, 700static int omap_mcbsp_st_get_mode(struct snd_kcontrol *kcontrol,
722 struct snd_ctl_elem_value *ucontrol) 701 struct snd_ctl_elem_value *ucontrol)
723{ 702{
724 struct soc_mixer_control *mc = 703 struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
725 (struct soc_mixer_control *)kcontrol->private_value; 704 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
726 705
727 ucontrol->value.integer.value[0] = omap_st_is_enabled(mc->reg); 706 ucontrol->value.integer.value[0] = omap_st_is_enabled(mcbsp);
728 return 0; 707 return 0;
729} 708}
730 709
@@ -733,12 +712,12 @@ static const struct snd_kcontrol_new omap_mcbsp2_st_controls[] = {
733 omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), 712 omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode),
734 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 0 Volume", 713 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 0 Volume",
735 -32768, 32767, 714 -32768, 32767,
736 omap_mcbsp2_get_st_ch0_volume, 715 omap_mcbsp_get_st_ch0_volume,
737 omap_mcbsp2_set_st_ch0_volume), 716 omap_mcbsp_set_st_ch0_volume),
738 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 1 Volume", 717 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 1 Volume",
739 -32768, 32767, 718 -32768, 32767,
740 omap_mcbsp2_get_st_ch1_volume, 719 omap_mcbsp_get_st_ch1_volume,
741 omap_mcbsp2_set_st_ch1_volume), 720 omap_mcbsp_set_st_ch1_volume),
742}; 721};
743 722
744static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = { 723static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = {
@@ -746,25 +725,30 @@ static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = {
746 omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), 725 omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode),
747 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 0 Volume", 726 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 0 Volume",
748 -32768, 32767, 727 -32768, 32767,
749 omap_mcbsp3_get_st_ch0_volume, 728 omap_mcbsp_get_st_ch0_volume,
750 omap_mcbsp3_set_st_ch0_volume), 729 omap_mcbsp_set_st_ch0_volume),
751 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 1 Volume", 730 OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 1 Volume",
752 -32768, 32767, 731 -32768, 32767,
753 omap_mcbsp3_get_st_ch1_volume, 732 omap_mcbsp_get_st_ch1_volume,
754 omap_mcbsp3_set_st_ch1_volume), 733 omap_mcbsp_set_st_ch1_volume),
755}; 734};
756 735
757int omap_mcbsp_st_add_controls(struct snd_soc_dai *dai) 736int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd)
758{ 737{
759 if (!cpu_is_omap34xx()) 738 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
739 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
740
741 if (!mcbsp->st_data)
760 return -ENODEV; 742 return -ENODEV;
761 743
762 switch (dai->id) { 744 switch (cpu_dai->id) {
763 case 1: /* McBSP 2 */ 745 case 2: /* McBSP 2 */
764 return snd_soc_add_dai_controls(dai, omap_mcbsp2_st_controls, 746 return snd_soc_add_dai_controls(cpu_dai,
747 omap_mcbsp2_st_controls,
765 ARRAY_SIZE(omap_mcbsp2_st_controls)); 748 ARRAY_SIZE(omap_mcbsp2_st_controls));
766 case 2: /* McBSP 3 */ 749 case 3: /* McBSP 3 */
767 return snd_soc_add_dai_controls(dai, omap_mcbsp3_st_controls, 750 return snd_soc_add_dai_controls(cpu_dai,
751 omap_mcbsp3_st_controls,
768 ARRAY_SIZE(omap_mcbsp3_st_controls)); 752 ARRAY_SIZE(omap_mcbsp3_st_controls));
769 default: 753 default:
770 break; 754 break;
@@ -776,18 +760,25 @@ EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls);
776 760
777static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) 761static __devinit int asoc_mcbsp_probe(struct platform_device *pdev)
778{ 762{
779 return snd_soc_register_dai(&pdev->dev, &omap_mcbsp_dai); 763 int ret;
764
765 ret = omap_mcbsp_probe(pdev);
766 if (!ret)
767 return snd_soc_register_dai(&pdev->dev, &omap_mcbsp_dai);
768
769 return ret;
780} 770}
781 771
782static int __devexit asoc_mcbsp_remove(struct platform_device *pdev) 772static int __devexit asoc_mcbsp_remove(struct platform_device *pdev)
783{ 773{
774 omap_mcbsp_remove(pdev);
784 snd_soc_unregister_dai(&pdev->dev); 775 snd_soc_unregister_dai(&pdev->dev);
785 return 0; 776 return 0;
786} 777}
787 778
788static struct platform_driver asoc_mcbsp_driver = { 779static struct platform_driver asoc_mcbsp_driver = {
789 .driver = { 780 .driver = {
790 .name = "omap-mcbsp-dai", 781 .name = "omap-mcbsp",
791 .owner = THIS_MODULE, 782 .owner = THIS_MODULE,
792 }, 783 },
793 784
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h
index 476fe2add703..f877b16f19c9 100644
--- a/sound/soc/omap/omap-mcbsp.h
+++ b/sound/soc/omap/omap-mcbsp.h
@@ -59,6 +59,6 @@ enum omap_mcbsp_div {
59#define NUM_LINKS 5 59#define NUM_LINKS 5
60#endif 60#endif
61 61
62int omap_mcbsp_st_add_controls(struct snd_soc_dai *dai); 62int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd);
63 63
64#endif 64#endif
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h
index f95fe3064172..b92248cbd47a 100644
--- a/sound/soc/omap/omap-pcm.h
+++ b/sound/soc/omap/omap-pcm.h
@@ -25,6 +25,8 @@
25#ifndef __OMAP_PCM_H__ 25#ifndef __OMAP_PCM_H__
26#define __OMAP_PCM_H__ 26#define __OMAP_PCM_H__
27 27
28struct snd_pcm_substream;
29
28struct omap_pcm_dma_data { 30struct omap_pcm_dma_data {
29 char *name; /* stream identifier */ 31 char *name; /* stream identifier */
30 int dma_req; /* DMA request line */ 32 int dma_req; /* DMA request line */
diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c
index 3357dcc47ed4..2830dfd05661 100644
--- a/sound/soc/omap/omap3beagle.c
+++ b/sound/soc/omap/omap3beagle.c
@@ -91,7 +91,7 @@ static struct snd_soc_ops omap3beagle_ops = {
91static struct snd_soc_dai_link omap3beagle_dai = { 91static struct snd_soc_dai_link omap3beagle_dai = {
92 .name = "TWL4030", 92 .name = "TWL4030",
93 .stream_name = "TWL4030", 93 .stream_name = "TWL4030",
94 .cpu_dai_name = "omap-mcbsp-dai.1", 94 .cpu_dai_name = "omap-mcbsp.2",
95 .platform_name = "omap-pcm-audio", 95 .platform_name = "omap-pcm-audio",
96 .codec_dai_name = "twl4030-hifi", 96 .codec_dai_name = "twl4030-hifi",
97 .codec_name = "twl4030-codec", 97 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index 071fcb09b8b2..3d468c9179d7 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -58,7 +58,7 @@ static struct snd_soc_ops omap3evm_ops = {
58static struct snd_soc_dai_link omap3evm_dai = { 58static struct snd_soc_dai_link omap3evm_dai = {
59 .name = "TWL4030", 59 .name = "TWL4030",
60 .stream_name = "TWL4030", 60 .stream_name = "TWL4030",
61 .cpu_dai_name = "omap-mcbsp-dai.1", 61 .cpu_dai_name = "omap-mcbsp.2",
62 .codec_dai_name = "twl4030-hifi", 62 .codec_dai_name = "twl4030-hifi",
63 .platform_name = "omap-pcm-audio", 63 .platform_name = "omap-pcm-audio",
64 .codec_name = "twl4030-codec", 64 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 07794bd10952..4c3a0978578a 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -208,7 +208,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
208 { 208 {
209 .name = "PCM1773", 209 .name = "PCM1773",
210 .stream_name = "HiFi Out", 210 .stream_name = "HiFi Out",
211 .cpu_dai_name = "omap-mcbsp-dai.1", 211 .cpu_dai_name = "omap-mcbsp.2",
212 .codec_dai_name = "twl4030-hifi", 212 .codec_dai_name = "twl4030-hifi",
213 .platform_name = "omap-pcm-audio", 213 .platform_name = "omap-pcm-audio",
214 .codec_name = "twl4030-codec", 214 .codec_name = "twl4030-codec",
@@ -219,7 +219,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
219 }, { 219 }, {
220 .name = "TWL4030", 220 .name = "TWL4030",
221 .stream_name = "Line/Mic In", 221 .stream_name = "Line/Mic In",
222 .cpu_dai_name = "omap-mcbsp-dai.3", 222 .cpu_dai_name = "omap-mcbsp.4",
223 .codec_dai_name = "twl4030-hifi", 223 .codec_dai_name = "twl4030-hifi",
224 .platform_name = "omap-pcm-audio", 224 .platform_name = "omap-pcm-audio",
225 .codec_name = "twl4030-codec", 225 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index d859b597e7ec..b1a9d64cbc56 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -96,7 +96,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
96static struct snd_soc_dai_link osk_dai = { 96static struct snd_soc_dai_link osk_dai = {
97 .name = "TLV320AIC23", 97 .name = "TLV320AIC23",
98 .stream_name = "AIC23", 98 .stream_name = "AIC23",
99 .cpu_dai_name = "omap-mcbsp-dai.0", 99 .cpu_dai_name = "omap-mcbsp.1",
100 .codec_dai_name = "tlv320aic23-hifi", 100 .codec_dai_name = "tlv320aic23-hifi",
101 .platform_name = "omap-pcm-audio", 101 .platform_name = "omap-pcm-audio",
102 .codec_name = "tlv320aic23-codec", 102 .codec_name = "tlv320aic23-codec",
diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c
index 2ee889c50256..6ac3e0c3c282 100644
--- a/sound/soc/omap/overo.c
+++ b/sound/soc/omap/overo.c
@@ -60,7 +60,7 @@ static struct snd_soc_ops overo_ops = {
60static struct snd_soc_dai_link overo_dai = { 60static struct snd_soc_dai_link overo_dai = {
61 .name = "TWL4030", 61 .name = "TWL4030",
62 .stream_name = "TWL4030", 62 .stream_name = "TWL4030",
63 .cpu_dai_name = "omap-mcbsp-dai.1", 63 .cpu_dai_name = "omap-mcbsp.2",
64 .codec_dai_name = "twl4030-hifi", 64 .codec_dai_name = "twl4030-hifi",
65 .platform_name = "omap-pcm-audio", 65 .platform_name = "omap-pcm-audio",
66 .codec_name = "twl4030-codec", 66 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 58936c730a87..2712dd232b6d 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -313,7 +313,7 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
313 return err; 313 return err;
314 snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); 314 snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42);
315 315
316 err = omap_mcbsp_st_add_controls(rtd->cpu_dai); 316 err = omap_mcbsp_st_add_controls(rtd);
317 if (err < 0) 317 if (err < 0)
318 return err; 318 return err;
319 319
@@ -353,7 +353,7 @@ static struct snd_soc_dai_link rx51_dai[] = {
353 { 353 {
354 .name = "TLV320AIC34", 354 .name = "TLV320AIC34",
355 .stream_name = "AIC34", 355 .stream_name = "AIC34",
356 .cpu_dai_name = "omap-mcbsp-dai.1", 356 .cpu_dai_name = "omap-mcbsp.2",
357 .codec_dai_name = "tlv320aic3x-hifi", 357 .codec_dai_name = "tlv320aic3x-hifi",
358 .platform_name = "omap-pcm-audio", 358 .platform_name = "omap-pcm-audio",
359 .codec_name = "tlv320aic3x-codec.2-0018", 359 .codec_name = "tlv320aic3x-codec.2-0018",
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 2c850662ea7e..0e283226e2bf 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -187,7 +187,7 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
187 { 187 {
188 .name = "TWL4030 I2S", 188 .name = "TWL4030 I2S",
189 .stream_name = "TWL4030 Audio", 189 .stream_name = "TWL4030 Audio",
190 .cpu_dai_name = "omap-mcbsp-dai.1", 190 .cpu_dai_name = "omap-mcbsp.2",
191 .codec_dai_name = "twl4030-hifi", 191 .codec_dai_name = "twl4030-hifi",
192 .platform_name = "omap-pcm-audio", 192 .platform_name = "omap-pcm-audio",
193 .codec_name = "twl4030-codec", 193 .codec_name = "twl4030-codec",
@@ -199,7 +199,7 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
199 { 199 {
200 .name = "TWL4030 PCM", 200 .name = "TWL4030 PCM",
201 .stream_name = "TWL4030 Voice", 201 .stream_name = "TWL4030 Voice",
202 .cpu_dai_name = "omap-mcbsp-dai.2", 202 .cpu_dai_name = "omap-mcbsp.3",
203 .codec_dai_name = "twl4030-voice", 203 .codec_dai_name = "twl4030-voice",
204 .platform_name = "omap-pcm-audio", 204 .platform_name = "omap-pcm-audio",
205 .codec_name = "twl4030-codec", 205 .codec_name = "twl4030-codec",
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 981616d61f67..920e0d9e03db 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -131,7 +131,7 @@ static struct snd_soc_dai_link zoom2_dai[] = {
131 { 131 {
132 .name = "TWL4030 I2S", 132 .name = "TWL4030 I2S",
133 .stream_name = "TWL4030 Audio", 133 .stream_name = "TWL4030 Audio",
134 .cpu_dai_name = "omap-mcbsp-dai.1", 134 .cpu_dai_name = "omap-mcbsp.2",
135 .codec_dai_name = "twl4030-hifi", 135 .codec_dai_name = "twl4030-hifi",
136 .platform_name = "omap-pcm-audio", 136 .platform_name = "omap-pcm-audio",
137 .codec_name = "twl4030-codec", 137 .codec_name = "twl4030-codec",
@@ -143,7 +143,7 @@ static struct snd_soc_dai_link zoom2_dai[] = {
143 { 143 {
144 .name = "TWL4030 PCM", 144 .name = "TWL4030 PCM",
145 .stream_name = "TWL4030 Voice", 145 .stream_name = "TWL4030 Voice",
146 .cpu_dai_name = "omap-mcbsp-dai.2", 146 .cpu_dai_name = "omap-mcbsp.3",
147 .codec_dai_name = "twl4030-voice", 147 .codec_dai_name = "twl4030-voice",
148 .platform_name = "omap-pcm-audio", 148 .platform_name = "omap-pcm-audio",
149 .codec_name = "twl4030-codec", 149 .codec_name = "twl4030-codec",