public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Elder <paul.elder@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, kieran.bingham@ideasonboard.com,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: imx335: Set vblank immediately
Date: Wed, 26 Feb 2025 17:49:07 +0900	[thread overview]
Message-ID: <Z77Vg7zcnj_5a-0s@pyrite.rasen.tech> (raw)
In-Reply-To: <Z7G3d_zEhqDuepNM@kekkonen.localdomain>

Hi Sakari,

Thanks for the review.

On Sun, Feb 16, 2025 at 10:01:27AM +0000, Sakari Ailus wrote:
> Hi Paul,
> 
> On Fri, Feb 14, 2025 at 10:37:09PM +0900, Paul Elder wrote:
> > When the vblank v4l2 control is set, it does not get written to the
> > hardware immediately. It only gets updated when exposure is set. Change
> > the behavior such that the vblank is written immediately when the
> > control is set.
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > ---
> >  drivers/media/i2c/imx335.c | 19 +++++++++++++------
> >  1 file changed, 13 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c
> > index fcfd1d851bd4..e73a23bbbc89 100644
> > --- a/drivers/media/i2c/imx335.c
> > +++ b/drivers/media/i2c/imx335.c
> > @@ -559,12 +559,12 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl)
> >  			imx335->vblank,
> >  			imx335->vblank + imx335->cur_mode->height);
> >  
> > -		return __v4l2_ctrl_modify_range(imx335->exp_ctrl,
> > -						IMX335_EXPOSURE_MIN,
> > -						imx335->vblank +
> > -						imx335->cur_mode->height -
> > -						IMX335_EXPOSURE_OFFSET,
> > -						1, IMX335_EXPOSURE_DEFAULT);
> > +		 __v4l2_ctrl_modify_range(imx335->exp_ctrl,
> 
> Indentation.
> 
> You're also missing an error check here.

I reasoned that it's fine to not have the error check.

afaiu, the only change this has to error is if try/s_ctrl on
V4L2_CID_EXPOSURE fails when the change to the range of valid exposure
values requires a new exposure value to be set. Setting the exposure
control comes back to this function, and goes through the switch-case
and imx335_update_exp_gain() below, which doesn't fail.

Also the imx219 has the exact same pattern in imx219_set_ctrl.


Thanks,

Paul

> > +					  IMX335_EXPOSURE_MIN,
> > +					  imx335->vblank +
> > +					  imx335->cur_mode->height -
> > +					  IMX335_EXPOSURE_OFFSET,
> > +					  1, IMX335_EXPOSURE_DEFAULT);
> >  	}
> >  
> >  	/*
> > @@ -575,6 +575,13 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl)
> >  		return 0;
> >  
> >  	switch (ctrl->id) {
> > +	case V4L2_CID_VBLANK:
> > +		exposure = imx335->exp_ctrl->val;
> > +		analog_gain = imx335->again_ctrl->val;
> > +
> > +		ret = imx335_update_exp_gain(imx335, exposure, analog_gain);
> > +
> > +		break;
> >  	case V4L2_CID_EXPOSURE:
> >  		exposure = ctrl->val;
> >  		analog_gain = imx335->again_ctrl->val;

  reply	other threads:[~2025-02-26  8:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 13:37 [PATCH] media: imx335: Set vblank immediately Paul Elder
2025-02-14 14:44 ` nicolas
2025-02-15 10:20   ` Kieran Bingham
2025-02-16 10:01 ` Sakari Ailus
2025-02-26  8:49   ` Paul Elder [this message]
2025-02-26  8:56     ` Sakari Ailus
2025-02-28  9:20       ` Paul Elder

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=Z77Vg7zcnj_5a-0s@pyrite.rasen.tech \
    --to=paul.elder@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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