Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05827630 authored by Linus Walleij's avatar Linus Walleij Committed by Dan Williams
Browse files

DMAENGINE: extend the control command to include an arg



This adds an argument to the DMAengine control function, so that
we can later provide control commands that need some external data
passed in through an argument akin to the ioctl() operation
prototype.

[dan.j.williams@intel.com: fix up some missed conversions]
Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 4aed79b2
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -759,7 +759,8 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
	return NULL;
	return NULL;
}
}


static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
		       unsigned long arg)
{
{
	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
	struct at_dma		*atdma = to_at_dma(chan->device);
	struct at_dma		*atdma = to_at_dma(chan->device);
+3 −2
Original line number Original line Diff line number Diff line
@@ -942,7 +942,7 @@ coh901318_free_chan_resources(struct dma_chan *chan)


	spin_unlock_irqrestore(&cohc->lock, flags);
	spin_unlock_irqrestore(&cohc->lock, flags);


	chan->device->device_control(chan, DMA_TERMINATE_ALL);
	chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
}
}




@@ -1176,7 +1176,8 @@ coh901318_issue_pending(struct dma_chan *chan)
}
}


static int
static int
coh901318_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
coh901318_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
		  unsigned long arg)
{
{
	unsigned long flags;
	unsigned long flags;
	struct coh901318_chan *cohc = to_coh901318_chan(chan);
	struct coh901318_chan *cohc = to_coh901318_chan(chan);
+2 −1
Original line number Original line Diff line number Diff line
@@ -781,7 +781,8 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
	return NULL;
	return NULL;
}
}


static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
		       unsigned long arg)
{
{
	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
	struct dw_dma		*dw = to_dw_dma(chan->device);
	struct dw_dma		*dw = to_dw_dma(chan->device);
+1 −1
Original line number Original line Diff line number Diff line
@@ -775,7 +775,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
}
}


static int fsl_dma_device_control(struct dma_chan *dchan,
static int fsl_dma_device_control(struct dma_chan *dchan,
				  enum dma_ctrl_cmd cmd)
				  enum dma_ctrl_cmd cmd, unsigned long arg)
{
{
	struct fsldma_chan *chan;
	struct fsldma_chan *chan;
	unsigned long flags;
	unsigned long flags;
+7 −5
Original line number Original line Diff line number Diff line
@@ -1472,7 +1472,8 @@ static void idmac_issue_pending(struct dma_chan *chan)
	 */
	 */
}
}


static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
			   unsigned long arg)
{
{
	struct idmac_channel *ichan = to_idmac_chan(chan);
	struct idmac_channel *ichan = to_idmac_chan(chan);
	struct idmac *idmac = to_idmac(chan->device);
	struct idmac *idmac = to_idmac(chan->device);
@@ -1513,14 +1514,15 @@ static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
	return 0;
	return 0;
}
}


static int idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
static int idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
			 unsigned long arg)
{
{
	struct idmac_channel *ichan = to_idmac_chan(chan);
	struct idmac_channel *ichan = to_idmac_chan(chan);
	int ret;
	int ret;


	mutex_lock(&ichan->chan_mutex);
	mutex_lock(&ichan->chan_mutex);


	ret = __idmac_control(chan, cmd);
	ret = __idmac_control(chan, cmd, arg);


	mutex_unlock(&ichan->chan_mutex);
	mutex_unlock(&ichan->chan_mutex);


@@ -1616,7 +1618,7 @@ static void idmac_free_chan_resources(struct dma_chan *chan)


	mutex_lock(&ichan->chan_mutex);
	mutex_lock(&ichan->chan_mutex);


	__idmac_control(chan, DMA_TERMINATE_ALL);
	__idmac_control(chan, DMA_TERMINATE_ALL, 0);


	if (ichan->status > IPU_CHANNEL_FREE) {
	if (ichan->status > IPU_CHANNEL_FREE) {
#ifdef DEBUG
#ifdef DEBUG
@@ -1709,7 +1711,7 @@ static void __exit ipu_idmac_exit(struct ipu *ipu)
	for (i = 0; i < IPU_CHANNELS_NUM; i++) {
	for (i = 0; i < IPU_CHANNELS_NUM; i++) {
		struct idmac_channel *ichan = ipu->channel + i;
		struct idmac_channel *ichan = ipu->channel + i;


		idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL);
		idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL, 0);
		idmac_prep_slave_sg(&ichan->dma_chan, NULL, 0, DMA_NONE, 0);
		idmac_prep_slave_sg(&ichan->dma_chan, NULL, 0, DMA_NONE, 0);
	}
	}


Loading