diff options
author | Mark Brown <broonie@kernel.org> | 2018-10-21 16:59:19 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-10-21 16:59:19 +0100 |
commit | 576b354ac25b544a31f27c365410d59fcbfee064 (patch) | |
tree | e635987441484a512d8a5adf0e3982363b35d1c8 /sound/soc/amd/acp-pcm-dma.c | |
parent | 35a7f35ad1b150ddf59a41dcac7b2fa32982be0e (diff) | |
parent | 747df19747bc9752cd40b9cce761e17a033aa5c2 (diff) |
Merge branch 'asoc-4.19' into asoc-linus
Diffstat (limited to 'sound/soc/amd/acp-pcm-dma.c')
-rw-r--r-- | sound/soc/amd/acp-pcm-dma.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 77b265bd0505..3135e9eafd18 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -1036,16 +1036,22 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { period_bytes = frames_to_bytes(runtime, runtime->period_size); - dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); - if (dscr == rtd->dma_dscr_idx_1) - pos = period_bytes; - else - pos = 0; bytescount = acp_get_byte_count(rtd); - if (bytescount > rtd->bytescount) + if (bytescount >= rtd->bytescount) bytescount -= rtd->bytescount; - delay = do_div(bytescount, period_bytes); - runtime->delay = bytes_to_frames(runtime, delay); + if (bytescount < period_bytes) { + pos = 0; + } else { + dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); + if (dscr == rtd->dma_dscr_idx_1) + pos = period_bytes; + else + pos = 0; + } + if (bytescount > 0) { + delay = do_div(bytescount, period_bytes); + runtime->delay = bytes_to_frames(runtime, delay); + } } else { buffersize = frames_to_bytes(runtime, runtime->buffer_size); bytescount = acp_get_byte_count(rtd); |