This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-dvb.git tree:

Subject: V4L/DVB: saa115: add support for chroma AGC and chroma gain
Author:  Devin Heitmueller <dheitmuel...@kernellabs.com>
Date:    Thu Mar 11 21:49:24 2010 -0300

Add support for chroma agc and gain to the saa7115 driver.  This allows for
users to do manual adjustment for abnormal signal conditions.

This work was sponsored by EyeMagnet Limited.

Signed-off-by: Devin Heitmueller <dheitmuel...@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>

 drivers/media/video/saa7115.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/v4l-dvb.git?a=commitdiff;h=87f0c9a380ff66b4c16d174182c363e708f49c51

diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 7d11660..f96071c 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -74,6 +74,7 @@ struct saa711x_state {
        int contrast;
        int hue;
        int sat;
+       int chroma_agc;
        int width;
        int height;
        u32 ident;
@@ -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:
@@ -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;
        }
@@ -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;
        }
@@ -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;
        }
@@ -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;

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to