summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/sonixj.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-08-19 12:25:03 +0200
committerJean-Francois Moine <moinejf@free.fr>2008-08-19 12:25:03 +0200
commit5e7d387f09334ce7b85f97fc8317e8e0a135865c (patch)
treeb8511f6d42bb75ddfa416bb350fd9c32bb5b958c /linux/drivers/media/video/gspca/sonixj.c
parentdbcc686f4d8690159db7c5bb13fc08be07a4bf91 (diff)
downloadmediapointer-dvb-s2-5e7d387f09334ce7b85f97fc8317e8e0a135865c.tar.gz
mediapointer-dvb-s2-5e7d387f09334ce7b85f97fc8317e8e0a135865c.tar.bz2
gspca: Bad color control again in sonixj.
From: Jean-Francois Moine <moinejf@free.fr> Priority: high Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux/drivers/media/video/gspca/sonixj.c')
-rw-r--r--linux/drivers/media/video/gspca/sonixj.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c
index 137a609cb..6c7ea00e4 100644
--- a/linux/drivers/media/video/gspca/sonixj.c
+++ b/linux/drivers/media/video/gspca/sonixj.c
@@ -108,9 +108,9 @@ static struct ctrl sd_ctrls[] = {
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color",
.minimum = 0,
- .maximum = 255,
+ .maximum = 64,
.step = 1,
-#define COLOR_DEF 127
+#define COLOR_DEF 32
.default_value = COLOR_DEF,
},
.set = sd_setcolors,
@@ -1167,17 +1167,18 @@ static void setcontrast(struct gspca_dev *gspca_dev)
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- __u8 data;
- int colour;
+ __u8 blue, red;
- colour = sd->colors - 128;
- if (colour > 0) {
- data = (colour + 32) & 0x7f; /* blue */
- reg_w1(gspca_dev, 0x06, data);
+ if (sd->colors >= 32) {
+ red = 32 + (sd->colors - 32) / 2;
+ blue = 64 - sd->colors;
} else {
- data = (-colour + 32) & 0x7f; /* red */
- reg_w1(gspca_dev, 0x05, data);
+ red = sd->colors;
+ 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)