All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: linux-media@vger.kernel.org
Cc: m.szyprowski@samsung.com, riverful.kim@samsung.com,
	sw0312.kim@samsung.com, s.nawrocki@samsung.com,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH 18/23] m5mols: Add exposure bias control
Date: Thu, 10 May 2012 12:30:53 +0200	[thread overview]
Message-ID: <1336645858-30366-19-git-send-email-s.nawrocki@samsung.com> (raw)
In-Reply-To: <1336645858-30366-1-git-send-email-s.nawrocki@samsung.com>

Add integer menu control for exposure bias. The control value range is
-2.0 EV to +2.0 EV, in 0.5 EV steps.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/video/m5mols/m5mols.h          |    4 +++-
 drivers/media/video/m5mols/m5mols_controls.c |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/m5mols/m5mols.h b/drivers/media/video/m5mols/m5mols.h
index fa1f2c1..03421fc 100644
--- a/drivers/media/video/m5mols/m5mols.h
+++ b/drivers/media/video/m5mols/m5mols.h
@@ -161,6 +161,7 @@ struct m5mols_version {
  * @flags: state variable for the interrupt handler
  * @handle: control handler
  * @auto_exposure: auto/manual exposure control
+ * @exposure_bias: exposure compensation control
  * @exposure: manual exposure control
  * @auto_iso: auto/manual ISO sensitivity control
  * @iso: manual ISO sensitivity control
@@ -191,8 +192,9 @@ struct m5mols_info {
 
 	struct v4l2_ctrl_handler handle;
 	struct {
-		/* exposure/auto-exposure cluster */
+		/* exposure/exposure bias/auto exposure cluster */
 		struct v4l2_ctrl *auto_exposure;
+		struct v4l2_ctrl *exposure_bias;
 		struct v4l2_ctrl *exposure;
 	};
 	struct {
diff --git a/drivers/media/video/m5mols/m5mols_controls.c b/drivers/media/video/m5mols/m5mols_controls.c
index 1ab21f0..7978363 100644
--- a/drivers/media/video/m5mols/m5mols_controls.c
+++ b/drivers/media/video/m5mols/m5mols_controls.c
@@ -241,6 +241,11 @@ static int m5mols_set_exposure(struct m5mols_info *info, int exposure)
 		ret = m5mols_write(sd, AE_MODE, REG_AE_ALL);
 		if (ret < 0)
 			return ret;
+
+		v4l2_dbg(1, m5mols_debug, sd, "%s: exposure bias: %#x\n",
+			 __func__, info->exposure_bias->val);
+
+		return m5mols_write(sd, AE_INDEX, info->exposure_bias->val);
 	}
 
 	if (exposure == V4L2_EXPOSURE_MANUAL) {
@@ -251,6 +256,9 @@ static int m5mols_set_exposure(struct m5mols_info *info, int exposure)
 		if (ret == 0)
 			ret = m5mols_write(sd, AE_MAN_GAIN_CAP,
 					   info->exposure->val);
+
+		v4l2_dbg(1, m5mols_debug, sd, "%s: exposure: %#x\n",
+			 __func__, info->exposure->val);
 	}
 
 	return ret;
@@ -447,6 +455,12 @@ static const s64 iso_qmenu[] = {
 	50, 100, 200, 400, 800, 1600, 3200
 };
 
+/* Supported Exposure Bias values, -2.0EV...+2.0EV */
+static const s64 ev_bias_qmenu[] = {
+	/* AE_INDEX: 0x00...0x08 */
+	-2000, -1500, -1000, -500, 0, 500, 1000, 1500, 2000
+};
+
 int m5mols_init_controls(struct v4l2_subdev *sd)
 {
 	struct m5mols_info *info = to_m5mols(sd);
@@ -467,6 +481,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
 			&m5mols_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE,
 			9, ~0x3fe, V4L2_WHITE_BALANCE_AUTO);
 
+	/* Exposure control cluster */
 	info->auto_exposure = v4l2_ctrl_new_std_menu(&info->handle,
 			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO,
 			1, ~0x03, V4L2_EXPOSURE_AUTO);
@@ -475,6 +490,12 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
 			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE,
 			0, exposure_max, 1, exposure_max / 2);
 
+	info->exposure_bias = v4l2_ctrl_new_int_menu(&info->handle,
+			&m5mols_ctrl_ops, V4L2_CID_AUTO_EXPOSURE_BIAS,
+			ARRAY_SIZE(ev_bias_qmenu) - 1,
+			ARRAY_SIZE(ev_bias_qmenu)/2 - 1,
+			ev_bias_qmenu);
+
 	/* ISO control cluster */
 	info->auto_iso = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops,
 			V4L2_CID_ISO_SENSITIVITY_AUTO, 1, ~0x03, 1);
