linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: linux-media@vger.kernel.org
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [PATCH v2 2/3] mt9v022: fix the V4L2_CID_EXPOSURE control
Date: Fri, 28 Sep 2012 00:04:34 +0200	[thread overview]
Message-ID: <1348783474-22965-1-git-send-email-agust@denx.de> (raw)
In-Reply-To: <1345799431-29426-3-git-send-email-agust@denx.de>

Since the MT9V022_TOTAL_SHUTTER_WIDTH register is controlled in manual
mode by V4L2_CID_EXPOSURE control, it shouldn't be written directly in
mt9v022_s_crop(). In manual mode this register should be set to the
V4L2_CID_EXPOSURE control value. Changing this register directly and
outside of the actual control function means that the register value
is not in sync with the corresponding control value. Thus, the following
problem is observed:

    - setting this control initially succeeds
    - VIDIOC_S_CROP ioctl() overwrites the MT9V022_TOTAL_SHUTTER_WIDTH
      register
    - setting this control to the same value again doesn't
      result in setting the register since the control value
      was previously cached and doesn't differ

Remove MT9V022_TOTAL_SHUTTER_WIDTH register setting in mt9v022_s_crop()
and add a comment explaining why it is not needed in manual mode.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes since first version:
 - remove setting total shutter width register in mt9v022_s_crop()
   if in manual exposure mode and add a comment explaining why it is
   not needed
 - revise commit log
 - rebase on staging/for_v3.7 branch

 drivers/media/i2c/soc_camera/mt9v022.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
index 3cb23c6..e0f4cb4 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -272,9 +272,14 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
 		if (ret & 1) /* Autoexposure */
 			ret = reg_write(client, mt9v022->reg->max_total_shutter_width,
 					rect.height + mt9v022->y_skip_top + 43);
-		else
-			ret = reg_write(client, MT9V022_TOTAL_SHUTTER_WIDTH,
-					rect.height + mt9v022->y_skip_top + 43);
+		/*
+		 * If autoexposure is off, there is no need to set
+		 * MT9V022_TOTAL_SHUTTER_WIDTH here. Autoexposure can be off
+		 * only if the user has set exposure manually, using the
+		 * V4L2_CID_EXPOSURE_AUTO with the value V4L2_EXPOSURE_MANUAL.
+		 * In this case the register MT9V022_TOTAL_SHUTTER_WIDTH
+		 * already contains the correct value.
+		 */
 	}
 	/* Setup frame format: defaults apart from width and height */
 	if (!ret)
-- 
1.7.1


  parent reply	other threads:[~2012-09-27 22:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  9:10 [PATCH 0/3] various updates for mt9v022 driver Anatolij Gustschin
2012-08-24  9:10 ` [PATCH 1/3] mt9v022: add v4l2 controls for blanking and other register settings Anatolij Gustschin
2012-08-24 11:08   ` Guennadi Liakhovetski
2012-08-24 13:04     ` Detlev Zundel
2012-08-24 13:35       ` Guennadi Liakhovetski
2012-08-24 15:44         ` Detlev Zundel
2012-08-24 16:21         ` Anatolij Gustschin
2012-08-24 21:23           ` Guennadi Liakhovetski
2012-08-28 13:43             ` Anatolij Gustschin
2012-09-11  8:24               ` Guennadi Liakhovetski
2012-09-27 21:10                 ` Anatolij Gustschin
2012-08-24 13:28     ` Anatolij Gustschin
2012-09-27 22:03   ` [PATCH v2 1/3] mt9v022: add v4l2 controls for blanking Anatolij Gustschin
2012-10-06 11:00     ` Anatolij Gustschin
2012-10-09 10:32       ` Guennadi Liakhovetski
2012-08-24  9:10 ` [PATCH 2/3] mt9v022: fix the V4L2_CID_EXPOSURE control Anatolij Gustschin
2012-08-24 11:22   ` Guennadi Liakhovetski
2012-08-24 14:17     ` Anatolij Gustschin
2012-08-24 14:32       ` Guennadi Liakhovetski
2012-09-21  9:30         ` Anatolij Gustschin
2012-09-27 22:04   ` Anatolij Gustschin [this message]
2012-08-24  9:10 ` [PATCH 3/3] mt9v022: set y_skip_top field to zero Anatolij Gustschin
2012-08-24 11:23   ` Guennadi Liakhovetski
2012-08-24 13:34     ` Anatolij Gustschin
2012-09-11  8:55       ` Guennadi Liakhovetski
2012-09-21  9:28         ` Anatolij Gustschin
2012-09-27 22:05   ` [PATCH v2 3/3] mt9v022: set y_skip_top field to zero as default Anatolij Gustschin
     [not found]     ` <Pine.LNX.4.64.1209281413220.5428@axis700.grange>
     [not found]       ` <Pine.LNX.4.64.1209281420420.5428@axis700.grange>
2012-09-29  2:21         ` Eric Miao

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=1348783474-22965-1-git-send-email-agust@denx.de \
    --to=agust@denx.de \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.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;
as well as URLs for NNTP newsgroup(s).