aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2011-07-24 15:59:44 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:18:25 -0400
commite9965c2a5d98e0d698afe45394b1c77ecc0c99ad (patch)
tree3cf2e7919ebfc75ca84a452442a7ec8cf3715309
parentad578b9dd93624c073edc24bf5185cd8a90c748d (diff)
Subject: [PATCH 075/104] ALSA: pcm - add support for hostless audio
Allow some PCM devices to be hostless, i.e. there is no PCM data transferred to or from the host CPU. This can be used to minimise power on systems since the CPU can idle/sleep during the PCM device operation (e.g. a phone call where the DAI is between a MODEM and DSP) TODO: cleanup, look at adding a read/write blocker. Singed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--include/sound/pcm.h1
-rw-r--r--sound/core/pcm_lib.c3
-rw-r--r--sound/core/pcm_native.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index e1bad113061..6a187658e8f 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -413,6 +413,7 @@ struct snd_pcm_substream {
413#endif 413#endif
414 /* misc flags */ 414 /* misc flags */
415 unsigned int hw_opened: 1; 415 unsigned int hw_opened: 1;
416 unsigned int hw_no_buffer: 1; /* substream may not have a buffer */
416}; 417};
417 418
418#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0) 419#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 33884426a64..cd69b38622b 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1961,6 +1961,9 @@ static int pcm_sanity_check(struct snd_pcm_substream *substream)
1961 struct snd_pcm_runtime *runtime; 1961 struct snd_pcm_runtime *runtime;
1962 if (PCM_RUNTIME_CHECK(substream)) 1962 if (PCM_RUNTIME_CHECK(substream))
1963 return -ENXIO; 1963 return -ENXIO;
1964 /* TODO: consider and -EINVAL here */
1965 if (substream->hw_no_buffer)
1966 snd_printd("%s: warning this PCM is host less\n", __func__);
1964 runtime = substream->runtime; 1967 runtime = substream->runtime;
1965 if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area)) 1968 if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
1966 return -EINVAL; 1969 return -EINVAL;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 1c6be91dfb9..c6698efb44c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -842,6 +842,7 @@ static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
842 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) 842 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
843 return -EBADFD; 843 return -EBADFD;
844 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 844 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
845 !substream->hw_no_buffer &&
845 !snd_pcm_playback_data(substream)) 846 !snd_pcm_playback_data(substream))
846 return -EPIPE; 847 return -EPIPE;
847 runtime->trigger_master = substream; 848 runtime->trigger_master = substream;