From 834543341838b043f07f4a2b9530e7e32dde187d Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Wed, 16 May 2018 15:31:40 +0800 Subject: [PATCH] ALSA: pcm_dmaengine: always get stream position from DMA driver This patch fixup that the wrong position when dma desc status is DONE. even if the desc status is DONE, it is still able to get the position from the dma driver. so, just remove the judgement. Change-Id: I40e92bae09a002f4f5f0b2fab8b0e99fd3ee269d Signed-off-by: Sugar Zhang --- sound/core/pcm_dmaengine.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 8eb58c709b14..02d3fb42a992 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -250,16 +250,13 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream) { struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); struct dma_tx_state state; - enum dma_status status; unsigned int buf_size; unsigned int pos = 0; - status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); - if (status == DMA_IN_PROGRESS || status == DMA_PAUSED) { - buf_size = snd_pcm_lib_buffer_bytes(substream); - if (state.residue > 0 && state.residue <= buf_size) - pos = buf_size - state.residue; - } + dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); + buf_size = snd_pcm_lib_buffer_bytes(substream); + if (state.residue > 0 && state.residue <= buf_size) + pos = buf_size - state.residue; return bytes_to_frames(substream->runtime, pos); }