V4L/DVB (3449): Cx88 default picture controls values
authorMarcin Rudowski <mar_rud@poczta.onet.pl>
Sun, 12 Mar 2006 03:03:47 +0000 (00:03 -0300)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 21 Mar 2006 16:53:15 +0000 (08:53 -0800)
This patch fixes default values for some picture controls:
 - brightness set to 50% by default (now is 0%)
 - hue set to 50% by default (now is 0%)
 - sets saturation to datasheet value
 - volume set to 0dB (now is -32dB)
and some left small fixes:
 - twice offset adding
 - balance didn't follow datasheet (bits[0:5] = attenuation;
   bit[6] = channel to provide attenuation)

Signed-off-by: Marcin Rudowski <mar_rud@poczta.onet.pl>
Signed-off-by: Ian Pickworth <ian@pickworth.me.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx88/cx88-video.c

index 7bbc81fb43b51d9e8e55ab8b44262cb653f10aed..b1892dff0fe889dc5b8bc86e85f97bd3696c633c 100644 (file)
@@ -227,7 +227,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
                        .minimum       = 0x00,
                        .maximum       = 0xff,
                        .step          = 1,
-                       .default_value = 0,
+                       .default_value = 0x7f,
                        .type          = V4L2_CTRL_TYPE_INTEGER,
                },
                .off                   = 128,
@@ -255,7 +255,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
                        .minimum       = 0,
                        .maximum       = 0xff,
                        .step          = 1,
-                       .default_value = 0,
+                       .default_value = 0x7f,
                        .type          = V4L2_CTRL_TYPE_INTEGER,
                },
                .off                   = 128,
@@ -300,7 +300,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
                        .minimum       = 0,
                        .maximum       = 0x3f,
                        .step          = 1,
-                       .default_value = 0x1f,
+                       .default_value = 0x3f,
                        .type          = V4L2_CTRL_TYPE_INTEGER,
                },
                .reg                   = AUD_VOL_CTL,
@@ -909,7 +909,8 @@ static int get_control(struct cx88_core *core, struct v4l2_control *ctl)
        value = c->sreg ? cx_sread(c->sreg) : cx_read(c->reg);
        switch (ctl->id) {
        case V4L2_CID_AUDIO_BALANCE:
-               ctl->value = (value & 0x40) ? (value & 0x3f) : (0x40 - (value & 0x3f));
+               ctl->value = ((value & 0x7f) < 0x40) ? ((value & 0x7f) + 0x40)
+                                       : (0x7f - (value & 0x7f));
                break;
        case V4L2_CID_AUDIO_VOLUME:
                ctl->value = 0x3f - (value & 0x3f);
@@ -946,7 +947,7 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl)
        mask=c->mask;
        switch (ctl->id) {
        case V4L2_CID_AUDIO_BALANCE:
-               value = (ctl->value < 0x40) ? (0x40 - ctl->value) : ctl->value;
+               value = (ctl->value < 0x40) ? (0x7f - ctl->value) : (ctl->value - 0x40);
                break;
        case V4L2_CID_AUDIO_VOLUME:
                value = 0x3f - (ctl->value & 0x3f);
@@ -987,8 +988,7 @@ static void init_controls(struct cx88_core *core)
 
        for (i = 0; i < CX8800_CTLS; i++) {
                ctrl.id=cx8800_ctls[i].v.id;
-               ctrl.value=cx8800_ctls[i].v.default_value
-                               +cx8800_ctls[i].off;
+               ctrl.value=cx8800_ctls[i].v.default_value;
                set_control(core, &ctrl);
        }
 }