Re: [PATCH 4/4] ALSA: hda: check if stream is stopped in snd_hdac_stream_clear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 May 2018 08:40:56 +0200,
Sriram Periyasamy wrote:
> 
> From: Pardha Saradhi K <pardha.saradhi.kesapragada@xxxxxxxxx>
> 
> 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@xxxxxxxxx>
> Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@xxxxxxxxx>
> ---
>  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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux