Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306374
b: refs/heads/master
c: 50d3f93
h: refs/heads/master
v: v3
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed May 14, 2012
1 parent c67f9e5 commit f8acc39
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: efcb07c1bbd43846aff192f28ad755fc8c93ad81
refs/heads/master: 50d3f93e39d86d57af5df5f06c5b18ffe25ece79
2 changes: 2 additions & 0 deletions trunk/drivers/media/video/m5mols/m5mols.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ struct m5mols_version {
* @auto_exposure: auto/manual exposure control
* @exposure_bias: exposure compensation control
* @exposure: manual exposure control
* @metering: exposure metering control
* @auto_iso: auto/manual ISO sensitivity control
* @iso: manual ISO sensitivity control
* @auto_wb: auto white balance control
Expand Down Expand Up @@ -198,6 +199,7 @@ struct m5mols_info {
struct v4l2_ctrl *auto_exposure;
struct v4l2_ctrl *exposure_bias;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *metering;
};
struct {
/* iso/auto iso cluster */
Expand Down
34 changes: 29 additions & 5 deletions trunk/drivers/media/video/m5mols/m5mols_controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,25 @@ int m5mols_lock_3a(struct m5mols_info *info, bool lock)
return ret;
}

/* Set exposure/auto exposure cluster */
static int m5mols_set_metering_mode(struct m5mols_info *info, int mode)
{
unsigned int metering;

switch (mode) {
case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED:
metering = REG_AE_CENTER;
break;
case V4L2_EXPOSURE_METERING_SPOT:
metering = REG_AE_SPOT;
break;
default:
metering = REG_AE_ALL;
break;
}

return m5mols_write(&info->sd, AE_MODE, metering);
}

static int m5mols_set_exposure(struct m5mols_info *info, int exposure)
{
struct v4l2_subdev *sd = &info->sd;
Expand All @@ -238,12 +256,14 @@ static int m5mols_set_exposure(struct m5mols_info *info, int exposure)
return ret;

if (exposure == V4L2_EXPOSURE_AUTO) {
ret = m5mols_write(sd, AE_MODE, REG_AE_ALL);
ret = m5mols_set_metering_mode(info, info->metering->val);
if (ret < 0)
return ret;

v4l2_dbg(1, m5mols_debug, sd, "%s: exposure bias: %#x\n",
__func__, info->exposure_bias->val);
v4l2_dbg(1, m5mols_debug, sd,
"%s: exposure bias: %#x, metering: %#x\n",
__func__, info->exposure_bias->val,
info->metering->val);

return m5mols_write(sd, AE_INDEX, info->exposure_bias->val);
}
Expand Down Expand Up @@ -532,6 +552,10 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
ARRAY_SIZE(ev_bias_qmenu)/2 - 1,
ev_bias_qmenu);

info->metering = v4l2_ctrl_new_std_menu(&info->handle,
&m5mols_ctrl_ops, V4L2_CID_EXPOSURE_METERING,
2, ~0x7, V4L2_EXPOSURE_METERING_AVERAGE);

/* ISO control cluster */
info->auto_iso = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops,
V4L2_CID_ISO_SENSITIVITY_AUTO, 1, ~0x03, 1);
Expand Down Expand Up @@ -562,7 +586,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
return ret;
}

v4l2_ctrl_auto_cluster(3, &info->auto_exposure, 1, false);
v4l2_ctrl_auto_cluster(4, &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);
Expand Down

0 comments on commit f8acc39

Please sign in to comment.