Commit 253bae57 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (10787): gspca - mars: Bad webcam register values tied to saturation.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7434ca43
...@@ -69,10 +69,10 @@ static struct ctrl sd_ctrls[] = { ...@@ -69,10 +69,10 @@ static struct ctrl sd_ctrls[] = {
.id = V4L2_CID_SATURATION, .id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color", .name = "Color",
.minimum = 0, .minimum = 1,
.maximum = 220, .maximum = 255,
.step = 1, .step = 1,
#define COLOR_DEF 190 #define COLOR_DEF 200
.default_value = COLOR_DEF, .default_value = COLOR_DEF,
}, },
.set = sd_setcolors, .set = sd_setcolors,
...@@ -191,7 +191,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -191,7 +191,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int err_code; int err_code;
u8 *data; u8 *data;
int i, val; int i;
data = gspca_dev->usb_buf; data = gspca_dev->usb_buf;
...@@ -247,9 +247,11 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -247,9 +247,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x5e; /* address */ data[0] = 0x5e; /* address */
data[1] = 0; /* reg 94, Y Gain (auto) */ data[1] = 0; /* reg 94, Y Gain (auto) */
/*jfm: from win trace*/ /*jfm: from win trace*/
val = sd->colors * 0x40 + 0x400; /* reg 0x5f/0x60 (LE) = saturation */
data[2] = val; /* reg 0x5f/0x60 (LE) = saturation */ /* h (60): xxxx x100
data[3] = val >> 8; * l (5f): xxxx x000 */
data[2] = sd->colors << 3;
data[3] = ((sd->colors >> 2) & 0xf8) | 0x04;
data[4] = sd->brightness; /* reg 0x61 = brightness */ data[4] = sd->brightness; /* reg 0x61 = brightness */
data[5] = 0x00; data[5] = 0x00;
...@@ -365,10 +367,11 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val) ...@@ -365,10 +367,11 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
sd->colors = val; sd->colors = val;
if (gspca_dev->streaming) { if (gspca_dev->streaming) {
val = val * 0x40 + 0x400;
/* see sd_start */
gspca_dev->usb_buf[0] = 0x5f; gspca_dev->usb_buf[0] = 0x5f;
gspca_dev->usb_buf[1] = val; gspca_dev->usb_buf[1] = sd->colors << 3;
gspca_dev->usb_buf[2] = val >> 8; gspca_dev->usb_buf[2] = ((sd->colors >> 2) & 0xf8) | 0x04;
reg_w(gspca_dev, 3); reg_w(gspca_dev, 3);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment