From 0ac4c7def5452119d2a6e1b5f3dfb9f94d20a7f5 Mon Sep 17 00:00:00 2001 From: Wooyeon Kim Date: Mon, 25 Mar 2019 14:28:14 +0900 Subject: [PATCH] [COMMON] fimc-is2: set VC Buf to NDONE when s_buffer is failed PR JIRA ID: CPR-866 CRs-fixed: (CR) Change-Id: I81226123bf00b608fd3eaf8d0652ef37b16e6c6c Signed-off-by: Wooyeon Kim Reviewed-on: https://gerrit.mot.com/1329486 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Dawei Wang Reviewed-by: Zhichao Chen Submit-Approved: Jira Key --- .../exynos/fimc-is2/fimc-is-device-csi_v4.c | 16 ++++++++++++++++ .../exynos/fimc-is2/fimc-is-device-sensor_v2.c | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c index 1b789c7096c4..16c79633a0db 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c @@ -264,6 +264,7 @@ static void csis_disable_all_vc_dma_buf(struct fimc_is_device_csi *csi) u32 vc; int cur_dma_enable; struct fimc_is_framemgr *framemgr; + struct fimc_is_frame *frame; struct fimc_is_subdev *dma_subdev; unsigned long flags; @@ -286,6 +287,18 @@ static void csis_disable_all_vc_dma_buf(struct fimc_is_device_csi *csi) framemgr = GET_SUBDEV_FRAMEMGR(dma_subdev); framemgr_e_barrier_irqs(framemgr, 0, flags); if (likely(framemgr)) { + /* process to NDONE if set to bad frame */ + if (framemgr->queued_count[FS_PROCESS]) { + frame = peek_frame(framemgr, FS_PROCESS); + + if (frame->result) { + mserr("[F%d] NDONE(%d, E%X)\n", dma_subdev, dma_subdev, + frame->fcount, frame->index, frame->result); + trans_frame(framemgr, frame, FS_COMPLETE); + CALL_VOPS(dma_subdev->vctx, done, frame->index, VB2_BUF_STATE_ERROR); + } + } + /* * W/A: DMA should be on forcely at invalid frame state. * The invalid state indicates that there is process frame at DMA off. @@ -1865,6 +1878,9 @@ static int csi_s_buffer(struct v4l2_subdev *subdev, void *buf, unsigned int *siz if (csi_hw_g_output_dma_enable(csi->vc_reg[csi->scm][vc], vc)) { err("[VC%d][F%d] already DMA enabled!!", vc, frame->fcount); ret = -EINVAL; + + frame->result = IS_SHOT_BAD_FRAME; + trans_frame(framemgr, frame, FS_PROCESS); } else { csi_s_buf_addr(csi, frame, 0, vc); csi_s_output_dma(csi, vc, true); diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-sensor_v2.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-sensor_v2.c index ae39d9abbcfa..e9676fbd1013 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-sensor_v2.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-sensor_v2.c @@ -969,6 +969,7 @@ int fimc_is_sensor_buf_tag(struct fimc_is_device_sensor *device, frame->fcount = ldr_frame->fcount; frame->stream->findex = ldr_frame->index; frame->stream->fcount = ldr_frame->fcount; + frame->result = 0; ret = v4l2_subdev_call(v_subdev, video, s_rx_buffer, (void *)frame, NULL); if (ret) { -- 2.20.1