Linux Media Controller development
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Hugues FRUCHET <hugues.fruchet@st.com>
Subject: Re: [PATCH] vivid: fix gain when autogain is on
Date: Wed, 4 Jul 2018 09:16:11 -0300	[thread overview]
Message-ID: <20180704091506.0a85686c@coco.lan> (raw)
In-Reply-To: <b7ae30af-dcaa-f8ef-4171-e73cb0107884@xs4all.nl>

Em Fri, 29 Jun 2018 11:40:41 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> In the vivid driver you want gain to continuous change while autogain
> is on. However, dev->jiffies_vid_cap doesn't actually change. It probably
> did in the past, but changes in the code caused this to be a fixed value
> that is only set when you start streaming.
> 
> Replace it by jiffies, which is always changing.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c
> index 6b0bfa091592..6eb8ad7fb12c 100644
> --- a/drivers/media/platform/vivid/vivid-ctrls.c
> +++ b/drivers/media/platform/vivid/vivid-ctrls.c
> @@ -295,7 +295,7 @@ static int vivid_user_vid_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
> 
>  	switch (ctrl->id) {
>  	case V4L2_CID_AUTOGAIN:
> -		dev->gain->val = dev->jiffies_vid_cap & 0xff;
> +		dev->gain->val = (jiffies / HZ) & 0xff;

Manipulating jiffies directly like the above is not a good idea.

Better to use, instead:

	dev->gain->val = (jiffies_to_msecs(jiffies) / 1000) & 0xff;

I'll change the code when applying the patch.


Thanks,
Mauro

  reply	other threads:[~2018-07-04 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  9:40 [PATCH] vivid: fix gain when autogain is on Hans Verkuil
2018-07-04 12:16 ` Mauro Carvalho Chehab [this message]
2018-07-04 12:31   ` Hans Verkuil

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=20180704091506.0a85686c@coco.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=hugues.fruchet@st.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /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