summaryrefslogtreecommitdiffstats
path: root/sound/soc/amd
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-10-19 08:31:41 -0400
committerMark Brown <broonie@kernel.org>2018-10-19 08:31:41 -0400
commit7ece50c9f790270e82b77589d34e54547c895a66 (patch)
tree871ccdc59063eb9f9ec2b76a13da69fb54b1a6a6 /sound/soc/amd
parente3a360b8cdede74d25807fc405e5d8bfb025692f (diff)
parent747df19747bc9752cd40b9cce761e17a033aa5c2 (diff)
Merge remote-tracking branch 'asoc/for-4.19' into asoc-4.20
Diffstat (limited to 'sound/soc/amd')
-rw-r--r--sound/soc/amd/acp-pcm-dma.c22
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 c7e972b17c90..cdebab2f8ce5 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -1040,16 +1040,22 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream)
1040 1040
1041 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 1041 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
1042 period_bytes = frames_to_bytes(runtime, runtime->period_size); 1042 period_bytes = frames_to_bytes(runtime, runtime->period_size);
1043 dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr);
1044 if (dscr == rtd->dma_dscr_idx_1)
1045 pos = period_bytes;
1046 else
1047 pos = 0;
1048 bytescount = acp_get_byte_count(rtd); 1043 bytescount = acp_get_byte_count(rtd);
1049 if (bytescount > rtd->bytescount) 1044 if (bytescount >= rtd->bytescount)
1050 bytescount -= rtd->bytescount; 1045 bytescount -= rtd->bytescount;
1051 delay = do_div(bytescount, period_bytes); 1046 if (bytescount < period_bytes) {
1052 runtime->delay = bytes_to_frames(runtime, delay); 1047 pos = 0;
1048 } else {
1049 dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr);
1050 if (dscr == rtd->dma_dscr_idx_1)
1051 pos = period_bytes;
1052 else
1053 pos = 0;
1054 }
1055 if (bytescount > 0) {
1056 delay = do_div(bytescount, period_bytes);
1057 runtime->delay = bytes_to_frames(runtime, delay);
1058 }
1053 } else { 1059 } else {
1054 buffersize = frames_to_bytes(runtime, runtime->buffer_size); 1060 buffersize = frames_to_bytes(runtime, runtime->buffer_size);
1055 bytescount = acp_get_byte_count(rtd); 1061 bytescount = acp_get_byte_count(rtd);