Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192839
b: refs/heads/master
c: 87a6fe4
h: refs/heads/master
i:
  192837: 41e47bf
  192835: d22bc88
  192831: 7a5fe2f
v: v3
  • Loading branch information
Devin Heitmueller authored and Mauro Carvalho Chehab committed May 18, 2010
1 parent 11ade26 commit deb99b3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 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: 7a01f6dbc7abb85a6ec048dd45db92ef1b91fe78
refs/heads/master: 87a6fe4a530cc01081d19cdec4738433972fb0ee
38 changes: 37 additions & 1 deletion trunk/drivers/media/video/saa7115.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct saa711x_state {
int contrast;
int hue;
int sat;
int chroma_agc;
int width;
int height;
u32 ident;
Expand Down Expand Up @@ -743,6 +744,7 @@ static int saa711x_s_clock_freq(struct v4l2_subdev *sd, u32 freq)
static int saa711x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct saa711x_state *state = to_state(sd);
u8 val;

switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS:
Expand Down Expand Up @@ -784,7 +786,21 @@ static int saa711x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
state->hue = ctrl->value;
saa711x_write(sd, R_0D_CHROMA_HUE_CNTL, state->hue);
break;

case V4L2_CID_CHROMA_AGC:
val = saa711x_read(sd, R_0F_CHROMA_GAIN_CNTL);
state->chroma_agc = ctrl->value;
if (ctrl->value)
val &= 0x7f;
else
val |= 0x80;
saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, val);
break;
case V4L2_CID_CHROMA_GAIN:
/* Chroma gain cannot be set when AGC is enabled */
if (state->chroma_agc == 1)
return -EINVAL;
saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, ctrl->value | 0x80);
break;
default:
return -EINVAL;
}
Expand All @@ -809,6 +825,12 @@ static int saa711x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_HUE:
ctrl->value = state->hue;
break;
case V4L2_CID_CHROMA_AGC:
ctrl->value = state->chroma_agc;
break;
case V4L2_CID_CHROMA_GAIN:
ctrl->value = saa711x_read(sd, R_0F_CHROMA_GAIN_CNTL) & 0x7f;
break;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -1209,6 +1231,19 @@ static int saa711x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
return v4l2_ctrl_query_fill(qc, 0, 127, 1, 64);
case V4L2_CID_HUE:
return v4l2_ctrl_query_fill(qc, -128, 127, 1, 0);
case V4L2_CID_CHROMA_AGC:
return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
case V4L2_CID_CHROMA_GAIN:
qc->type = V4L2_CTRL_TYPE_INTEGER;
qc->flags = V4L2_CTRL_FLAG_SLIDER;
qc->minimum = 0;
qc->maximum = 127;
qc->step = 1;
qc->default_value = 0x30;
qc->reserved[0] = 0;
qc->reserved[1] = 0;
strlcpy(qc->name, "chroma_gain", sizeof(qc->name));
return 0;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -1593,6 +1628,7 @@ static int saa711x_probe(struct i2c_client *client,
state->contrast = 64;
state->hue = 0;
state->sat = 64;
state->chroma_agc = 1;
switch (chip_id) {
case '1':
state->ident = V4L2_IDENT_SAA7111;
Expand Down

0 comments on commit deb99b3

Please sign in to comment.