Re: [PATCH 03/16] ALSA: hda: Interrupt servicing and BDL setup for compress streams

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

 



On Thu, 01 Dec 2022 18:56:06 +0100,
Cezary Rojewski wrote:
> 
> Account for compress streams when receiving and servicing buffer
> completed interrupts. In case of compress stream enlisting hdac_stream
> for data transfer, setup BDL entries much like it is the case for PCM
> streams.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@xxxxxxxxx>
> Signed-off-by: Divya Prakash <divya1.prakash@xxxxxxxxx>

Usually the person who submitted the patch signs off at the last.

For the content:

Acked-by: Takashi Iwai <tiwai@xxxxxxx>


thanks,

Takashi


> ---
>  sound/hda/hdac_controller.c |  4 ++--
>  sound/hda/hdac_stream.c     | 26 ++++++++++++++++++++------
>  2 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
> index 9a60bfdb39ba..3c7af6558249 100644
> --- a/sound/hda/hdac_controller.c
> +++ b/sound/hda/hdac_controller.c
> @@ -578,8 +578,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
>  			sd_status = snd_hdac_stream_readb(azx_dev, SD_STS);
>  			snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK);
>  			handled |= 1 << azx_dev->index;
> -			if (!azx_dev->substream || !azx_dev->running ||
> -			    !(sd_status & SD_INT_COMPLETE))
> +			if ((!azx_dev->substream && !azx_dev->cstream) ||
> +			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
>  				continue;
>  			if (ack)
>  				ack(bus, azx_dev);
> diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
> index 8a12c6347914..4e236719bdd1 100644
> --- a/sound/hda/hdac_stream.c
> +++ b/sound/hda/hdac_stream.c
> @@ -7,6 +7,7 @@
>  #include <linux/delay.h>
>  #include <linux/export.h>
>  #include <linux/clocksource.h>
> +#include <sound/compress_driver.h>
>  #include <sound/core.h>
>  #include <sound/pcm.h>
>  #include <sound/hdaudio.h>
> @@ -487,14 +488,20 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
>  {
>  	struct hdac_bus *bus = azx_dev->bus;
>  	struct snd_pcm_substream *substream = azx_dev->substream;
> +	struct snd_compr_stream *cstream = azx_dev->cstream;
>  	struct snd_pcm_runtime *runtime;
>  	struct snd_dma_buffer *dmab;
>  	__le32 *bdl;
>  	int i, ofs, periods, period_bytes;
>  	int pos_adj, pos_align;
>  
> -	runtime = substream->runtime;
> -	dmab = snd_pcm_get_dma_buf(substream);
> +	if (substream) {
> +		runtime = substream->runtime;
> +		dmab = snd_pcm_get_dma_buf(substream);
> +	} else if (cstream) {
> +		runtime = NULL;
> +		dmab = snd_pcm_get_dma_buf(cstream);
> +	}
>  
>  	/* reset BDL address */
>  	snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0);
> @@ -562,15 +569,22 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
>  				 unsigned int format_val)
>  {
>  	struct snd_pcm_substream *substream = azx_dev->substream;
> +	struct snd_compr_stream *cstream = azx_dev->cstream;
>  	unsigned int bufsize, period_bytes;
>  	unsigned int no_period_wakeup;
>  	int err;
>  
> -	if (!substream)
> +	if (substream) {
> +		bufsize = snd_pcm_lib_buffer_bytes(substream);
> +		period_bytes = snd_pcm_lib_period_bytes(substream);
> +		no_period_wakeup = substream->runtime->no_period_wakeup;
> +	} else if (cstream) {
> +		bufsize = cstream->runtime->buffer_size;
> +		period_bytes = cstream->runtime->fragment_size;
> +		no_period_wakeup = 0;
> +	} else {
>  		return -EINVAL;
> -	bufsize = snd_pcm_lib_buffer_bytes(substream);
> -	period_bytes = snd_pcm_lib_period_bytes(substream);
> -	no_period_wakeup = substream->runtime->no_period_wakeup;
> +	}
>  
>  	if (bufsize != azx_dev->bufsize ||
>  	    period_bytes != azx_dev->period_bytes ||
> -- 
> 2.25.1
> 



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

  Powered by Linux