aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/sonixj.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 6673a3edf190..19c9791309e1 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -108,9 +108,9 @@ static struct ctrl sd_ctrls[] = {
108 .type = V4L2_CTRL_TYPE_INTEGER, 108 .type = V4L2_CTRL_TYPE_INTEGER,
109 .name = "Color", 109 .name = "Color",
110 .minimum = 0, 110 .minimum = 0,
111 .maximum = 255, 111 .maximum = 64,
112 .step = 1, 112 .step = 1,
113#define COLOR_DEF 127 113#define COLOR_DEF 32
114 .default_value = COLOR_DEF, 114 .default_value = COLOR_DEF,
115 }, 115 },
116 .set = sd_setcolors, 116 .set = sd_setcolors,
@@ -1132,17 +1132,18 @@ static void setcontrast(struct gspca_dev *gspca_dev)
1132static void setcolors(struct gspca_dev *gspca_dev) 1132static void setcolors(struct gspca_dev *gspca_dev)
1133{ 1133{
1134 struct sd *sd = (struct sd *) gspca_dev; 1134 struct sd *sd = (struct sd *) gspca_dev;
1135 __u8 data; 1135 __u8 blue, red;
1136 int colour;
1137 1136
1138 colour = sd->colors - 128; 1137 if (sd->colors >= 32) {
1139 if (colour > 0) { 1138 red = 32 + (sd->colors - 32) / 2;
1140 data = (colour + 32) & 0x7f; /* blue */ 1139 blue = 64 - sd->colors;
1141 reg_w1(gspca_dev, 0x06, data);
1142 } else { 1140 } else {
1143 data = (-colour + 32) & 0x7f; /* red */ 1141 red = sd->colors;
1144 reg_w1(gspca_dev, 0x05, data); 1142 blue = 32 + (32 - sd->colors) / 2;
1145 } 1143 }
1144 reg_w1(gspca_dev, 0x05, red);
1145/* reg_w1(gspca_dev, 0x07, 32); */
1146 reg_w1(gspca_dev, 0x06, blue);
1146} 1147}
1147 1148
1148static void setautogain(struct gspca_dev *gspca_dev) 1149static void setautogain(struct gspca_dev *gspca_dev)