ALSA: pcm: call delay_blk op from DELAY ioctl

Call the delay_blk() pcm op from the
SNDRV_PCM_IOCTL_DELAY ioctl.  This will update the
runtime->delay field with the current DSP path
delay before it is used to return the total delay.

Change-Id: I485139666a639566782a93b566b30899f2f5e791
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
This commit is contained in:
Kenneth Westfield 2015-05-19 12:15:41 -07:00
parent 8f1992d60c
commit d1404e2b8b
3 changed files with 13 additions and 1 deletions

View file

@ -889,10 +889,11 @@ void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *op
void snd_pcm_set_sync(struct snd_pcm_substream *substream);
int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg);
unsigned int cmd, void *arg);
int snd_pcm_update_state(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime);
int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
int snd_pcm_update_delay_blk(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);

View file

@ -563,6 +563,11 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
return snd_pcm_update_hw_ptr0(substream, 0);
}
int snd_pcm_update_delay_blk(struct snd_pcm_substream *substream)
{
return substream->ops->delay_blk(substream);
}
/**
* snd_pcm_set_ops - set the PCM operators
* @pcm: the pcm instance

View file

@ -2497,6 +2497,12 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream,
int err;
snd_pcm_sframes_t n = 0;
/*
* Called outside irq lock, as this will block waiting for
* DSP to respond.
*/
snd_pcm_update_delay_blk(substream);
snd_pcm_stream_lock_irq(substream);
switch (runtime->status->state) {
case SNDRV_PCM_STATE_DRAINING: