diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-03-06 05:10:27 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 13:34:02 -0400 |
commit | efcb07c1bbd43846aff192f28ad755fc8c93ad81 (patch) | |
tree | f3d60330ed8bf701dc10a8c52bb00caf71f038a6 /drivers | |
parent | 4eb3419d401579b262f61d4d03cf10598ab0e2a2 (diff) |
[media] m5mols: Add image stabilization control
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/m5mols/m5mols.h | 2 | ||||
-rw-r--r-- | drivers/media/video/m5mols/m5mols_controls.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/video/m5mols/m5mols.h b/drivers/media/video/m5mols/m5mols.h index 978a4abd3722..305a75bc6a9f 100644 --- a/drivers/media/video/m5mols/m5mols.h +++ b/drivers/media/video/m5mols/m5mols.h | |||
@@ -170,6 +170,7 @@ struct m5mols_version { | |||
170 | * @saturation: saturation control | 170 | * @saturation: saturation control |
171 | * @zoom: zoom control | 171 | * @zoom: zoom control |
172 | * @wdr: wide dynamic range control | 172 | * @wdr: wide dynamic range control |
173 | * @stabilization: image stabilization control | ||
173 | * @ver: information of the version | 174 | * @ver: information of the version |
174 | * @cap: the capture mode attributes | 175 | * @cap: the capture mode attributes |
175 | * @power: current sensor's power status | 176 | * @power: current sensor's power status |
@@ -209,6 +210,7 @@ struct m5mols_info { | |||
209 | struct v4l2_ctrl *saturation; | 210 | struct v4l2_ctrl *saturation; |
210 | struct v4l2_ctrl *zoom; | 211 | struct v4l2_ctrl *zoom; |
211 | struct v4l2_ctrl *wdr; | 212 | struct v4l2_ctrl *wdr; |
213 | struct v4l2_ctrl *stabilization; | ||
212 | 214 | ||
213 | struct m5mols_version ver; | 215 | struct m5mols_version ver; |
214 | struct m5mols_capture cap; | 216 | struct m5mols_capture cap; |
diff --git a/drivers/media/video/m5mols/m5mols_controls.c b/drivers/media/video/m5mols/m5mols_controls.c index 512c3603b280..6c607d467c6e 100644 --- a/drivers/media/video/m5mols/m5mols_controls.c +++ b/drivers/media/video/m5mols/m5mols_controls.c | |||
@@ -375,6 +375,19 @@ static int m5mols_set_wdr(struct m5mols_info *info, int wdr) | |||
375 | return m5mols_write(&info->sd, CAPP_WDR_EN, wdr); | 375 | return m5mols_write(&info->sd, CAPP_WDR_EN, wdr); |
376 | } | 376 | } |
377 | 377 | ||
378 | static int m5mols_set_stabilization(struct m5mols_info *info, int val) | ||
379 | { | ||
380 | struct v4l2_subdev *sd = &info->sd; | ||
381 | unsigned int evp = val ? 0xe : 0x0; | ||
382 | int ret; | ||
383 | |||
384 | ret = m5mols_write(sd, AE_EV_PRESET_MONITOR, evp); | ||
385 | if (ret < 0) | ||
386 | return ret; | ||
387 | |||
388 | return m5mols_write(sd, AE_EV_PRESET_CAPTURE, evp); | ||
389 | } | ||
390 | |||
378 | static int m5mols_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | 391 | static int m5mols_g_volatile_ctrl(struct v4l2_ctrl *ctrl) |
379 | { | 392 | { |
380 | struct v4l2_subdev *sd = to_sd(ctrl); | 393 | struct v4l2_subdev *sd = to_sd(ctrl); |
@@ -455,6 +468,10 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl) | |||
455 | case V4L2_CID_WIDE_DYNAMIC_RANGE: | 468 | case V4L2_CID_WIDE_DYNAMIC_RANGE: |
456 | ret = m5mols_set_wdr(info, ctrl->val); | 469 | ret = m5mols_set_wdr(info, ctrl->val); |
457 | break; | 470 | break; |
471 | |||
472 | case V4L2_CID_IMAGE_STABILIZATION: | ||
473 | ret = m5mols_set_stabilization(info, ctrl->val); | ||
474 | break; | ||
458 | } | 475 | } |
459 | 476 | ||
460 | if (ret == 0 && info->mode != last_mode) | 477 | if (ret == 0 && info->mode != last_mode) |
@@ -535,6 +552,9 @@ int m5mols_init_controls(struct v4l2_subdev *sd) | |||
535 | info->wdr = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, | 552 | info->wdr = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, |
536 | V4L2_CID_WIDE_DYNAMIC_RANGE, 0, 1, 1, 0); | 553 | V4L2_CID_WIDE_DYNAMIC_RANGE, 0, 1, 1, 0); |
537 | 554 | ||
555 | info->stabilization = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, | ||
556 | V4L2_CID_IMAGE_STABILIZATION, 0, 1, 1, 0); | ||
557 | |||
538 | if (info->handle.error) { | 558 | if (info->handle.error) { |
539 | int ret = info->handle.error; | 559 | int ret = info->handle.error; |
540 | v4l2_err(sd, "Failed to initialize controls: %d\n", ret); | 560 | v4l2_err(sd, "Failed to initialize controls: %d\n", ret); |