Merge branch 'coh' into dmaengine
[firefly-linux-kernel-4.4.55.git] / drivers / dma / ipu / ipu_idmac.c
index 9a5bc1a7389e61abc82e78aee287934f13c2eef7..2a446397c8847aa836c203d6586b672cf3b3024f 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;
@@ -761,12 +748,10 @@ static void ipu_select_buffer(enum ipu_channel channel, int buffer_n)
  * @buffer_n:  buffer number to update.
  *             0 or 1 are the only valid values.
  * @phyaddr:   buffer physical address.
- * @return:    Returns 0 on success or negative error code on failure. This
- *              function will fail if the buffer is set to ready.
  */
 /* Called under spin_lock(_irqsave)(&ichan->lock) */
-static int ipu_update_channel_buffer(struct idmac_channel *ichan,
-                                    int buffer_n, dma_addr_t phyaddr)
+static void ipu_update_channel_buffer(struct idmac_channel *ichan,
+                                     int buffer_n, dma_addr_t phyaddr)
 {
        enum ipu_channel channel = ichan->dma_chan.chan_id;
        uint32_t reg;
@@ -806,8 +791,6 @@ static int ipu_update_channel_buffer(struct idmac_channel *ichan,
        }
 
        spin_unlock_irqrestore(&ipu_data.lock, flags);
-
-       return 0;
 }
 
 /* Called under spin_lock_irqsave(&ichan->lock) */
@@ -816,7 +799,6 @@ static int ipu_submit_buffer(struct idmac_channel *ichan,
 {
        unsigned int chan_id = ichan->dma_chan.chan_id;
        struct device *dev = &ichan->dma_chan.dev->device;
-       int ret;
 
        if (async_tx_test_ack(&desc->txd))
                return -EINTR;
@@ -827,14 +809,7 @@ static int ipu_submit_buffer(struct idmac_channel *ichan,
         * could make it conditional on status >= IPU_CHANNEL_ENABLED, but
         * doing it again shouldn't hurt either.
         */
-       ret = ipu_update_channel_buffer(ichan, buf_idx,
-                                       sg_dma_address(sg));
-
-       if (ret < 0) {
-               dev_err(dev, "Updating sg %p on channel 0x%x buffer %d failed!\n",
-                       sg, chan_id, buf_idx);
-               return ret;
-       }
+       ipu_update_channel_buffer(ichan, buf_idx, sg_dma_address(sg));
 
        ipu_select_buffer(chan_id, buf_idx);
        dev_dbg(dev, "Updated sg %p on channel 0x%x buffer %d\n",
@@ -1379,10 +1354,11 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 
        if (likely(sgnew) &&
            ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
-               callback = desc->txd.callback;
-               callback_param = desc->txd.callback_param;
+               callback = descnew->txd.callback;
+               callback_param = descnew->txd.callback_param;
                spin_unlock(&ichan->lock);
-               callback(callback_param);
+               if (callback)
+                       callback(callback_param);
                spin_lock(&ichan->lock);
        }