@@ -499,8 +520,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
 		return ret;
 	}
 
-	v4l2_ctrl_auto_cluster(2, &info->auto_exposure, 1, false);
-
+	v4l2_ctrl_auto_cluster(3, &info->auto_exposure, 1, false);
 	info->auto_iso->flags |= V4L2_CTRL_FLAG_VOLATILE |
 				V4L2_CTRL_FLAG_UPDATE;
 	v4l2_ctrl_auto_cluster(2, &info->auto_iso, 0, false);
-- 
1.7.10


  parent reply	other threads:[~2012-05-10 10:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 10:30 [PATCH v5 00/23] V4L: camera control enhancements Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 01/23] V4L: Add helper function for standard integer menu controls Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 02/23] V4L: Add camera exposure bias control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 03/23] V4L: Add an extended camera white balance control Sylwester Nawrocki
2012-05-14  0:02   ` Sakari Ailus
2012-05-15 21:28     ` Sylwester Nawrocki
2012-05-16  6:57       ` Sakari Ailus
2012-05-16  9:34         ` Sylwester Nawrocki
2012-05-17 22:37           ` Sakari Ailus
2012-05-15 21:53     ` [PATCH] V4L: DocBook: Improve V4L2_AUTO_N_WHITE_BALANCE control description Sylwester Nawrocki
2012-05-19 20:27       ` [PATCH v3] V4L: DocBook: Improve V4L2_CID_AUTO_N_WHITE_BALANCE " Sylwester Nawrocki
2012-05-15 22:05     ` [PATCH v2] " Sylwester Nawrocki
2012-05-17 22:42       ` Sakari Ailus
2012-05-10 10:30 ` [PATCH 04/23] V4L: Add camera wide dynamic range control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 05/23] V4L: Add camera image stabilization control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 06/23] V4L: Add camera ISO sensitivity controls Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 07/23] V4L: Add camera exposure metering control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 08/23] V4L: Add camera scene mode control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 09/23] V4L: Add camera 3A lock control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 10/23] V4L: Add auto focus targets to the selections API Sylwester Nawrocki
2012-10-29 20:00   ` Sakari Ailus
2012-10-29 22:43     ` Sylwester Nawrocki
2012-11-04 17:29       ` Sakari Ailus
2012-05-10 10:30 ` [PATCH 11/23] V4L: Add auto focus targets to the subdev " Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 12/23] V4L: Add camera auto focus controls Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 13/23] m5mols: Convert macros to inline functions Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 14/23] m5mols: Refactored controls handling Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 15/23] m5mols: Use proper sensor mode for the controls Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 16/23] m5mols: Add ISO sensitivity controls Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 17/23] m5mols: Add auto and preset white balance control Sylwester Nawrocki
2012-05-10 10:30 ` Sylwester Nawrocki [this message]
2012-05-10 10:30 ` [PATCH 19/23] m5mols: Add wide dynamic range control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 20/23] m5mols: Add image stabilization control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 21/23] m5mols: Add exposure metering control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 22/23] m5mols: Add JPEG compression quality control Sylwester Nawrocki
2012-05-10 10:30 ` [PATCH 23/23] m5mols: Add 3A lock control Sylwester Nawrocki

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=1336645858-30366-19-git-send-email-s.nawrocki@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=riverful.kim@samsung.com \
    --cc=sw0312.kim@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.