[alsa-devel] [PATCH 2/2] ASoC: generic-dmaengine-pcm: Support on-chip internal memory for DMA buffer

Lars-Peter Clausen lars at metafoo.de
Wed Oct 16 10:56:06 CEST 2013


On 10/16/2013 10:18 AM, Nicolin Chen wrote:
[...]
>   * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
> diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
> index e29ec3c..dd72964 100644
> --- a/sound/soc/soc-generic-dmaengine-pcm.c
> +++ b/sound/soc/soc-generic-dmaengine-pcm.c
> @@ -142,7 +142,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
>  	struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
>  	const struct snd_dmaengine_pcm_config *config = pcm->config;
>  	struct snd_pcm_substream *substream;
> -	unsigned int i;
> +	unsigned int i, type = SNDRV_DMA_TYPE_DEV;
>  	int ret;
>  
>  	for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
> @@ -162,8 +162,10 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
>  			goto err_free;
>  		}
>  
> -		ret = snd_pcm_lib_preallocate_pages(substream,
> -				SNDRV_DMA_TYPE_DEV,
> +		if (pcm->flags & SND_DMAENGINE_PCM_FLAG_DMA_IRAM)
> +			type = SNDRV_DMA_TYPE_DEV_IRAM;

Should we just make this the default, after all it will fallback to normal
memory if no iram region has been specified.

> +
> +		ret = snd_pcm_lib_preallocate_pages(substream, type,
>  				dmaengine_dma_dev(pcm, substream),
>  				config->prealloc_buffer_size,
>  				config->pcm_hardware->buffer_bytes_max);
> 



More information about the Alsa-devel mailing list