[alsa-devel] [PATCH 4/4] ALSA: hda: check if stream is stopped in snd_hdac_stream_clear

Sriram Periyasamy sriramx.periyasamy at intel.com
Tue May 15 08:40:56 CEST 2018


From: Pardha Saradhi K <pardha.saradhi.kesapragada at intel.com>

Check if the DMA Channel is already stopped. There is no need
to stop it again if stopped.

Signed-off-by: Pardha Saradhi K <pardha.saradhi.kesapragada at intel.com>
Signed-off-by: Sriram Periyasamy <sriramx.periyasamy at intel.com>
---
 sound/hda/hdac_stream.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index aa8a2884289f..c1810eb7212b 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -89,6 +89,11 @@ void snd_hdac_stream_clear(struct hdac_stream *azx_dev)
 	int timeout = 300;
 	unsigned char val;
 
+	/* check if the DMA is already stopped */
+	val = snd_hdac_stream_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START;
+	if (!val)
+		return;
+
 	snd_hdac_stream_updateb(azx_dev, SD_CTL,
 				SD_CTL_DMA_START | SD_INT_MASK, 0);
 
-- 
2.7.4



More information about the Alsa-devel mailing list