[COMMON] fimc-is2: set VC Buf to NDONE when s_buffer is failed
authorWooyeon Kim <wooy88.kim@samsung.com>
Mon, 25 Mar 2019 05:28:14 +0000 (14:28 +0900)
committerlingsen1 <lingsen1@lenovo.com>
Mon, 10 Jun 2019 03:24:54 +0000 (11:24 +0800)
 PR JIRA ID: CPR-866

CRs-fixed: (CR)

Change-Id: I81226123bf00b608fd3eaf8d0652ef37b16e6c6c
Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
Reviewed-on: https://gerrit.mot.com/1329486
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dawei Wang <wangdw10@motorola.com>
Reviewed-by: Zhichao Chen <chenzc2@motorola.com>
Submit-Approved: Jira Key

drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c
drivers/media/platform/exynos/fimc-is2/fimc-is-device-sensor_v2.c

index 1b789c7096c41924ad41b0cdc5f608bb905dd587..16c79633a0db04085292253296dde7ee661062db 100644 (file)
@@ -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);
index ae39d9abbcfa99754b630f5228e72570b6769814..e9676fbd1013396820bf15369e0a581ccc3aa2e2 100644 (file)
@@ -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) {