[alsa-devel] [PATCH 1/3] ASoC: Drop SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag

Lars-Peter Clausen lars at metafoo.de
Tue Oct 25 14:22:51 CEST 2016


On 10/25/2016 12:56 PM, Sylwester Nawrocki wrote:
> Since commit 194c7dea00c68c1b1f8ff26304fa937a006f66dd
> "ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_config"
> custom DMA channels can be also specified in chan_names[] field of
> struct snd_dmaengine_pcm_config.  This patch drops chan_name field
> of struct snd_dmaengine_dai_dma_data and makes soc-generic-dmaengine-pcm
> module using config->chan_names instead.  Remaining users of struct
> snd_dmaengine_dai_dma_data::chan_name are updated to not require
> that field.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki at samsung.com>

Nice patch. One nice-to-have change request, can you split this into two
patches, one which removes the last users and one patch which removes
support for it from the framework?

Having the new DMA map framework should also allow us to eventually remove
the channel request in dmaengine_pcm_new() once all users of filter
functions have gone.

[...]
> diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
> index 6cef397..f2d372d 100644
> --- a/sound/soc/soc-generic-dmaengine-pcm.c
> +++ b/sound/soc/soc-generic-dmaengine-pcm.c
> @@ -263,7 +263,6 @@ 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 device *dev = rtd->platform->dev;
> -	struct snd_dmaengine_dai_dma_data *dma_data;
>  	struct snd_pcm_substream *substream;
>  	size_t prealloc_buffer_size;
>  	size_t max_buffer_size;
> @@ -284,12 +283,9 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
>  		if (!substream)
>  			continue;
>  
> -		dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
> -
> -		if (!pcm->chan[i] &&
> -		    (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME))
> +		if (!pcm->chan[i] && config->chan_names[i])
>  			pcm->chan[i] = dma_request_slave_channel(dev,
> -				dma_data->chan_name);
> +				config->chan_names[i]);

I think this can be removed altogether. The only reason why we did the
delayed request is because the name would have not been available when
initially trying to request the channel when the PCM device is registered.

>  
>  		if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
>  			pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd,
> @@ -359,9 +355,7 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
>  	const char *name;
>  	struct dma_chan *chan;
>  
> -	if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT |
> -			   SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) ||
> -	    !dev->of_node)
> +	if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || !dev->of_node)
>  		return 0;
>  
>  	if (config && config->dma_dev) {
> 



More information about the Alsa-devel mailing list