]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/dma/ipu/ipu_idmac.c
DMAENGINE: extend the control command to include an arg
[mirror_ubuntu-zesty-kernel.git] / drivers / dma / ipu / ipu_idmac.c
index e80bae1673fa910f2a774fb455b28f4f61b05075..cb26ee9773d69cc8a612bce3af4deb878d59a157 100644 (file)
@@ -348,6 +348,7 @@ static void ipu_ch_param_set_size(union chan_param_mem *params,
                break;
        case IPU_PIX_FMT_BGRA32:
        case IPU_PIX_FMT_BGR32:
+       case IPU_PIX_FMT_ABGR32:
                params->ip.bpp  = 0;
                params->ip.pfs  = 4;
                params->ip.npb  = 7;
@@ -376,20 +377,6 @@ static void ipu_ch_param_set_size(union chan_param_mem *params,
                params->ip.wid2 = 7;            /* Blue bit width - 1 */
                params->ip.wid3 = 7;            /* Alpha bit width - 1 */
                break;
-       case IPU_PIX_FMT_ABGR32:
-               params->ip.bpp  = 0;
-               params->ip.pfs  = 4;
-               params->ip.npb  = 7;
-               params->ip.sat  = 2;            /* SAT = 32-bit access */
-               params->ip.ofs0 = 8;            /* Red bit offset */
-               params->ip.ofs1 = 16;           /* Green bit offset */
-               params->ip.ofs2 = 24;           /* Blue bit offset */
-               params->ip.ofs3 = 0;            /* Alpha bit offset */
-               params->ip.wid0 = 7;            /* Red bit width - 1 */
-               params->ip.wid1 = 7;            /* Green bit width - 1 */
-               params->ip.wid2 = 7;            /* Blue bit width - 1 */
-               params->ip.wid3 = 7;            /* Alpha bit width - 1 */
-               break;
        case IPU_PIX_FMT_UYVY:
                params->ip.bpp  = 2;
                params->ip.pfs  = 6;
@@ -1485,13 +1472,18 @@ static void idmac_issue_pending(struct dma_chan *chan)
         */
 }
 
-static void __idmac_terminate_all(struct dma_chan *chan)
+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 *idmac = to_idmac(chan->device);
        unsigned long flags;
        int i;
 
+       /* Only supports DMA_TERMINATE_ALL */
+       if (cmd != DMA_TERMINATE_ALL)
+               return -ENXIO;
+
        ipu_disable_channel(idmac, ichan,
                            ichan->status >= IPU_CHANNEL_ENABLED);
 
@@ -1518,17 +1510,23 @@ static void __idmac_terminate_all(struct dma_chan *chan)
        tasklet_enable(&to_ipu(idmac)->tasklet);
 
        ichan->status = IPU_CHANNEL_INITIALIZED;
+
+       return 0;
 }
 
-static void idmac_terminate_all(struct dma_chan *chan)
+static int idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
+                        unsigned long arg)
 {
        struct idmac_channel *ichan = to_idmac_chan(chan);
+       int ret;
 
        mutex_lock(&ichan->chan_mutex);
 
-       __idmac_terminate_all(chan);
+       ret = __idmac_control(chan, cmd, arg);
 
        mutex_unlock(&ichan->chan_mutex);
+
+       return ret;
 }
 
 #ifdef DEBUG
@@ -1620,7 +1618,7 @@ static void idmac_free_chan_resources(struct dma_chan *chan)
 
        mutex_lock(&ichan->chan_mutex);
 
-       __idmac_terminate_all(chan);
+       __idmac_control(chan, DMA_TERMINATE_ALL, 0);
 
        if (ichan->status > IPU_CHANNEL_FREE) {
 #ifdef DEBUG
@@ -1650,15 +1648,12 @@ static void idmac_free_chan_resources(struct dma_chan *chan)
        tasklet_schedule(&to_ipu(idmac)->tasklet);
 }
 
-static enum dma_status idmac_is_tx_complete(struct dma_chan *chan,
-               dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
+static enum dma_status idmac_tx_status(struct dma_chan *chan,
+                      dma_cookie_t cookie, struct dma_tx_state *txstate)
 {
        struct idmac_channel *ichan = to_idmac_chan(chan);
 
-       if (done)
-               *done = ichan->completed;
-       if (used)
-               *used = chan->cookie;
+       dma_set_tx_state(txstate, ichan->completed, chan->cookie, 0);
        if (cookie != chan->cookie)
                return DMA_ERROR;
        return DMA_SUCCESS;
@@ -1677,12 +1672,12 @@ static int __init ipu_idmac_init(struct ipu *ipu)
        dma->dev                                = ipu->dev;
        dma->device_alloc_chan_resources        = idmac_alloc_chan_resources;
        dma->device_free_chan_resources         = idmac_free_chan_resources;
-       dma->device_is_tx_complete              = idmac_is_tx_complete;
+       dma->device_tx_status                   = idmac_tx_status;
        dma->device_issue_pending               = idmac_issue_pending;
 
        /* Compulsory for DMA_SLAVE fields */
        dma->device_prep_slave_sg               = idmac_prep_slave_sg;
-       dma->device_terminate_all               = idmac_terminate_all;
+       dma->device_control                     = idmac_control;
 
        INIT_LIST_HEAD(&dma->channels);
        for (i = 0; i < IPU_CHANNELS_NUM; i++) {
@@ -1716,7 +1711,7 @@ static void __exit ipu_idmac_exit(struct ipu *ipu)
        for (i = 0; i < IPU_CHANNELS_NUM; i++) {
                struct idmac_channel *ichan = ipu->channel + i;
 
-               idmac_terminate_all(&ichan->dma_chan);
+               idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL, 0);
                idmac_prep_slave_sg(&ichan->dma_chan, NULL, 0, DMA_NONE, 0);
        }