Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: of-dma: Add support for optional router configuration callback

Additional configuration for the DMA event router might be needed for a
channel which can not be done during device_alloc_chan_resources callback
since the router information is not yet present for the drivers.

If there is a need for additional configuration for the channel if DMA
router is in use, then the driver can implement the device_router_config
callback.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20201208090440.31792-8-peter.ujfalusi@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Peter Ujfalusi and committed by
Vinod Koul
4f910c03 d553e2ab

+12
+10
drivers/dma/of-dma.c
··· 75 75 ofdma->dma_router->route_free(ofdma->dma_router->dev, 76 76 route_data); 77 77 } else { 78 + int ret = 0; 79 + 78 80 chan->router = ofdma->dma_router; 79 81 chan->route_data = route_data; 82 + 83 + if (chan->device->device_router_config) 84 + ret = chan->device->device_router_config(chan); 85 + 86 + if (ret) { 87 + dma_release_channel(chan); 88 + chan = ERR_PTR(ret); 89 + } 80 90 } 81 91 82 92 /*
+2
include/linux/dmaengine.h
··· 805 805 * by tx_status 806 806 * @device_alloc_chan_resources: allocate resources and return the 807 807 * number of allocated descriptors 808 + * @device_router_config: optional callback for DMA router configuration 808 809 * @device_free_chan_resources: release DMA channel's resources 809 810 * @device_prep_dma_memcpy: prepares a memcpy operation 810 811 * @device_prep_dma_xor: prepares a xor operation ··· 880 879 enum dma_residue_granularity residue_granularity; 881 880 882 881 int (*device_alloc_chan_resources)(struct dma_chan *chan); 882 + int (*device_router_config)(struct dma_chan *chan); 883 883 void (*device_free_chan_resources)(struct dma_chan *chan); 884 884 885 885 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(