Message ID | 1345799431-29426-3-git-send-email-agust@denx.de (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1T4puj-00010y-RT for patchwork@linuxtv.org; Fri, 24 Aug 2012 11:10:49 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for <patchwork@linuxtv.org> id 1T4puj-0003nA-E9; Fri, 24 Aug 2012 11:10:49 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932590Ab2HXJKp (ORCPT <rfc822;patchwork@linuxtv.org>); Fri, 24 Aug 2012 05:10:45 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:51897 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757906Ab2HXJKi (ORCPT <rfc822;linux-media@vger.kernel.org>); Fri, 24 Aug 2012 05:10:38 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3X3GtJ60Zqz3hhvG; Fri, 24 Aug 2012 11:10:32 +0200 (CEST) X-Auth-Info: qcEJUk9DchggeMV5wF4iInb292zjimwKYp9BhOEEJk0= Received: from localhost (p4FC461F2.dip.t-dialin.net [79.196.97.242]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3X3GtJ4jm0zbbg6; Fri, 24 Aug 2012 11:10:32 +0200 (CEST) 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>, dzu@denx.de Subject: [PATCH 2/3] mt9v022: fix the V4L2_CID_EXPOSURE control Date: Fri, 24 Aug 2012 11:10:30 +0200 Message-Id: <1345799431-29426-3-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1345799431-29426-1-git-send-email-agust@denx.de> References: <1345799431-29426-1-git-send-email-agust@denx.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.8.24.90018 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1900_1999 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Anatolij Gustschin
Aug. 24, 2012, 9:10 a.m. UTC
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
Fix it by always setting the register to the controlled value, when
in manual mode.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/media/i2c/soc_camera/mt9v022.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Fri, 24 Aug 2012, Anatolij Gustschin wrote: > 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 > > Fix it by always setting the register to the controlled value, when > in manual mode. > > Signed-off-by: Anatolij Gustschin <agust@denx.de> > --- > drivers/media/i2c/soc_camera/mt9v022.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c > index d13c8c4..d26c071 100644 > --- a/drivers/media/i2c/soc_camera/mt9v022.c > +++ b/drivers/media/i2c/soc_camera/mt9v022.c > @@ -274,9 +274,9 @@ 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); > + else /* Set to the manually controlled value */ > + ret = v4l2_ctrl_s_ctrl(mt9v022->exposure, > + mt9v022->exposure->val); But why do we have to write it here at all then? Autoexposure can be off only if the user has set exposure manually, using V4L2_CID_EXPOSURE_AUTO. In this case MT9V022_TOTAL_SHUTTER_WIDTH already contains the correct value. Why do we have to set it again? Maybe just adding a comment, explaining the above, would suffice? > } > /* Setup frame format: defaults apart from width and height */ > if (!ret) > -- > 1.7.1 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Guennadi, On Fri, 24 Aug 2012 13:22:18 +0200 (CEST) Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote: ... > > --- a/drivers/media/i2c/soc_camera/mt9v022.c > > +++ b/drivers/media/i2c/soc_camera/mt9v022.c > > @@ -274,9 +274,9 @@ 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); > > + else /* Set to the manually controlled value */ > > + ret = v4l2_ctrl_s_ctrl(mt9v022->exposure, > > + mt9v022->exposure->val); > > But why do we have to write it here at all then? Autoexposure can be off > only if the user has set exposure manually, using V4L2_CID_EXPOSURE_AUTO. > In this case MT9V022_TOTAL_SHUTTER_WIDTH already contains the correct > value. Why do we have to set it again? Maybe just adding a comment, > explaining the above, would suffice? Actually we do not have to write it here, yes. Should I remove the shutter register setting here entirely? And add a comment explaining, why? Thanks, Anatolij -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 24 Aug 2012, Anatolij Gustschin wrote: > Hi Guennadi, > > On Fri, 24 Aug 2012 13:22:18 +0200 (CEST) > Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote: > ... > > > --- a/drivers/media/i2c/soc_camera/mt9v022.c > > > +++ b/drivers/media/i2c/soc_camera/mt9v022.c > > > @@ -274,9 +274,9 @@ 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); > > > + else /* Set to the manually controlled value */ > > > + ret = v4l2_ctrl_s_ctrl(mt9v022->exposure, > > > + mt9v022->exposure->val); > > > > But why do we have to write it here at all then? Autoexposure can be off > > only if the user has set exposure manually, using V4L2_CID_EXPOSURE_AUTO. > > In this case MT9V022_TOTAL_SHUTTER_WIDTH already contains the correct > > value. Why do we have to set it again? Maybe just adding a comment, > > explaining the above, would suffice? > > Actually we do not have to write it here, yes. Should I remove the shutter > register setting here entirely? And add a comment explaining, why? Remove it from the "else" clause, yes, please. And a comment would be good! Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 24 Aug 2012 16:32:57 +0200 (CEST) Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote: ... > > > But why do we have to write it here at all then? Autoexposure can be off > > > only if the user has set exposure manually, using V4L2_CID_EXPOSURE_AUTO. > > > In this case MT9V022_TOTAL_SHUTTER_WIDTH already contains the correct > > > value. Why do we have to set it again? Maybe just adding a comment, > > > explaining the above, would suffice? > > > > Actually we do not have to write it here, yes. Should I remove the shutter > > register setting here entirely? And add a comment explaining, why? > > Remove it from the "else" clause, yes, please. And a comment would be > good! Ok, I'll resubmit a reworked patch. Thanks, Anatolij -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index d13c8c4..d26c071 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c @@ -274,9 +274,9 @@ 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); + else /* Set to the manually controlled value */ + ret = v4l2_ctrl_s_ctrl(mt9v022->exposure, + mt9v022->exposure->val); } /* Setup frame format: defaults apart from width and height */ if (!ret)