From ba9f8a79e969978ba06c058fb1d9484c01daab94 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 3 Apr 2019 13:01:59 -0700 Subject: [PATCH] v4l: xilinx: scd: Don't mark channel as disabled in .s_stream(0) Commit 2e77607047c6 ("xilinx: v4l2: dma: Add multiple output support") incorrectly calls .s_stream(0) on all channels when one of them gets disabled, causing all the other channels to hang. Work around this by not disabling the channel in .s_stream(0). The channel will be disabled in xscd_dma_terminate_all() which should be safe as long as dmaengine_terminate_all() is called after xvip_pipeline_set_stream(). Signed-off-by: Laurent Pinchart Reviewed-by: Hyun Kwon --- .../platform/xilinx/xilinx-scenechange-dma.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-scenechange-dma.c b/drivers/media/platform/xilinx/xilinx-scenechange-dma.c index c7f173cf5b05..58437a769605 100644 --- a/drivers/media/platform/xilinx/xilinx-scenechange-dma.c +++ b/drivers/media/platform/xilinx/xilinx-scenechange-dma.c @@ -146,9 +146,21 @@ void xscd_dma_enable_channel(struct xscd_dma_chan *chan, bool enable) { struct xscd_device *xscd = chan->xscd; - spin_lock_irq(&chan->lock); - chan->enabled = enable; - spin_unlock_irq(&chan->lock); + if (enable) { + /* + * FIXME: Don't set chan->enabled to false here, it will be + * done in xscd_dma_terminate_all(). This works around a bug + * introduced in commit 2e77607047c6 ("xilinx: v4l2: dma: Add + * multiple output support") that stops all channels when the + * first one is stopped, even though they are part of + * independent pipelines. This workaround should be safe as + * long as dmaengine_terminate_all() is called after + * xvip_pipeline_set_stream(). + */ + spin_lock_irq(&chan->lock); + chan->enabled = true; + spin_unlock_irq(&chan->lock); + } if (xscd->memory_based) { if (enable) { -- 2.39.2