Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Ola Lilja <ola.o.lilja@stericsson.com>,
	alsa-devel@alsa-project.org,
	Stephen Warren <swarren@wwwdotorg.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Shawn Guo <shawn.guo@linaro.org>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH 5/8] ASoC: dmaengine-pcm: Add a common DAI DMA data struct
Date: Wed, 3 Apr 2013 12:07:30 +0200	[thread overview]
Message-ID: <515BFF62.9080202@ti.com> (raw)
In-Reply-To: <1364979965-15776-1-git-send-email-lars@metafoo.de>

On 04/03/2013 11:06 AM, Lars-Peter Clausen wrote:
> This patch adds a common DMA data struct which can be used by DAI drivers to
> communicate their DMA configuration requirements to the DMA pcm driver.  Having
> a common data structure for this allows us to implement common functions on top
> of them, which can be used by multiple platforms.
> 
> This patch also introduces a new function to initialize certain fields of a
> dma_slave_config struct from the common DAI DMA data struct.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  include/sound/dmaengine_pcm.h | 24 ++++++++++++++++++++++++
>  sound/soc/soc-dmaengine-pcm.c | 37 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+)
> 
> diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
> index f8a7031..9562042 100644
> --- a/include/sound/dmaengine_pcm.h
> +++ b/include/sound/dmaengine_pcm.h
> @@ -44,4 +44,28 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
>  
>  struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream);
>  
> +/**
> + * struct snd_dmaengine_dai_dma_data - DAI DMA configuration data
> + * @addr: Address of the DAI data source or destination register.
> + * @addr_width: Width of the DAI data source or destination register.
> + * @maxburst: Maximum number of words(note: words, as in units of the
> + * src_addr_width member, not bytes) that can be send to or received from the
> + * DAI in one burst.
> + * @slave_id: Slave requester id for the DMA channel.
> + * @filter_data: Custom DMA channel filter data, this will usually be used when
> + * requesting the DMA channel.
> + */
> +struct snd_dmaengine_dai_dma_data {
> +	dma_addr_t addr;
> +	enum dma_slave_buswidth addr_width;
> +	u32 maxburst;
> +	unsigned int slave_id;
> +	void *filter_data;
> +};
> +
> +void snd_dmaengine_pcm_set_config_from_dai_data(
> +	const struct snd_pcm_substream *substream,
> +	const struct snd_dmaengine_dai_dma_data *dma_data,
> +	struct dma_slave_config *config);
> +
>  #endif
> diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
> index 7c24ded..a9a300a 100644
> --- a/sound/soc/soc-dmaengine-pcm.c
> +++ b/sound/soc/soc-dmaengine-pcm.c
> @@ -95,6 +95,43 @@ int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream,
>  }
>  EXPORT_SYMBOL_GPL(snd_hwparams_to_dma_slave_config);
>  
> +/**
> + * snd_dmaengine_pcm_set_config_from_dai_data() - Initializes a dma slave config
> + *  using DAI DMA data.
> + * @substream: PCM substream
> + * @dma_data: DAI DMA data
> + * @slave_config: DMA slave configuration
> + *
> + * Initializes the {dst,src}_addr, {dst,src}_maxburst, {dst,src}_addr_width and
> + * slave_id fields of the DMA slave config from the same fields of the DAI DMA
> + * data struct. The src and dst fields will be initialized depending on the
> + * direction of the substream. If the substream is a playback stream the dst
> + * fields will be initialized, if it is a capture stream the src fields will be
> + * initialized. The {dst,src}_addr_width field will only be initialized if the
> + * addr_width field of the DAI DMA data struct is not equal to
> + * DMA_SLAVE_BUSWIDTH_UNDEFINED.
> + */
> +void snd_dmaengine_pcm_set_config_from_dai_data(
> +	const struct snd_pcm_substream *substream,
> +	const struct snd_dmaengine_dai_dma_data *dma_data,
> +	struct dma_slave_config *slave_config)
> +{
> +	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +		slave_config->dst_addr = dma_data->addr;
> +		slave_config->dst_maxburst = dma_data->maxburst;
> +		if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED)
> +			slave_config->dst_addr_width = dma_data->addr_width;
> +	} else {
> +		slave_config->src_addr = dma_data->addr;
> +		slave_config->src_maxburst = dma_data->maxburst;
> +		if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED)
> +			slave_config->src_addr_width = dma_data->addr_width;
> +	}
> +
> +	slave_config->slave_id = dma_data->slave_id;
> +}
> +EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_config_from_dai_data);
> +
>  static void dmaengine_pcm_dma_complete(void *arg)
>  {
>  	struct snd_pcm_substream *substream = arg;
> 


-- 
Péter

  parent reply	other threads:[~2013-04-03 10:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03  8:59 [PATCH 0/8] More dmaengine PCM cleanups Lars-Peter Clausen
2013-04-03  9:00 ` [PATCH 1/8] ASoC: ep93xx_pcm: Fix compile error Lars-Peter Clausen
2013-04-05 10:25   ` Mark Brown
2013-04-03  9:00 ` [PATCH 2/8] ASoC: tegra: Don't claim to support PCM pause and resume Lars-Peter Clausen
2013-04-03 16:56   ` Stephen Warren
2013-04-03 17:04   ` Mark Brown
2013-04-03  9:02 ` [PATCH 3/8] ASoC: ux500_pcm: Use the same snd_pcm_hardware for playback and capture Lars-Peter Clausen
2013-04-03  9:02   ` [PATCH 4/8] ASoC: dmaengine_pcm: Setup device_fc in snd_hwparams_to_dma_slave_config Lars-Peter Clausen
2013-04-03  8:06     ` Nicolas Ferre
2013-04-03 10:07     ` Peter Ujfalusi
2013-04-03 17:04     ` Mark Brown
2013-04-07 19:24   ` [PATCH 3/8] ASoC: ux500_pcm: Use the same snd_pcm_hardware for playback and capture Mark Brown
2013-04-03  9:06 ` [PATCH 5/8] ASoC: dmaengine-pcm: Add a common DAI DMA data struct Lars-Peter Clausen
2013-04-03  9:06   ` [PATCH 6/8] ASoC: tegra: Use " Lars-Peter Clausen
2013-04-03 17:08     ` Stephen Warren
2013-04-03 18:38       ` Lars-Peter Clausen
2013-04-03 17:14     ` Mark Brown
2013-04-03  9:06   ` [PATCH 7/8] ASoC: fsl: " Lars-Peter Clausen
2013-04-05  5:19     ` Shawn Guo
2013-04-05 10:26     ` Mark Brown
2013-04-03  9:06   ` [PATCH 8/8] ASoC: omap: Use common DAI DMA data Lars-Peter Clausen
2013-04-03 10:06     ` Peter Ujfalusi
2013-04-03 12:12       ` Jarkko Nikula
2013-04-03 17:08     ` Mark Brown
2013-04-03 10:07   ` Peter Ujfalusi [this message]
2013-04-03 17:08   ` [PATCH 5/8] ASoC: dmaengine-pcm: Add a common DAI DMA data struct Mark Brown

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=515BFF62.9080202@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=ldewangan@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=ola.o.lilja@stericsson.com \
    --cc=shawn.guo@linaro.org \
    --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