aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2009-07-04 22:29:59 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-07-05 08:14:35 -0400
commitaf0adf3e81dbcf782388b8a7d0d7094ef5e70f50 (patch)
tree63fe365b1b360ca38c1824a66ebba5d1209a58ea
parentf5cfa954e6812c09e3a4b89e8009b22285b860a3 (diff)
ASoC: DaVinci: i2s, add davinci_i2s_prepare and shutdown
If the codec is master then prepare should call mcbsp_start, not trigger. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/davinci/davinci-i2s.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 6fa1b6aebc30..88ccef79a5eb 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -420,6 +420,20 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
420 return 0; 420 return 0;
421} 421}
422 422
423static int davinci_i2s_prepare(struct snd_pcm_substream *substream,
424 struct snd_soc_dai *dai)
425{
426 struct snd_soc_pcm_runtime *rtd = substream->private_data;
427 struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data;
428 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
429 davinci_mcbsp_stop(dev, playback);
430 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) {
431 /* codec is master */
432 davinci_mcbsp_start(dev, substream);
433 }
434 return 0;
435}
436
423static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, 437static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
424 struct snd_soc_dai *dai) 438 struct snd_soc_dai *dai)
425{ 439{
@@ -427,6 +441,8 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
427 struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; 441 struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data;
428 int ret = 0; 442 int ret = 0;
429 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); 443 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
444 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0)
445 return 0; /* return if codec is master */
430 446
431 switch (cmd) { 447 switch (cmd) {
432 case SNDRV_PCM_TRIGGER_START: 448 case SNDRV_PCM_TRIGGER_START:
@@ -442,10 +458,18 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
442 default: 458 default:
443 ret = -EINVAL; 459 ret = -EINVAL;
444 } 460 }
445
446 return ret; 461 return ret;
447} 462}
448 463
464static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
465 struct snd_soc_dai *dai)
466{
467 struct snd_soc_pcm_runtime *rtd = substream->private_data;
468 struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data;
469 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
470 davinci_mcbsp_stop(dev, playback);
471}
472
449static int davinci_i2s_probe(struct platform_device *pdev, 473static int davinci_i2s_probe(struct platform_device *pdev,
450 struct snd_soc_dai *dai) 474 struct snd_soc_dai *dai)
451{ 475{
@@ -531,6 +555,8 @@ static void davinci_i2s_remove(struct platform_device *pdev,
531 555
532static struct snd_soc_dai_ops davinci_i2s_dai_ops = { 556static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
533 .startup = davinci_i2s_startup, 557 .startup = davinci_i2s_startup,
558 .shutdown = davinci_i2s_shutdown,
559 .prepare = davinci_i2s_prepare,
534 .trigger = davinci_i2s_trigger, 560 .trigger = davinci_i2s_trigger,
535 .hw_params = davinci_i2s_hw_params, 561 .hw_params = davinci_i2s_hw_params,
536 .set_fmt = davinci_i2s_set_dai_fmt, 562 .set_fmt = davinci_i2s_set_dai_fmt,