Commit b0f4a7f7 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: imx: imx7-media-csi: Split imx7_csi_dma_stop()

The imx7_csi_dma_stop() function performs two operations, it waits for
DMA to be complete, and then cleans up and frees buffers. Split the
second part out to a new imx7_csi_dma_cleanup() function to match
imx7_csi_dma_setup(), in preparation for a stream start refactoring.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent be1158f0
......@@ -462,6 +462,12 @@ static int imx7_csi_dma_setup(struct imx7_csi *csi)
return 0;
}
static void imx7_csi_dma_cleanup(struct imx7_csi *csi)
{
imx7_csi_dma_unsetup_vb2_buf(csi, VB2_BUF_STATE_ERROR);
imx_media_free_dma_buf(csi->dev, &csi->underrun_buf);
}
static void imx7_csi_dma_stop(struct imx7_csi *csi)
{
unsigned long timeout_jiffies;
......@@ -483,10 +489,6 @@ static void imx7_csi_dma_stop(struct imx7_csi *csi)
v4l2_warn(&csi->sd, "wait last EOF timeout\n");
imx7_csi_hw_disable_irq(csi);
imx7_csi_dma_unsetup_vb2_buf(csi, VB2_BUF_STATE_ERROR);
imx_media_free_dma_buf(csi->dev, &csi->underrun_buf);
}
static void imx7_csi_configure(struct imx7_csi *csi)
......@@ -627,6 +629,7 @@ static int imx7_csi_streaming_start(struct imx7_csi *csi)
static int imx7_csi_streaming_stop(struct imx7_csi *csi)
{
imx7_csi_dma_stop(csi);
imx7_csi_dma_cleanup(csi);
imx7_csi_disable(csi);
......
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