Commit 1d3564d9 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] dmaengine: ipu-idmac: add support for the DMA_PAUSE control

To support multi-size buffers in the mx3_camera V4L2 driver we have to be
able to stop DMA on a channel without releasing descriptors and completely
halting the hardware. Use the DMA_PAUSE control to implement this mode.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2d86401c
...@@ -1307,6 +1307,7 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id) ...@@ -1307,6 +1307,7 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) { ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
callback = descnew->txd.callback; callback = descnew->txd.callback;
callback_param = descnew->txd.callback_param; callback_param = descnew->txd.callback_param;
list_del_init(&descnew->list);
spin_unlock(&ichan->lock); spin_unlock(&ichan->lock);
if (callback) if (callback)
callback(callback_param); callback(callback_param);
...@@ -1428,17 +1429,32 @@ static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, ...@@ -1428,17 +1429,32 @@ static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
{ {
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);
struct ipu *ipu = to_ipu(idmac);
struct list_head *list, *tmp;
unsigned long flags; unsigned long flags;
int i; int i;
/* Only supports DMA_TERMINATE_ALL */ switch (cmd) {
if (cmd != DMA_TERMINATE_ALL) case DMA_PAUSE:
return -ENXIO; spin_lock_irqsave(&ipu->lock, flags);
ipu_ic_disable_task(ipu, chan->chan_id);
/* Return all descriptors into "prepared" state */
list_for_each_safe(list, tmp, &ichan->queue)
list_del_init(list);
ichan->sg[0] = NULL;
ichan->sg[1] = NULL;
spin_unlock_irqrestore(&ipu->lock, flags);
ichan->status = IPU_CHANNEL_INITIALIZED;
break;
case DMA_TERMINATE_ALL:
ipu_disable_channel(idmac, ichan, ipu_disable_channel(idmac, ichan,
ichan->status >= IPU_CHANNEL_ENABLED); ichan->status >= IPU_CHANNEL_ENABLED);
tasklet_disable(&to_ipu(idmac)->tasklet); tasklet_disable(&ipu->tasklet);
/* ichan->queue is modified in ISR, have to spinlock */ /* ichan->queue is modified in ISR, have to spinlock */
spin_lock_irqsave(&ichan->lock, flags); spin_lock_irqsave(&ichan->lock, flags);
...@@ -1458,9 +1474,13 @@ static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, ...@@ -1458,9 +1474,13 @@ static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
ichan->sg[1] = NULL; ichan->sg[1] = NULL;
spin_unlock_irqrestore(&ichan->lock, flags); spin_unlock_irqrestore(&ichan->lock, flags);
tasklet_enable(&to_ipu(idmac)->tasklet); tasklet_enable(&ipu->tasklet);
ichan->status = IPU_CHANNEL_INITIALIZED; ichan->status = IPU_CHANNEL_INITIALIZED;
break;
default:
return -ENOSYS;
}
return 0; return 0;
} }
...@@ -1663,7 +1683,6 @@ static void __exit ipu_idmac_exit(struct ipu *ipu) ...@@ -1663,7 +1683,6 @@ static void __exit ipu_idmac_exit(struct ipu *ipu)
struct idmac_channel *ichan = ipu->channel + i; struct idmac_channel *ichan = ipu->channel + i;
idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL, 0); idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL, 0);
idmac_prep_slave_sg(&ichan->dma_chan, NULL, 0, DMA_NONE, 0);
} }
dma_async_device_unregister(&idmac->dma); dma_async_device_unregister(&idmac->dma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment