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

Nicolin Chen b42378 at freescale.com
Wed Oct 16 10:51:32 CEST 2013


On Wed, Oct 16, 2013 at 10:56:06AM +0200, Lars-Peter Clausen wrote:
> 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.

If you said so, I would definitely like to do this. I was..eh..just not sure
others might have concerns about it because it changed the default solution.

Thank you,
Nicolin Chen

> 
> > +
> > +		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