Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: amd: removed separate byte count variables for playback and capture

Removed separate byte count variables for playback and capture.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Vijendar Mukunda and committed by
Mark Brown
9af8937e 7f004847

+6 -16
+5 -14
sound/soc/amd/acp-pcm-dma.c
··· 866 866 buffersize = frames_to_bytes(runtime, runtime->buffer_size); 867 867 bytescount = acp_get_byte_count(rtd); 868 868 869 - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 870 - if (bytescount > rtd->i2ssp_renderbytescount) 871 - bytescount = bytescount - rtd->i2ssp_renderbytescount; 872 - } else { 873 - if (bytescount > rtd->i2ssp_capturebytescount) 874 - bytescount = bytescount - rtd->i2ssp_capturebytescount; 875 - } 869 + if (bytescount > rtd->bytescount) 870 + bytescount -= rtd->bytescount; 876 871 pos = do_div(bytescount, buffersize); 877 872 return bytes_to_frames(runtime, pos); 878 873 } ··· 916 921 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 917 922 case SNDRV_PCM_TRIGGER_RESUME: 918 923 bytescount = acp_get_byte_count(rtd); 924 + if (rtd->bytescount == 0) 925 + rtd->bytescount = bytescount; 919 926 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 920 - if (rtd->i2ssp_renderbytescount == 0) 921 - rtd->i2ssp_renderbytescount = bytescount; 922 927 acp_dma_start(rtd->acp_mmio, rtd->ch1, false); 923 928 while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & 924 929 BIT(rtd->ch1)) { ··· 929 934 } 930 935 cpu_relax(); 931 936 } 932 - } else { 933 - if (rtd->i2ssp_capturebytescount == 0) 934 - rtd->i2ssp_capturebytescount = bytescount; 935 937 } 936 938 acp_dma_start(rtd->acp_mmio, rtd->ch2, true); 937 939 ret = 0; ··· 947 955 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 948 956 acp_dma_stop(rtd->acp_mmio, rtd->ch1); 949 957 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch2); 950 - rtd->i2ssp_renderbytescount = 0; 951 958 } else { 952 959 acp_dma_stop(rtd->acp_mmio, rtd->ch2); 953 960 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch1); 954 - rtd->i2ssp_capturebytescount = 0; 955 961 } 962 + rtd->bytescount = 0; 956 963 break; 957 964 default: 958 965 ret = -EINVAL;
+1 -2
sound/soc/amd/acp.h
··· 93 93 u32 byte_cnt_high_reg_offset; 94 94 u32 byte_cnt_low_reg_offset; 95 95 uint64_t size; 96 - u64 i2ssp_renderbytescount; 97 - u64 i2ssp_capturebytescount; 96 + u64 bytescount; 98 97 void __iomem *acp_mmio; 99 98 }; 100 99