public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: jacopo mondi <jacopo@jmondi.org>
To: Hugues Fruchet <hugues.fruchet@st.com>
Cc: Steve Longerbeam <slongerbeam@gmail.com>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>
Subject: Re: [PATCH v2 5/5] media: ov5640: fix restore of last mode set
Date: Sat, 25 Aug 2018 16:53:35 +0200	[thread overview]
Message-ID: <20180825145335.GL26480@w540> (raw)
In-Reply-To: <1534155586-26974-6-git-send-email-hugues.fruchet@st.com>

[-- Attachment #1: Type: text/plain, Size: 2154 bytes --]

Hi Hugues,
 one more comment on this patch..

On Mon, Aug 13, 2018 at 12:19:46PM +0200, Hugues Fruchet wrote:
> Mode setting depends on last mode set, in particular
> because of exposure calculation when downscale mode
> change between subsampling and scaling.
> At stream on the last mode was wrongly set to current mode,
> so no change was detected and exposure calculation
> was not made, fix this.
>
> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
> ---
>  drivers/media/i2c/ov5640.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index c110a6a..923cc30 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -225,6 +225,7 @@ struct ov5640_dev {
>  	struct v4l2_mbus_framefmt fmt;
>
>  	const struct ov5640_mode_info *current_mode;
> +	const struct ov5640_mode_info *last_mode;
>  	enum ov5640_frame_rate current_fr;
>  	struct v4l2_fract frame_interval;
>
> @@ -1628,6 +1629,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
>  	bool auto_exp =  sensor->ctrls.auto_exp->val == V4L2_EXPOSURE_AUTO;
>  	int ret;
>
> +	if (!orig_mode)
> +		orig_mode = mode;
> +

Am I wrong or with the introduction of last_mode we could drop the
'orig_mode' parameter (which has confused me already :/ ) from the
set_mode() function?

Just set here 'orig_mode = sensor->last_mode' and make sure last_mode
is intialized properly at probe time...

Or is there some other value in keeping the orig_mode parameter here?

Thanks
   j

>  	dn_mode = mode->dn_mode;
>  	orig_dn_mode = orig_mode->dn_mode;
>
> @@ -1688,6 +1692,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
>  		return ret;
>
>  	sensor->pending_mode_change = false;
> +	sensor->last_mode = mode;
>
>  	return 0;
>
> @@ -2551,7 +2556,8 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable)
>
>  	if (sensor->streaming == !enable) {
>  		if (enable && sensor->pending_mode_change) {
> -			ret = ov5640_set_mode(sensor, sensor->current_mode);
> +			ret = ov5640_set_mode(sensor, sensor->last_mode);
> +
>  			if (ret)
>  				goto out;
>
> --
> 2.7.4
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2018-08-25 18:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 10:19 [PATCH v2 0/5] Fix OV5640 exposure & gain Hugues Fruchet
2018-08-13 10:19 ` [PATCH v2 1/5] media: ov5640: fix exposure regression Hugues Fruchet
2018-09-06 13:31   ` Laurent Pinchart
2018-08-13 10:19 ` [PATCH v2 2/5] media: ov5640: fix auto gain & exposure when changing mode Hugues Fruchet
2018-08-13 10:19 ` [PATCH v2 3/5] media: ov5640: fix wrong binning value in exposure calculation Hugues Fruchet
2018-09-06 13:23   ` Laurent Pinchart
2018-08-13 10:19 ` [PATCH v2 4/5] media: ov5640: fix auto controls values when switching to manual mode Hugues Fruchet
2018-09-06 13:31   ` Laurent Pinchart
2018-09-10 10:23     ` Hugues FRUCHET
2018-09-10 10:46       ` Laurent Pinchart
2018-09-10 14:43         ` Hugues FRUCHET
2018-09-10 20:35           ` Laurent Pinchart
2018-08-13 10:19 ` [PATCH v2 5/5] media: ov5640: fix restore of last mode set Hugues Fruchet
2018-08-16 10:10   ` jacopo mondi
2018-08-16 15:07     ` Hugues FRUCHET
2018-08-16 19:53       ` jacopo mondi
2018-09-07 14:18       ` Laurent Pinchart
2018-09-10 15:14         ` Hugues FRUCHET
2018-09-10 20:56           ` Laurent Pinchart
2018-09-11  8:26             ` Hugues FRUCHET
2018-08-25 14:53   ` jacopo mondi [this message]
2018-09-11  7:32     ` Hugues FRUCHET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180825145335.GL26480@w540 \
    --to=jacopo@jmondi.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=hugues.fruchet@st.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox