diff options
author | Hugues Fruchet <hugues.fruchet@st.com> | 2018-09-11 09:48:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-17 15:24:34 -0400 |
commit | dc29a1c187eedc1d498cb567c44bbbc832b009cb (patch) | |
tree | eb17e3635763338b9e5b4e194c0ffa37744c3378 /drivers/media/i2c | |
parent | bad1774ed41e98a43074e50e7d5ac9e1e848d99a (diff) | |
download | linux-stable-dc29a1c187eedc1d498cb567c44bbbc832b009cb.tar.gz linux-stable-dc29a1c187eedc1d498cb567c44bbbc832b009cb.tar.bz2 linux-stable-dc29a1c187eedc1d498cb567c44bbbc832b009cb.zip |
media: ov5640: fix exposure regression
Symptom was black image when capturing HD or 5Mp picture
due to manual exposure set to 1 while it was intended to
set autoexposure to "manual", fix this.
Fixes: bf4a4b518c20 ("media: ov5640: Don't force the auto exposure state at start time").
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/ov5640.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 69c813b1e4fa..534264849b58 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -959,6 +959,12 @@ static int ov5640_load_regs(struct ov5640_dev *sensor, return ov5640_set_timings(sensor, mode); } +static int ov5640_set_autoexposure(struct ov5640_dev *sensor, bool on) +{ + return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, + BIT(0), on ? 0 : BIT(0)); +} + /* read exposure, in number of line periods */ static int ov5640_get_exposure(struct ov5640_dev *sensor) { @@ -1603,7 +1609,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, */ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, const struct ov5640_mode_info *mode, - s32 exposure) + bool auto_exp) { int ret; @@ -1620,7 +1626,8 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, if (ret) return ret; - return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); + return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, auto_exp ? + V4L2_EXPOSURE_AUTO : V4L2_EXPOSURE_MANUAL); } static int ov5640_set_mode(struct ov5640_dev *sensor, @@ -1628,7 +1635,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, { const struct ov5640_mode_info *mode = sensor->current_mode; enum ov5640_downsize_mode dn_mode, orig_dn_mode; - s32 exposure; + bool auto_exp = sensor->ctrls.auto_exp->val == V4L2_EXPOSURE_AUTO; int ret; dn_mode = mode->dn_mode; @@ -1639,8 +1646,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, if (ret) return ret; - exposure = sensor->ctrls.auto_exp->val; - ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL); + ret = ov5640_set_autoexposure(sensor, false); if (ret) return ret; @@ -1656,7 +1662,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, * change inside subsampling or scaling * download firmware directly */ - ret = ov5640_set_mode_direct(sensor, mode, exposure); + ret = ov5640_set_mode_direct(sensor, mode, auto_exp); } if (ret < 0) |