From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/10] ASoC: imx-pcm-dma: Add support for DMA init by device node
Date: Sun, 10 Mar 2013 19:33:10 +0100 [thread overview]
Message-ID: <1362940391-8338-10-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1362940391-8338-1-git-send-email-mpa@pengutronix.de>
Add support for DMA initialization using devicetree node.
This patch adds two fields to imx_pcm_dma_params to pass device node
information from other imx drivers to this one. If the dma_node is set,
this driver tries to initialize a PCM DMA substream based on the
dma_node and name.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
sound/soc/fsl/imx-pcm-dma.c | 31 ++++++++++++++++++++-----------
sound/soc/fsl/imx-pcm.h | 6 ++++++
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 500f8ce..794103b 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -101,26 +101,35 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct imx_pcm_dma_params *dma_params;
- struct imx_dma_data *dma_data;
+ struct imx_dma_data *dma_data = NULL;
int ret;
snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
- if (!dma_data)
- return -ENOMEM;
+ if (dma_params->dma_client_node) {
+ ret = of_snd_dmaengine_pcm_open(substream,
+ dma_params->dma_client_node,
+ dma_params->dma_req_name);
+ if (ret)
+ return ret;
+ } else {
+ dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
+ if (!dma_data)
+ return -ENOMEM;
- dma_data->peripheral_type = dma_params->shared_peripheral ?
+ dma_data->peripheral_type = dma_params->shared_peripheral ?
IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI;
- dma_data->priority = DMA_PRIO_HIGH;
- dma_data->dma_request = dma_params->dma;
+ dma_data->priority = DMA_PRIO_HIGH;
+ dma_data->dma_request = dma_params->dma;
- ret = snd_dmaengine_pcm_open(substream, filter, dma_data);
- if (ret) {
- kfree(dma_data);
- return ret;
+ ret = snd_dmaengine_pcm_open(substream, filter, dma_data);
+
+ if (ret) {
+ kfree(dma_data);
+ return ret;
+ }
}
snd_dmaengine_pcm_set_data(substream, dma_data);
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 5ae13a1..d281fe2 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -23,6 +23,12 @@ struct imx_pcm_dma_params {
unsigned long dma_addr;
int burstsize;
bool shared_peripheral; /* The peripheral is on SPBA bus */
+
+ /* If set, the DMA channel is requested using this devicetree node while
+ * ignoring fields 'dma' and 'shared_peripheral'. They have to be set
+ * in devicetree according to the DMA Controller devicetree bindings. */
+ struct device_node *dma_client_node;
+ const char *dma_req_name; /* DMA Request name from devicetree */
};
int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
--
1.8.1.5
next prev parent reply other threads:[~2013-03-10 18:33 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 18:33 [PATCH 00/10] ASoC: imx sound: Add DT support Markus Pargmann
2013-03-10 18:33 ` [PATCH 01/10] imx-ssi: Fix AC97 rates Markus Pargmann
2013-03-10 18:47 ` Fabio Estevam
2013-03-11 19:51 ` Markus Pargmann
2013-03-13 22:55 ` Timur Tabi
2013-03-14 12:44 ` Markus Pargmann
2013-03-12 18:52 ` Mark Brown
2013-03-10 18:33 ` [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure Markus Pargmann
2013-03-12 18:53 ` Mark Brown
2013-03-10 18:33 ` [PATCH 03/10] mx-ssi: flush fifos Markus Pargmann
2013-03-12 18:54 ` Mark Brown
2013-03-10 18:33 ` [PATCH 04/10] ASoC: Kconfig: imx-ssi needs imx-fiq and imx-dma Markus Pargmann
2013-03-12 18:55 ` Mark Brown
2013-03-14 12:42 ` Markus Pargmann
2013-03-10 18:33 ` [PATCH 05/10] ASoC: pcm030 audio fabric: remove __init from probe Markus Pargmann
2013-03-12 18:55 ` Mark Brown
2013-03-10 18:33 ` [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order Markus Pargmann
2013-03-11 11:10 ` Mark Brown
2013-03-11 19:56 ` Markus Pargmann
2013-03-10 18:33 ` [PATCH 07/10] ASoC: phycore-ac97: Add DT support Markus Pargmann
2013-03-12 18:59 ` Mark Brown
2013-03-14 12:55 ` Markus Pargmann
2013-03-10 18:33 ` [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request Markus Pargmann
2013-03-12 19:02 ` Mark Brown
2013-03-13 2:18 ` Shawn Guo
2013-03-13 10:49 ` Mark Brown
2013-03-14 6:04 ` Shawn Guo
2013-03-15 1:12 ` Mark Brown
2013-03-14 13:08 ` Markus Pargmann
2013-03-15 3:42 ` Shawn Guo
2013-03-15 9:07 ` Markus Pargmann
2013-03-10 18:33 ` Markus Pargmann [this message]
2013-03-10 18:33 ` [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support Markus Pargmann
2013-03-10 18:55 ` Alexander Shiyan
2013-03-13 22:53 ` [PATCH 00/10] ASoC: imx sound: Add " Timur Tabi
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=1362940391-8338-10-git-send-email-mpa@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).