path: root/drivers/dma/dmaengine.c
diff options
authorJon Hunter <>2012-09-14 17:41:57 -0500
committerVinod Koul <>2013-01-06 20:57:45 -0800
commit9a6cecc846169159bfce511f4c0034bb96eea1ca (patch)
treee5d0dcef464741a0988e4355744a33cb55e6bcd4 /drivers/dma/dmaengine.c
parentd1c3ed669a2d452cacfb48c2d171a1f364dae2ed (diff)
dmaengine: add helper function to request a slave DMA channel
Currently slave DMA channels are requested by calling dma_request_channel() and requires DMA clients to pass various filter parameters to obtain the appropriate channel. With device-tree being used by architectures such as arm and the addition of device-tree helper functions to extract the relevant DMA client information from device-tree, add a new function to request a slave DMA channel using device-tree. This function is currently a simple wrapper that calls the device-tree of_dma_request_slave_channel() function. Cc: Nicolas Ferre <> Cc: Benoit Cousson <> Cc: Stephen Warren <> Cc: Grant Likely <> Cc: Russell King <> Cc: Rob Herring <> Cc: Arnd Bergmann <> Cc: Vinod Koul <> Cc: Dan Williams <> Acked-by: Arnd Bergmann <> Signed-off-by: Jon Hunter <> Reviewed-by: Stephen Warren <> Acked-by: Rob Herring <> Signed-off-by: Vinod Koul <>
Diffstat (limited to 'drivers/dma/dmaengine.c')
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a815d44c70a4..d37cf95987b6 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -62,6 +62,7 @@
#include <linux/rculist.h>
#include <linux/idr.h>
#include <linux/slab.h>
+#include <linux/of_dma.h>
static DEFINE_MUTEX(dma_list_mutex);
static DEFINE_IDR(dma_idr);
@@ -546,6 +547,21 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v
+ * dma_request_slave_channel - try to allocate an exclusive slave channel
+ * @dev: pointer to client device structure
+ * @name: slave channel name
+ */
+struct dma_chan *dma_request_slave_channel(struct device *dev, char *name)
+ /* If device-tree is present get slave info from here */
+ if (dev->of_node)
+ return of_dma_request_slave_channel(dev->of_node, name);
+ return NULL;
void dma_release_channel(struct dma_chan *chan)