dmaengine: introduce dma_request_channel and private channels
authorDan Williams <dan.j.williams@intel.com>
Tue, 6 Jan 2009 18:38:15 +0000 (11:38 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 6 Jan 2009 18:38:15 +0000 (11:38 -0700)
commit59b5ec21446b9239d706ab237fb261d525b75e81
treea437a354e84d311104829ca0e8b00b0ec8cb05c4
parentf67b45999205164958de4ec0658d51fa4bee066d
dmaengine: introduce dma_request_channel and private channels

This interface is primarily for device-to-memory clients which need to
search for dma channels with platform-specific characteristics.  The
prototype is:

struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
                                     dma_filter_fn filter_fn,
                                     void *filter_param);

When the optional 'filter_fn' parameter is set to NULL
dma_request_channel simply returns the first channel that satisfies the
capability mask.  Otherwise, when the mask parameter is insufficient for
specifying the necessary channel, the filter_fn routine can be used to
disposition the available channels in the system. The filter_fn routine
is called once for each free channel in the system.  Upon seeing a
suitable channel filter_fn returns DMA_ACK which flags that channel to
be the return value from dma_request_channel.  A channel allocated via
this interface is exclusive to the caller, until dma_release_channel()
is called.

To ensure that all channels are not consumed by the general-purpose
allocator the DMA_PRIVATE capability is provided to exclude a dma_device
from general-purpose (memory-to-memory) consideration.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/dma/dmaengine.c
include/linux/dmaengine.h