Commit 9c5f70f2 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (8713): gspca: Bad color control again in sonixj.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 759aa3c2
...@@ -108,9 +108,9 @@ static struct ctrl sd_ctrls[] = { ...@@ -108,9 +108,9 @@ static struct ctrl sd_ctrls[] = {
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color", .name = "Color",
.minimum = 0, .minimum = 0,
.maximum = 255, .maximum = 64,
.step = 1, .step = 1,
#define COLOR_DEF 127 #define COLOR_DEF 32
.default_value = COLOR_DEF, .default_value = COLOR_DEF,
}, },
.set = sd_setcolors, .set = sd_setcolors,
...@@ -1132,17 +1132,18 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -1132,17 +1132,18 @@ static void setcontrast(struct gspca_dev *gspca_dev)
static void setcolors(struct gspca_dev *gspca_dev) static void setcolors(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
__u8 data; __u8 blue, red;
int colour;
colour = sd->colors - 128; if (sd->colors >= 32) {
if (colour > 0) { red = 32 + (sd->colors - 32) / 2;
data = (colour + 32) & 0x7f; /* blue */ blue = 64 - sd->colors;
reg_w1(gspca_dev, 0x06, data);
} else { } else {
data = (-colour + 32) & 0x7f; /* red */ red = sd->colors;
reg_w1(gspca_dev, 0x05, data); blue = 32 + (32 - sd->colors) / 2;
} }
reg_w1(gspca_dev, 0x05, red);
/* reg_w1(gspca_dev, 0x07, 32); */
reg_w1(gspca_dev, 0x06, blue);
} }
static void setautogain(struct gspca_dev *gspca_dev) static void setautogain(struct gspca_dev *gspca_dev)
......
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