media: rp1: cfe: Fix error paths in cfe_start_streaming
[platform/kernel/linux-rpi.git] / drivers / dma / fsl-edma-main.c
index 8c4ed70..30df55d 100644 (file)
@@ -26,6 +26,8 @@
 #define ARGS_RX                         BIT(0)
 #define ARGS_REMOTE                     BIT(1)
 #define ARGS_MULTI_FIFO                 BIT(2)
+#define ARGS_EVEN_CH                    BIT(3)
+#define ARGS_ODD_CH                     BIT(4)
 
 static void fsl_edma_synchronize(struct dma_chan *chan)
 {
@@ -159,6 +161,12 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
                fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE;
                fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO;
 
+               if ((dma_spec->args[2] & ARGS_EVEN_CH) && (i & 0x1))
+                       continue;
+
+               if ((dma_spec->args[2] & ARGS_ODD_CH) && !(i & 0x1))
+                       continue;
+
                if (!b_chmux && i == dma_spec->args[0]) {
                        chan = dma_get_slave_channel(chan);
                        chan->device->privatecnt++;
@@ -400,9 +408,8 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng
                link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
                                             DL_FLAG_PM_RUNTIME |
                                             DL_FLAG_RPM_ACTIVE);
-               if (IS_ERR(link)) {
-                       dev_err(dev, "Failed to add device_link to %d: %ld\n", i,
-                               PTR_ERR(link));
+               if (!link) {
+                       dev_err(dev, "Failed to add device_link to %d\n", i);
                        return -EINVAL;
                }
 
@@ -640,6 +647,8 @@ static int fsl_edma_suspend_late(struct device *dev)
 
        for (i = 0; i < fsl_edma->n_chans; i++) {
                fsl_chan = &fsl_edma->chans[i];
+               if (fsl_edma->chan_masked & BIT(i))
+                       continue;
                spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
                /* Make sure chan is idle or will force disable. */
                if (unlikely(!fsl_chan->idle)) {
@@ -664,13 +673,16 @@ static int fsl_edma_resume_early(struct device *dev)
 
        for (i = 0; i < fsl_edma->n_chans; i++) {
                fsl_chan = &fsl_edma->chans[i];
+               if (fsl_edma->chan_masked & BIT(i))
+                       continue;
                fsl_chan->pm_state = RUNNING;
                edma_write_tcdreg(fsl_chan, 0, csr);
                if (fsl_chan->slave_id != 0)
                        fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
        }
 
-       edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
+       if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG))
+               edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
 
        return 0;
 }