diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-03-06 05:10:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 13:33:38 -0400 |
commit | 48311db6768040970d4a28faab17583b5177af84 (patch) | |
tree | 264b2b4a5e3a3851e85ed3b01cbe896b4c4d6269 /drivers | |
parent | d7a87e4cc39f7ee4f6d1a1a8b8fffc10a7b0c1e9 (diff) |
[media] m5mols: Add exposure bias control
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/m5mols/m5mols.h | 4 | ||||
-rw-r--r-- | 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 fa1f2c145852..03421fc1a965 100644 --- a/drivers/media/video/m5mols/m5mols.h +++ b/drivers/media/video/m5mols/m5mols.h | |||
@@ -161,6 +161,7 @@ struct m5mols_version { | |||
161 | * @flags: state variable for the interrupt handler | 161 | * @flags: state variable for the interrupt handler |
162 | * @handle: control handler | 162 | * @handle: control handler |
163 | * @auto_exposure: auto/manual exposure control | 163 | * @auto_exposure: auto/manual exposure control |
164 | * @exposure_bias: exposure compensation control | ||
164 | * @exposure: manual exposure control | 165 | * @exposure: manual exposure control |
165 | * @auto_iso: auto/manual ISO sensitivity control | 166 | * @auto_iso: auto/manual ISO sensitivity control |
166 | * @iso: manual ISO sensitivity control | 167 | * @iso: manual ISO sensitivity control |
@@ -191,8 +192,9 @@ struct m5mols_info { | |||
191 | 192 | ||
192 | struct v4l2_ctrl_handler handle; | 193 | struct v4l2_ctrl_handler handle; |
193 | struct { | 194 | struct { |
194 | /* exposure/auto-exposure cluster */ | 195 | /* exposure/exposure bias/auto exposure cluster */ |
195 | struct v4l2_ctrl *auto_exposure; | 196 | struct v4l2_ctrl *auto_exposure; |
197 | struct v4l2_ctrl *exposure_bias; | ||
196 | struct v4l2_ctrl *exposure; | 198 | struct v4l2_ctrl *exposure; |
197 | }; | 199 | }; |
198 | struct { | 200 | struct { |
diff --git a/drivers/media/video/m5mols/m5mols_controls.c b/drivers/media/video/m5mols/m5mols_controls.c index 1ab21f0afa8a..797836315225 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) | |||
241 | ret = m5mols_write(sd, AE_MODE, REG_AE_ALL); | 241 | ret = m5mols_write(sd, AE_MODE, REG_AE_ALL); |
242 | if (ret < 0) | 242 | if (ret < 0) |
243 | return ret; | 243 | return ret; |
244 | |||
245 | v4l2_dbg(1, m5mols_debug, sd, "%s: exposure bias: %#x\n", | ||
246 | __func__, info->exposure_bias->val); | ||
247 | |||
248 | return m5mols_write(sd, AE_INDEX, info->exposure_bias->val); | ||
244 | } | 249 | } |
245 | 250 | ||
246 | if (exposure == V4L2_EXPOSURE_MANUAL) { | 251 | if (exposure == V4L2_EXPOSURE_MANUAL) { |
@@ -251,6 +256,9 @@ static int m5mols_set_exposure(struct m5mols_info *info, int exposure) | |||
251 | if (ret == 0) | 256 | if (ret == 0) |
252 | ret = m5mols_write(sd, AE_MAN_GAIN_CAP, | 257 | ret = m5mols_write(sd, AE_MAN_GAIN_CAP, |
253 | info->exposure->val); | 258 | info->exposure->val); |
259 | |||
260 | v4l2_dbg(1, m5mols_debug, sd, "%s: exposure: %#x\n", | ||
261 | __func__, info->exposure->val); | ||
254 | } | 262 | } |
255 | 263 | ||
256 | return ret; | 264 | return ret; |
@@ -447,6 +455,12 @@ static const s64 iso_qmenu[] = { | |||
447 | 50, 100, 200, 400, 800, 1600, 3200 | 455 | 50, 100, 200, 400, 800, 1600, 3200 |
448 | }; | 456 | }; |
449 | 457 | ||
458 | /* Supported Exposure Bias values, -2.0EV...+2.0EV */ | ||
459 | static const s64 ev_bias_qmenu[] = { | ||
460 | /* AE_INDEX: 0x00...0x08 */ | ||
461 | -2000, -1500, -1000, -500, 0, 500, 1000, 1500, 2000 | ||
462 | }; | ||
463 | |||
450 | int m5mols_init_controls(struct v4l2_subdev *sd) | 464 | int m5mols_init_controls(struct v4l2_subdev *sd) |
451 | { | 465 | { |
452 | struct m5mols_info *info = to_m5mols(sd); | 466 | struct m5mols_info *info = to_m5mols(sd); |
@@ -467,6 +481,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd) | |||
467 | &m5mols_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, | 481 | &m5mols_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, |
468 | 9, ~0x3fe, V4L2_WHITE_BALANCE_AUTO); | 482 | 9, ~0x3fe, V4L2_WHITE_BALANCE_AUTO); |
469 | 483 | ||
484 | /* Exposure control cluster */ | ||
470 | info->auto_exposure = v4l2_ctrl_new_std_menu(&info->handle, | 485 | info->auto_exposure = v4l2_ctrl_new_std_menu(&info->handle, |
471 | &m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, | 486 | &m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, |
472 | 1, ~0x03, V4L2_EXPOSURE_AUTO); | 487 | 1, ~0x03, V4L2_EXPOSURE_AUTO); |
@@ -475,6 +490,12 @@ int m5mols_init_controls(struct v4l2_subdev *sd) | |||
475 | &m5mols_ctrl_ops, V4L2_CID_EXPOSURE, | 490 | &m5mols_ctrl_ops, V4L2_CID_EXPOSURE, |
476 | 0, exposure_max, 1, exposure_max / 2); | 491 | 0, exposure_max, 1, exposure_max / 2); |
477 | 492 | ||
493 | info->exposure_bias = v4l2_ctrl_new_int_menu(&info->handle, | ||
494 | &m5mols_ctrl_ops, V4L2_CID_AUTO_EXPOSURE_BIAS, | ||
495 | ARRAY_SIZE(ev_bias_qmenu) - 1, | ||
496 | ARRAY_SIZE(ev_bias_qmenu)/2 - 1, | ||
497 | ev_bias_qmenu); | ||
498 | |||
478 | /* ISO control cluster */ | 499 | /* ISO control cluster */ |
479 | info->auto_iso = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops, | 500 | info->auto_iso = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops, |
480 | V4L2_CID_ISO_SENSITIVITY_AUTO, 1, ~0x03, 1); | 501 | V4L2_CID_ISO_SENSITIVITY_AUTO, 1, ~0x03, 1); |
@@ -499,8 +520,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd) | |||
499 | return ret; | 520 | return ret; |
500 | } | 521 | } |
501 | 522 | ||
502 | v4l2_ctrl_auto_cluster(2, &info->auto_exposure, 1, false); | 523 | v4l2_ctrl_auto_cluster(3, &info->auto_exposure, 1, false); |
503 | |||
504 | info->auto_iso->flags |= V4L2_CTRL_FLAG_VOLATILE | | 524 | info->auto_iso->flags |= V4L2_CTRL_FLAG_VOLATILE | |
505 | V4L2_CTRL_FLAG_UPDATE; | 525 | V4L2_CTRL_FLAG_UPDATE; |
506 | v4l2_ctrl_auto_cluster(2, &info->auto_iso, 0, false); | 526 | v4l2_ctrl_auto_cluster(2, &info->auto_iso, 0, false); |