Commit bf4a4b51 authored by Maxime Ripard's avatar Maxime Ripard Committed by Mauro Carvalho Chehab

media: ov5640: Don't force the auto exposure state at start time

The sensor needs to have the auto exposure stopped while changing mode.
However, when the new mode is set, the driver will force the auto exposure
on, disregarding whether the control has been changed or not.

Bypass the controls code entirely to do that, and only use the control
value cached when restoring the auto exposure mode.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 1068feca
...@@ -1569,7 +1569,8 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, ...@@ -1569,7 +1569,8 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor,
* change mode directly * change mode directly
*/ */
static int ov5640_set_mode_direct(struct ov5640_dev *sensor, static int ov5640_set_mode_direct(struct ov5640_dev *sensor,
const struct ov5640_mode_info *mode) const struct ov5640_mode_info *mode,
s32 exposure)
{ {
int ret; int ret;
...@@ -1585,7 +1586,8 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, ...@@ -1585,7 +1586,8 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor,
ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1); ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1);
if (ret) if (ret)
return ret; return ret;
return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_AUTO);
return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure);
} }
static int ov5640_set_mode(struct ov5640_dev *sensor, static int ov5640_set_mode(struct ov5640_dev *sensor,
...@@ -1593,6 +1595,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, ...@@ -1593,6 +1595,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
{ {
const struct ov5640_mode_info *mode = sensor->current_mode; const struct ov5640_mode_info *mode = sensor->current_mode;
enum ov5640_downsize_mode dn_mode, orig_dn_mode; enum ov5640_downsize_mode dn_mode, orig_dn_mode;
s32 exposure;
int ret; int ret;
dn_mode = mode->dn_mode; dn_mode = mode->dn_mode;
...@@ -1602,7 +1605,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, ...@@ -1602,7 +1605,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0); ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0);
if (ret) if (ret)
return ret; return ret;
ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_MANUAL);
exposure = sensor->ctrls.auto_exp->val;
ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL);
if (ret) if (ret)
return ret; return ret;
...@@ -1618,7 +1623,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, ...@@ -1618,7 +1623,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
* change inside subsampling or scaling * change inside subsampling or scaling
* download firmware directly * download firmware directly
*/ */
ret = ov5640_set_mode_direct(sensor, mode); ret = ov5640_set_mode_direct(sensor, mode, exposure);
} }
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment