From: Shawn Guo <shawn.guo@linaro.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
alsa-devel@alsa-project.org, Arnd Bergmann <arnd@arndb.de>,
Huang Shijie <b32955@freescale.com>,
Vinod Koul <vinod.koul@intel.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Marek Vasut <marek.vasut@gmail.com>,
Shawn Guo <shawn.guo@linaro.org>
Subject: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
Date: Wed, 27 Feb 2013 23:25:45 +0800 [thread overview]
Message-ID: <1361978748-25281-10-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1361978748-25281-1-git-send-email-shawn.guo@linaro.org>
With generic DMA device tree binding and helper function
dma_request_slave_channel() in place, dmaengine_pcm should support
that in requesting DMA channel for users that support generic DMA
device tree binding.
Instead of inventing a new API, it defines the parameters needed by
dma_request_slave_channel() into struct snd_dma_channel_params,
interprets filter_data into snd_dma_channel_params, and calls the
helper in case that dmaengine_pcm users pass in a NULL filter_fn.
Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
filter_fn and snd_dma_channel_params being filter_data to direct the
API to request DMA channel using generic DMA helper.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org
---
include/sound/dmaengine_pcm.h | 5 +++++
sound/soc/soc-dmaengine-pcm.c | 19 +++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b877334..6c0f795 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -18,6 +18,11 @@
#include <sound/pcm.h>
#include <linux/dmaengine.h>
+struct snd_dma_channel_params {
+ struct device *dev;
+ char *name;
+};
+
/**
* snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM
* substream
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
index 111b7d92..7ef8034 100644
--- a/sound/soc/soc-dmaengine-pcm.c
+++ b/sound/soc/soc-dmaengine-pcm.c
@@ -247,12 +247,19 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_pointer);
static int dmaengine_pcm_request_channel(struct dmaengine_pcm_runtime_data *prtd,
dma_filter_fn filter_fn, void *filter_data)
{
- dma_cap_mask_t mask;
-
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- dma_cap_set(DMA_CYCLIC, mask);
- prtd->dma_chan = dma_request_channel(mask, filter_fn, filter_data);
+ if (filter_fn) {
+ dma_cap_mask_t mask;
+
+ dma_cap_zero(mask);
+ dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_CYCLIC, mask);
+ prtd->dma_chan = dma_request_channel(mask, filter_fn,
+ filter_data);
+ } else {
+ struct snd_dma_channel_params *params = filter_data;
+ prtd->dma_chan = dma_request_slave_channel(params->dev,
+ params->name);
+ }
if (!prtd->dma_chan)
return -ENXIO;
--
1.7.9.5
next parent reply other threads:[~2013-02-27 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1361978748-25281-1-git-send-email-shawn.guo@linaro.org>
2013-02-27 15:25 ` Shawn Guo [this message]
2013-02-27 21:02 ` [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper Arnd Bergmann
2013-02-28 8:09 ` Shawn Guo
2013-03-01 10:23 ` Mark Brown
2013-03-04 8:37 ` Shawn Guo
2013-02-27 15:25 ` [PATCH 10/12] ASoC: mxs: move to use " Shawn Guo
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=1361978748-25281-10-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=b32955@freescale.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=fabio.estevam@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=vinod.koul@intel.com \
/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).