alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
	Stephen Warren <swarren@nvidia.com>,
	Ryan Mallon <rmallon@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	H Hartley Sweeten <hsweeten@visionengravers.com>
Subject: Re: [PATCH 2/5] ASoC: ep93xx: remove custom DMA alloc compat function
Date: Tue, 10 Dec 2013 10:26:52 +0000	[thread overview]
Message-ID: <20131210102651.GZ29268@sirena.org.uk> (raw)
In-Reply-To: <1386620656-18391-3-git-send-email-swarren@wwwdotorg.org>


[-- Attachment #1.1: Type: text/plain, Size: 5016 bytes --]

On Mon, Dec 09, 2013 at 01:24:13PM -0700, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> ep93xx_compat_request_channel() is almost identical to
> dmaengine_pcm_compat_request_channel(), with the exception that the
> latter:
> 
> a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data
>    pointer rather than some custom type.
> 
> b) dma_data->filter_data rather than dma_data should be passed to
>    snd_dmaengine_pcm_request_channel() as the filter data.
> 
> Make minor changes to the ep93xx DAI drivers so that those two conditions
> are met. This allows removal of the custom .compat_request_channel().

Adding Hartley and Ryan.

> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  sound/soc/cirrus/ep93xx-ac97.c | 16 ++++++++++++----
>  sound/soc/cirrus/ep93xx-i2s.c  | 14 ++++++++++++--
>  sound/soc/cirrus/ep93xx-pcm.c  | 13 -------------
>  3 files changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
> index e45f0fd2f6b8..f434b6ebb1d6 100644
> --- a/sound/soc/cirrus/ep93xx-ac97.c
> +++ b/sound/soc/cirrus/ep93xx-ac97.c
> @@ -19,6 +19,7 @@
>  #include <linux/slab.h>
>  
>  #include <sound/core.h>
> +#include <sound/dmaengine_pcm.h>
>  #include <sound/ac97_codec.h>
>  #include <sound/soc.h>
>  
> @@ -97,6 +98,8 @@ struct ep93xx_ac97_info {
>  	struct device		*dev;
>  	void __iomem		*regs;
>  	struct completion	done;
> +	struct snd_dmaengine_dai_dma_data dma_params_rx;
> +	struct snd_dmaengine_dai_dma_data dma_params_tx;
>  };
>  
>  /* currently ALSA only supports a single AC97 device */
> @@ -317,8 +320,13 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
>  
>  static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai)
>  {
> -	dai->playback_dma_data = &ep93xx_ac97_pcm_out;
> -	dai->capture_dma_data = &ep93xx_ac97_pcm_in;
> +	struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai);
> +
> +	info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out;
> +	info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in;
> +
> +	dai->playback_dma_data = &info->dma_params_tx;
> +	dai->capture_dma_data = &info->dma_params_rx;
>  
>  	return 0;
>  }
> @@ -396,8 +404,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto fail;
>  
> -	err = ep93xx_pcm_platform_register(&pdev->dev);
> -	if (err)
> +	ret = ep93xx_pcm_platform_register(&pdev->dev);
> +	if (ret)
>  		goto fail_unregister;
>  
>  	return 0;
> diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
> index cc43ed2dbca5..d21a359f4011 100644
> --- a/sound/soc/cirrus/ep93xx-i2s.c
> +++ b/sound/soc/cirrus/ep93xx-i2s.c
> @@ -21,6 +21,7 @@
>  #include <linux/io.h>
>  
>  #include <sound/core.h>
> +#include <sound/dmaengine_pcm.h>
>  #include <sound/pcm.h>
>  #include <sound/pcm_params.h>
>  #include <sound/initval.h>
> @@ -63,6 +64,8 @@ struct ep93xx_i2s_info {
>  	struct clk			*sclk;
>  	struct clk			*lrclk;
>  	void __iomem			*regs;
> +	struct snd_dmaengine_dai_dma_data dma_params_rx;
> +	struct snd_dmaengine_dai_dma_data dma_params_tx;
>  };
>  
>  static struct ep93xx_dma_data ep93xx_i2s_dma_data[] = {
> @@ -142,8 +145,15 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
>  
>  static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai)
>  {
> -	dai->playback_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK];
> -	dai->capture_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE];
> +	struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
> +
> +	info->dma_params_tx.filter_data =
> +		&ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK];
> +	info->dma_params_rx.filter_data =
> +		&ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE];
> +
> +	dai->playback_dma_data = &info->dma_params_tx;
> +	dai->capture_dma_data = &info->dma_params_rx;
>  
>  	return 0;
>  }
> diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c
> index 144278aa65f9..856862932fdf 100644
> --- a/sound/soc/cirrus/ep93xx-pcm.c
> +++ b/sound/soc/cirrus/ep93xx-pcm.c
> @@ -59,22 +59,9 @@ static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
>  	return false;
>  }
>  
> -static struct dma_chan *ep93xx_compat_request_channel(
> -	struct snd_soc_pcm_runtime *rtd,
> -	struct snd_pcm_substream *substream)
> -{
> -	struct snd_dmaengine_dai_dma_data *dma_data;
> -
> -	dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
> -
> -	return snd_dmaengine_pcm_request_channel(ep93xx_pcm_dma_filter,
> -						 dma_data);
> -}
> -
>  static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = {
>  	.pcm_hardware = &ep93xx_pcm_hardware,
>  	.compat_filter_fn = ep93xx_pcm_dma_filter,
> -	.compat_request_channel = ep93xx_compat_request_channel,
>  	.prealloc_buffer_size = 131072,
>  };
>  
> -- 
> 1.8.1.5
> 
> 

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2013-12-10 10:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09 20:24 [PATCH 0/5] ASoC: remove dmaengine compat_request_channel Stephen Warren
2013-12-09 20:24 ` [PATCH 1/5] ASoC: ep93xx: get rid of ep93xx-pcm-audio struct device Stephen Warren
2013-12-09 20:44   ` Lars-Peter Clausen
2013-12-09 23:50     ` Stephen Warren
2013-12-10  7:47       ` Lars-Peter Clausen
2013-12-10 10:23         ` Mark Brown
2013-12-10 16:56           ` Stephen Warren
2013-12-10 17:02             ` Mark Brown
2013-12-10 11:57       ` Mark Brown
2013-12-10 10:26   ` Mark Brown
2013-12-10 16:58     ` Stephen Warren
2013-12-09 20:24 ` [PATCH 2/5] ASoC: ep93xx: remove custom DMA alloc compat function Stephen Warren
2013-12-10 10:26   ` Mark Brown [this message]
2013-12-09 20:24 ` [PATCH 3/5] ASoC: SPEAr: get rid of spear-pcm-audio struct device Stephen Warren
2013-12-09 20:48   ` Lars-Peter Clausen
2013-12-09 20:24 ` [PATCH 4/5] ASoC: SPEAr: remove custom DMA alloc compat function Stephen Warren
2013-12-09 21:17   ` Lars-Peter Clausen
2013-12-10  6:30     ` Rajeev kumar
2013-12-10  7:45       ` Lars-Peter Clausen
2013-12-10  8:53         ` Rajeev kumar
2013-12-10  9:00           ` Lars-Peter Clausen
2013-12-10 11:44             ` Rajeev kumar
2013-12-09 20:24 ` [RFC PATCH 5/5] ASoC: dmaengine: remove compat_request_channel Stephen Warren
2013-12-09 20:38 ` [PATCH 0/5] ASoC: remove dmaengine compat_request_channel Lars-Peter Clausen
2013-12-10  8:21   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131210102651.GZ29268@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=hsweeten@visionengravers.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=rmallon@gmail.com \
    --cc=swarren@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).