Improve V4L2_CID_IS_FORCE_DONE control handling 42/166742/2
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Thu, 11 Jan 2018 12:28:38 +0000 (13:28 +0100)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Fri, 12 Jan 2018 10:16:43 +0000 (11:16 +0100)
V4L2_CID_IS_FORCE_DONE control is now set before stream off for both
front and rear camera (3AA0 and 3AA1).

A hard coded control ID is replaced with local constant, this should
likely be corrected further by properly using control definitions from
the include/uapi/linux/videodev2_exynos_camera.h kernel header.

Change-Id: Ifba693e609a12c6625dc40fc66568a2299793d69
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
camerasrc/src/camerasrc.c

index c785a1e57ea03e9b5f1a3cbd26f7fde15a9ff35f..0dc43c94e84f47a67d6256758de0cf5edfe17f41 100644 (file)
 /* Extended CID */
 #ifndef V4L2_CID_FIMC_IS_BASE
 #define V4L2_CID_FIMC_IS_BASE                  (V4L2_CTRL_CLASS_CAMERA | 0x1000)
-#endif /* V4L2_CID_FIMC_IS_BASE */
+#endif
+#ifndef V4L2_CID_IS_S_STREAM
+#define V4L2_CID_IS_S_STREAM                   (V4L2_CID_FIMC_IS_BASE + 14)
+#endif
+#ifndef V4L2_CID_IS_FORCE_DONE
+#define V4L2_CID_IS_FORCE_DONE                 (V4L2_CID_FIMC_IS_BASE + 50)
+#endif
 #ifndef V4L2_CID_IS_SET_SETFILE
 #define V4L2_CID_IS_SET_SETFILE                        (V4L2_CID_FIMC_IS_BASE + 51)
-#endif /* V4L2_CID_IS_SET_SETFILE */
+#endif
 #ifndef V4L2_CID_IS_COLOR_RANGE
 #define V4L2_CID_IS_COLOR_RANGE                        (V4L2_CID_FIMC_IS_BASE + 54)
-#endif /* V4L2_CID_IS_COLOR_RANGE */
+#endif
 #ifndef V4L2_CID_IS_MIN_TARGET_FPS
 #define V4L2_CID_IS_MIN_TARGET_FPS             (V4L2_CID_FIMC_IS_BASE + 55)
-#endif /* V4L2_CID_IS_MIN_TARGET_FPS */
+#endif
 #ifndef V4L2_CID_IS_MAX_TARGET_FPS
 #define V4L2_CID_IS_MAX_TARGET_FPS             (V4L2_CID_FIMC_IS_BASE + 56)
-#endif /* V4L2_CID_IS_MAX_TARGET_FPS */
-#ifndef V4L2_CID_IS_S_STREAM
-#define V4L2_CID_IS_S_STREAM                   (V4L2_CID_FIMC_IS_BASE + 14)
-#endif /* V4L2_CID_IS_S_STREAM */
+#endif
 
 /* FIMC IS NUM */
 #define FIMC_IS_VIDEO_3A0_NUM  10
@@ -3122,24 +3125,12 @@ int camerasrc_stop_stream(camsrc_handle_t handle)
                camsrc_info("[SENSOR] REQBUF 0 done");
        }
 
-
-       if (p->cur_dev_id == CAMERASRC_DEV_ID_PRIMARY) {
-               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_3aa0, 0x9a1032, 4096);
-               if (ret != CAMERASRC_SUCCESS)
-                       camsrc_error("[3AA0] _camerasrc_ioctl_s_ctrl failed[%x]", ret);
-
-               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_3aa0, 0x9a1032, 4096);
+       /* 3AA0 - OUTPUT */
+       if (p->streamon_3aa0_output) {
+               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_3aa0, V4L2_CID_IS_FORCE_DONE, 0x1000);
                if (ret != CAMERASRC_SUCCESS)
                        camsrc_error("[3AA0] _camerasrc_ioctl_s_ctrl failed[%x]", ret);
 
-               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_isp, 0x9a1032, 4096);
-               if (ret != CAMERASRC_SUCCESS)
-                       camsrc_error("[ISP] _camerasrc_ioctl_s_ctrl failed[%x]", ret);
-       }
-
-
-       /* 3AA0 - OUTPUT */
-       if (p->streamon_3aa0_output) {
                ret = _camerasrc_ioctl_stream(p, p->fd_3aa0, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, FALSE);
                if (ret != CAMERASRC_SUCCESS) {
                        strerror_r(p->errnum, err_msg, CAMERASRC_ERRMSG_MAX_LEN);
@@ -3193,6 +3184,10 @@ int camerasrc_stop_stream(camsrc_handle_t handle)
        }
 
        if (p->streamon_3aa1_output) {
+               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_3aa1, V4L2_CID_IS_FORCE_DONE, 0x1000);
+               if (ret != CAMERASRC_SUCCESS)
+                       camsrc_error("[3AA1] _camerasrc_ioctl_s_ctrl failed[%x]", ret);
+
                ret = _camerasrc_ioctl_stream(p, p->fd_3aa1, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, FALSE);
                if (ret != CAMERASRC_SUCCESS) {
                        strerror_r(p->errnum, err_msg, CAMERASRC_ERRMSG_MAX_LEN);
@@ -3219,6 +3214,10 @@ int camerasrc_stop_stream(camsrc_handle_t handle)
        }
 
        if (p->streamon_isp) {
+               ret = _camerasrc_ioctl_s_ctrl(p, p->fd_isp, V4L2_CID_IS_FORCE_DONE, 0x1000);
+               if (ret != CAMERASRC_SUCCESS)
+                       camsrc_error("[ISP] _camerasrc_ioctl_s_ctrl failed[%x]", ret);
+
                ret = _camerasrc_ioctl_stream(p, p->fd_isp, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, FALSE);
                if (ret != CAMERASRC_SUCCESS) {
                        strerror_r(p->errnum, err_msg, CAMERASRC_ERRMSG_MAX_LEN);