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> Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org> Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
parent
eb4032ed5c
commit
b45b11503a
3 changed files with 5 additions and 0 deletions
|
@ -490,6 +490,7 @@ struct snd_pcm_substream {
|
||||||
#endif /* CONFIG_SND_VERBOSE_PROCFS */
|
#endif /* CONFIG_SND_VERBOSE_PROCFS */
|
||||||
/* misc flags */
|
/* misc flags */
|
||||||
unsigned int hw_opened: 1;
|
unsigned int hw_opened: 1;
|
||||||
|
unsigned int hw_no_buffer: 1; /* substream may not have a buffer */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
|
#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
|
||||||
|
|
|
@ -2115,6 +2115,9 @@ static int pcm_sanity_check(struct snd_pcm_substream *substream)
|
||||||
struct snd_pcm_runtime *runtime;
|
struct snd_pcm_runtime *runtime;
|
||||||
if (PCM_RUNTIME_CHECK(substream))
|
if (PCM_RUNTIME_CHECK(substream))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
/* TODO: consider and -EINVAL here */
|
||||||
|
if (substream->hw_no_buffer)
|
||||||
|
snd_printd("%s: warning this PCM is host less\n", __func__);
|
||||||
runtime = substream->runtime;
|
runtime = substream->runtime;
|
||||||
if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
|
if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -1024,6 +1024,7 @@ static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
|
||||||
if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
|
if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||||
|
!substream->hw_no_buffer &&
|
||||||
!snd_pcm_playback_data(substream))
|
!snd_pcm_playback_data(substream))
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
runtime->trigger_tstamp_latched = false;
|
runtime->trigger_tstamp_latched = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue