Linux Media Controller development
 help / color / mirror / Atom feed
From: Kartik Mohta <kartikmohta@gmail.com>
To: linux-media@vger.kernel.org
Cc: Kartik Mohta <kartikmohta@gmail.com>
Subject: [PATCH] mt9v032: Correct the logic for the auto-exposure setting
Date: Wed,  2 May 2012 18:19:08 -0400	[thread overview]
Message-ID: <1335997148-4915-1-git-send-email-kartikmohta@gmail.com> (raw)

The driver uses the ctrl value passed in as a bool to determine whether
to enable auto-exposure, but the auto-exposure setting is defined as an
enum where AUTO has a value of 0 and MANUAL has a value of 1. This leads
to a reversed logic where if you send in AUTO, it actually sets manual
exposure and vice-versa.

Signed-off-by: Kartik Mohta <kartikmohta@gmail.com>
---
 drivers/media/video/mt9v032.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/video/mt9v032.c b/drivers/media/video/mt9v032.c
index 75e253a..8ea8737 100644
--- a/drivers/media/video/mt9v032.c
+++ b/drivers/media/video/mt9v032.c
@@ -470,6 +470,7 @@ static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl)
 			container_of(ctrl->handler, struct mt9v032, ctrls);
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9v032->subdev);
 	u16 data;
+	int aec_value;
 
 	switch (ctrl->id) {
 	case V4L2_CID_AUTOGAIN:
@@ -480,8 +481,13 @@ static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl)
 		return mt9v032_write(client, MT9V032_ANALOG_GAIN, ctrl->val);
 
 	case V4L2_CID_EXPOSURE_AUTO:
+		if(ctrl->val == V4L2_EXPOSURE_MANUAL)
+			aec_value = 0;
+		else
+			aec_value = 1;
+
 		return mt9v032_update_aec_agc(mt9v032, MT9V032_AEC_ENABLE,
-					      ctrl->val);
+					      aec_value);
 
 	case V4L2_CID_EXPOSURE:
 		return mt9v032_write(client, MT9V032_TOTAL_SHUTTER_WIDTH,
-- 
1.7.10.1


             reply	other threads:[~2012-05-02 22:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 22:19 Kartik Mohta [this message]
2012-05-08 11:12 ` [PATCH] mt9v032: Correct the logic for the auto-exposure setting Laurent Pinchart
2012-05-08 15:51   ` Kartik Mohta
2012-05-08 17:30     ` Laurent Pinchart

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=1335997148-4915-1-git-send-email-kartikmohta@gmail.com \
    --to=kartikmohta@gmail.com \
    --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