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>
}
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. */
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;