On Tue, 15 May 2018 08:40:56 +0200, Sriram Periyasamy wrote:
From: Pardha Saradhi K pardha.saradhi.kesapragada@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@intel.com Signed-off-by: Sriram Periyasamy sriramx.periyasamy@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);
Here we call snd_hdac_stream_updateb(), so we don't write unnecessarily.
And, if any shortcut is wanted, rather check azx_dev->running flag instead of the h/w register. The former is significantly cheaper.
thanks,
Takashi