Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164215
b: refs/heads/master
c: a813d01
h: refs/heads/master
i:
  164213: 58690d1
  164211: d840dba
  164207: 446de1d
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Sep 19, 2009
1 parent 9fdf193 commit 6178aa9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 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: 3418f165cc1cbcb30a8c017d7ebbc774710066bb
refs/heads/master: a813d01f823259d1b27668c2149785515843a7eb
52 changes: 50 additions & 2 deletions trunk/drivers/media/video/ov772x.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ struct ov772x_priv {
const struct ov772x_color_format *fmt;
const struct ov772x_win_size *win;
int model;
unsigned int flag_vflip:1;
unsigned int flag_hflip:1;
unsigned short flag_vflip:1;
unsigned short flag_hflip:1;
unsigned short band_filter; /* 256 - BDBASE, 0 if (!COM8[5]) */
};

#define ENDMARKER { 0xff, 0xff }
Expand Down Expand Up @@ -569,6 +570,15 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
.step = 1,
.default_value = 0,
},
{
.id = V4L2_CID_BAND_STOP_FILTER,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Band-stop filter",
.minimum = 0,
.maximum = 256,
.step = 1,
.default_value = 0,
},
};


Expand Down Expand Up @@ -674,6 +684,9 @@ static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_HFLIP:
ctrl->value = priv->flag_hflip;
break;
case V4L2_CID_BAND_STOP_FILTER:
ctrl->value = priv->band_filter;
break;
}
return 0;
}
Expand All @@ -700,6 +713,29 @@ static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
val ^= HFLIP_IMG;
ret = ov772x_mask_set(client, COM3, HFLIP_IMG, val);
break;
case V4L2_CID_BAND_STOP_FILTER:
if ((unsigned)ctrl->value > 256)
ctrl->value = 256;
if (ctrl->value == priv->band_filter)
break;
if (!ctrl->value) {
/* Switch the filter off, it is on now */
ret = ov772x_mask_set(client, BDBASE, 0xff, 0xff);
if (!ret)
ret = ov772x_mask_set(client, COM8,
BNDF_ON_OFF, 0);
} else {
/* Switch the filter on, set AEC low limit */
val = 256 - ctrl->value;
ret = ov772x_mask_set(client, COM8,
BNDF_ON_OFF, BNDF_ON_OFF);
if (!ret)
ret = ov772x_mask_set(client, BDBASE,
0xff, val);
}
if (!ret)
priv->band_filter = ctrl->value;
break;
}

return ret;
Expand Down Expand Up @@ -893,6 +929,18 @@ static int ov772x_set_params(struct i2c_client *client,
if (ret < 0)
goto ov772x_set_fmt_error;

/*
* set COM8
*/
if (priv->band_filter) {
ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1);
if (!ret)
ret = ov772x_mask_set(client, BDBASE,
0xff, 256 - priv->band_filter);
if (ret < 0)
goto ov772x_set_fmt_error;
}

return ret;

ov772x_set_fmt_error:
Expand Down

0 comments on commit 6178aa9

Please sign in to comment.