aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorJassi Brar <jassi.brar@samsung.com>2010-02-25 19:12:32 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-26 06:17:48 -0500
commit14dc5734bdac2629ed4228f3d30662bb440a3982 (patch)
tree137fb1c076b2f8d8d5292fb4547710f42faf32ce /sound/soc
parent6423c1875c87fa5ae56974ab8386d7c6110e3701 (diff)
ASoC: Allow mulitple usage count of codec and cpu dai
If we are to have a snd_soc_dai i.e, cpu_dai and codec_dai, shared among two or more dai_links we need to log the number of active users of the dai. For that, we change semantics of the snd_soc_dai.active flag from indicator to reference counter. Signed-off-by: Jassi Brar <jassi.brar@samsung.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-core.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1215a0ec2df0..f30959cc954a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -454,11 +454,15 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
454 pr_debug("asoc: min rate %d max rate %d\n", runtime->hw.rate_min, 454 pr_debug("asoc: min rate %d max rate %d\n", runtime->hw.rate_min,
455 runtime->hw.rate_max); 455 runtime->hw.rate_max);
456 456
457 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 457 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
458 cpu_dai->playback.active = codec_dai->playback.active = 1; 458 cpu_dai->playback.active++;
459 else 459 codec_dai->playback.active++;
460 cpu_dai->capture.active = codec_dai->capture.active = 1; 460 } else {
461 cpu_dai->active = codec_dai->active = 1; 461 cpu_dai->capture.active++;
462 codec_dai->capture.active++;
463 }
464 cpu_dai->active++;
465 codec_dai->active++;
462 card->codec->active++; 466 card->codec->active++;
463 mutex_unlock(&pcm_mutex); 467 mutex_unlock(&pcm_mutex);
464 return 0; 468 return 0;
@@ -530,15 +534,16 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
530 534
531 mutex_lock(&pcm_mutex); 535 mutex_lock(&pcm_mutex);
532 536
533 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 537 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
534 cpu_dai->playback.active = codec_dai->playback.active = 0; 538 cpu_dai->playback.active--;
535 else 539 codec_dai->playback.active--;
536 cpu_dai->capture.active = codec_dai->capture.active = 0; 540 } else {
537 541 cpu_dai->capture.active--;
538 if (codec_dai->playback.active == 0 && 542 codec_dai->capture.active--;
539 codec_dai->capture.active == 0) {
540 cpu_dai->active = codec_dai->active = 0;
541 } 543 }
544
545 cpu_dai->active--;
546 codec_dai->active--;
542 codec->active--; 547 codec->active--;
543 548
544 /* Muting the DAC suppresses artifacts caused during digital 549 /* Muting the DAC suppresses artifacts caused during digital