diff options
-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) | |||
1036 | 1036 | ||
1037 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 1037 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
1038 | period_bytes = frames_to_bytes(runtime, runtime->period_size); | 1038 | period_bytes = frames_to_bytes(runtime, runtime->period_size); |
1039 | dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); | ||
1040 | if (dscr == rtd->dma_dscr_idx_1) | ||
1041 | pos = period_bytes; | ||
1042 | else | ||
1043 | pos = 0; | ||
1044 | bytescount = acp_get_byte_count(rtd); | 1039 | bytescount = acp_get_byte_count(rtd); |
1045 | if (bytescount > rtd->bytescount) | 1040 | if (bytescount >= rtd->bytescount) |
1046 | bytescount -= rtd->bytescount; | 1041 | bytescount -= rtd->bytescount; |
1047 | delay = do_div(bytescount, period_bytes); | 1042 | if (bytescount < period_bytes) { |
1048 | runtime->delay = bytes_to_frames(runtime, delay); | 1043 | pos = 0; |
1044 | } else { | ||
1045 | dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); | ||
1046 | if (dscr == rtd->dma_dscr_idx_1) | ||
1047 | pos = period_bytes; | ||
1048 | else | ||
1049 | pos = 0; | ||
1050 | } | ||
1051 | if (bytescount > 0) { | ||
1052 | delay = do_div(bytescount, period_bytes); | ||
1053 | runtime->delay = bytes_to_frames(runtime, delay); | ||
1054 | } | ||
1049 | } else { | 1055 | } else { |
1050 | buffersize = frames_to_bytes(runtime, runtime->buffer_size); | 1056 | buffersize = frames_to_bytes(runtime, runtime->buffer_size); |
1051 | bytescount = acp_get_byte_count(rtd); | 1057 | bytescount = acp_get_byte_count(rtd); |