]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00229962 Capture: ov5642/ov5640: update sensor params even if s_parm failed
authorSheng Nan <b38800@freescale.com>
Wed, 17 Oct 2012 06:55:10 +0000 (14:55 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:35 +0000 (08:35 +0200)
ioctl_s_parm for ov5642 and ov5640, it didn't check if sensor changed mode
successfully.
So it updates the sensor parameters with new framerate and new mode even
if the sensor failed to change mode.

The original framerate and mode is useful for the exposure calculation.
It should keep consistent with sensor actual work mode.

- This patch checks the return value of function which changes sensor mode
  If it succeed, update sensor parameters.

Signed-off-by: Sheng Nan <b38800@freescale.com>
drivers/media/video/mxc/capture/ov5640_mipi.c
drivers/media/video/mxc/capture/ov5642.c

index 44cdd466337eb75ea7214944e32a917de2e08377..bde39a51d36851f130100bfa0a345c849816a24e 100644 (file)
@@ -1494,12 +1494,15 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
                }
 
                orig_mode = sensor->streamcap.capturemode;
+               ret = ov5640_init_mode(frame_rate,
+                               (u32)a->parm.capture.capturemode, orig_mode);
+               if (ret < 0)
+                       return ret;
+
                sensor->streamcap.timeperframe = *timeperframe;
                sensor->streamcap.capturemode =
                                (u32)a->parm.capture.capturemode;
 
-               ret = ov5640_init_mode(frame_rate,
-                               sensor->streamcap.capturemode, orig_mode);
                break;
 
        /* These are all the possible cases. */
index 534d8ad38a165cb081f2d25c7eba81c46ea48114..426438276908d924f7006c49c4f9b127800ae54d 100644 (file)
@@ -3526,6 +3526,9 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
                ret = ov5642_change_mode(new_frame_rate, old_frame_rate,
                                a->parm.capture.capturemode,
                                sensor->streamcap.capturemode);
+               if (ret < 0)
+                       return ret;
+
                sensor->streamcap.timeperframe = *timeperframe;
                sensor->streamcap.capturemode =
                                (u32)a->parm.capture.capturemode;