Re: [PATCH 03/12] media: ov5640: Don't force the auto exposure state at start time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 02, 2018 at 03:34:51PM +0100, Maxime Ripard wrote:
> 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: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
> ---
>  drivers/media/i2c/ov5640.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index e6a23eb55c1d..0d8f979416cc 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -1579,7 +1579,9 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor,
>  	ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1);
>  	if (ret)
>  		return ret;
> -	return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_AUTO);
> +
> +	return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp,
> +				  sensor->ctrls.auto_exp->val);
>  }
>  
>  static int ov5640_set_mode(struct ov5640_dev *sensor,
> @@ -1596,7 +1598,8 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
>  	ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0);
>  	if (ret)
>  		return ret;
> -	ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_MANUAL);
> +
> +	ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL);
>  	if (ret)
>  		return ret;
>  

The s_ctrl callback won't be called if the control framework still has the
same value set. I think you could store the value manually, and retain
__v4l2_ctrl_s_ctrl() call in ov5640_set_mode().

-- 
Sakari Ailus
e-mail: sakari.ailus@xxxxxx



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux