Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306368
b: refs/heads/master
c: 0373e97
h: refs/heads/master
v: v3
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed May 14, 2012
1 parent 6143910 commit bd9c711
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 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: 3c5da0baaada8e8c7176a3e310dfdb4362f74d80
refs/heads/master: 0373e97496793fd91cd7fb1a26840ee43d70f77e
11 changes: 11 additions & 0 deletions trunk/drivers/media/video/m5mols/m5mols.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,15 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
return &info->sd;
}

static inline void m5mols_set_ctrl_mode(struct v4l2_ctrl *ctrl,
unsigned int mode)
{
ctrl->priv = (void *)mode;
}

static inline unsigned int m5mols_get_ctrl_mode(struct v4l2_ctrl *ctrl)
{
return (unsigned int)ctrl->priv;
}

#endif /* M5MOLS_H */
28 changes: 20 additions & 8 deletions trunk/drivers/media/video/m5mols/m5mols_controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,11 @@ static int m5mols_set_color_effect(struct m5mols_info *info, int val)

static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
{
unsigned int ctrl_mode = m5mols_get_ctrl_mode(ctrl);
struct v4l2_subdev *sd = to_sd(ctrl);
struct m5mols_info *info = to_m5mols(sd);
int ispstate = info->mode;
int ret;
int last_mode = info->mode;
int ret = 0;

/*
* If needed, defer restoring the controls until
Expand All @@ -335,9 +336,14 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
return 0;
}

ret = m5mols_mode(info, REG_PARAMETER);
if (ret < 0)
return ret;
v4l2_dbg(1, m5mols_debug, sd, "%s: %s, val: %d, priv: %#x\n",
__func__, ctrl->name, ctrl->val, (int)ctrl->priv);

if (ctrl_mode && ctrl_mode != info->mode) {
ret = m5mols_set_mode(info, ctrl_mode);
if (ret < 0)
return ret;
}

switch (ctrl->id) {
case V4L2_CID_ZOOM_ABSOLUTE:
Expand All @@ -360,10 +366,11 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
ret = m5mols_set_color_effect(info, ctrl->val);
break;
}
if (ret < 0)
return ret;

return m5mols_mode(info, ispstate);
if (ret == 0 && info->mode != last_mode)
ret = m5mols_set_mode(info, last_mode);

return ret;
}

static const struct v4l2_ctrl_ops m5mols_ctrl_ops = {
Expand Down Expand Up @@ -414,6 +421,11 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
}

v4l2_ctrl_auto_cluster(2, &info->auto_exposure, 1, false);

m5mols_set_ctrl_mode(info->auto_exposure, REG_PARAMETER);
m5mols_set_ctrl_mode(info->auto_wb, REG_PARAMETER);
m5mols_set_ctrl_mode(info->colorfx, REG_MONITOR);

sd->ctrl_handler = &info->handle;

return 0;
Expand Down

0 comments on commit bd9c711

Please sign in to comment.