aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-11-12 14:15:44 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:58 -0500
commit2d19a2c1186d86e38b51ef59e4b9678f8ad7acf4 (patch)
treefa12dba7ca4f014cec4b49504286229eaaf8568b
parent4af85668588e249d98957a41030c3a2d2acc87e5 (diff)
V4L/DVB (13449): gspca - ov534: The AWB control works only when autogain is set.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/gspca/ov534.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index f2f844af54c0..26d98b1312e0 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -101,7 +101,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
101static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); 101static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
102 102
103static struct ctrl sd_ctrls_ov772x[] = { 103static struct ctrl sd_ctrls_ov772x[] = {
104 { 104 { /* 0 */
105 { 105 {
106 .id = V4L2_CID_BRIGHTNESS, 106 .id = V4L2_CID_BRIGHTNESS,
107 .type = V4L2_CTRL_TYPE_INTEGER, 107 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -115,7 +115,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
115 .set = sd_setbrightness, 115 .set = sd_setbrightness,
116 .get = sd_getbrightness, 116 .get = sd_getbrightness,
117 }, 117 },
118 { 118 { /* 1 */
119 { 119 {
120 .id = V4L2_CID_CONTRAST, 120 .id = V4L2_CID_CONTRAST,
121 .type = V4L2_CTRL_TYPE_INTEGER, 121 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -129,7 +129,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
129 .set = sd_setcontrast, 129 .set = sd_setcontrast,
130 .get = sd_getcontrast, 130 .get = sd_getcontrast,
131 }, 131 },
132 { 132 { /* 2 */
133 { 133 {
134 .id = V4L2_CID_GAIN, 134 .id = V4L2_CID_GAIN,
135 .type = V4L2_CTRL_TYPE_INTEGER, 135 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -143,7 +143,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
143 .set = sd_setgain, 143 .set = sd_setgain,
144 .get = sd_getgain, 144 .get = sd_getgain,
145 }, 145 },
146 { 146 { /* 3 */
147 { 147 {
148 .id = V4L2_CID_EXPOSURE, 148 .id = V4L2_CID_EXPOSURE,
149 .type = V4L2_CTRL_TYPE_INTEGER, 149 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -157,7 +157,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
157 .set = sd_setexposure, 157 .set = sd_setexposure,
158 .get = sd_getexposure, 158 .get = sd_getexposure,
159 }, 159 },
160 { 160 { /* 4 */
161 { 161 {
162 .id = V4L2_CID_RED_BALANCE, 162 .id = V4L2_CID_RED_BALANCE,
163 .type = V4L2_CTRL_TYPE_INTEGER, 163 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -171,7 +171,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
171 .set = sd_setredblc, 171 .set = sd_setredblc,
172 .get = sd_getredblc, 172 .get = sd_getredblc,
173 }, 173 },
174 { 174 { /* 5 */
175 { 175 {
176 .id = V4L2_CID_BLUE_BALANCE, 176 .id = V4L2_CID_BLUE_BALANCE,
177 .type = V4L2_CTRL_TYPE_INTEGER, 177 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -185,7 +185,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
185 .set = sd_setblueblc, 185 .set = sd_setblueblc,
186 .get = sd_getblueblc, 186 .get = sd_getblueblc,
187 }, 187 },
188 { 188 { /* 6 */
189 { 189 {
190 .id = V4L2_CID_HUE, 190 .id = V4L2_CID_HUE,
191 .type = V4L2_CTRL_TYPE_INTEGER, 191 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -199,7 +199,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
199 .set = sd_sethue, 199 .set = sd_sethue,
200 .get = sd_gethue, 200 .get = sd_gethue,
201 }, 201 },
202 { 202 { /* 7 */
203 { 203 {
204 .id = V4L2_CID_AUTOGAIN, 204 .id = V4L2_CID_AUTOGAIN,
205 .type = V4L2_CTRL_TYPE_BOOLEAN, 205 .type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -213,7 +213,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
213 .set = sd_setautogain, 213 .set = sd_setautogain,
214 .get = sd_getautogain, 214 .get = sd_getautogain,
215 }, 215 },
216 { 216#define AWB_IDX 8
217 { /* 8 */
217 { 218 {
218 .id = V4L2_CID_AUTO_WHITE_BALANCE, 219 .id = V4L2_CID_AUTO_WHITE_BALANCE,
219 .type = V4L2_CTRL_TYPE_BOOLEAN, 220 .type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -227,7 +228,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
227 .set = sd_setawb, 228 .set = sd_setawb,
228 .get = sd_getawb, 229 .get = sd_getawb,
229 }, 230 },
230 { 231 { /* 9 */
231 { 232 {
232 .id = V4L2_CID_SHARPNESS, 233 .id = V4L2_CID_SHARPNESS,
233 .type = V4L2_CTRL_TYPE_INTEGER, 234 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -241,7 +242,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
241 .set = sd_setsharpness, 242 .set = sd_setsharpness,
242 .get = sd_getsharpness, 243 .get = sd_getsharpness,
243 }, 244 },
244 { 245 { /* 10 */
245 { 246 {
246 .id = V4L2_CID_HFLIP, 247 .id = V4L2_CID_HFLIP,
247 .type = V4L2_CTRL_TYPE_BOOLEAN, 248 .type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -255,7 +256,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
255 .set = sd_sethflip, 256 .set = sd_sethflip,
256 .get = sd_gethflip, 257 .get = sd_gethflip,
257 }, 258 },
258 { 259 { /* 11 */
259 { 260 {
260 .id = V4L2_CID_VFLIP, 261 .id = V4L2_CID_VFLIP,
261 .type = V4L2_CTRL_TYPE_BOOLEAN, 262 .type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -1237,6 +1238,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
1237 sd->hue = HUE_DEF; 1238 sd->hue = HUE_DEF;
1238#if AUTOGAIN_DEF != 0 1239#if AUTOGAIN_DEF != 0
1239 sd->autogain = AUTOGAIN_DEF; 1240 sd->autogain = AUTOGAIN_DEF;
1241#else
1242 gspca_dev->ctrl_inac |= (1 << AWB_IDX);
1240#endif 1243#endif
1241#if AWB_DEF != 0 1244#if AWB_DEF != 0
1242 sd->awb = AWB_DEF 1245 sd->awb = AWB_DEF
@@ -1606,6 +1609,13 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
1606 struct sd *sd = (struct sd *) gspca_dev; 1609 struct sd *sd = (struct sd *) gspca_dev;
1607 1610
1608 sd->autogain = val; 1611 sd->autogain = val;
1612
1613 /* the auto white balance control works only when auto gain is set */
1614 if (val)
1615 gspca_dev->ctrl_inac &= ~(1 << AWB_IDX);
1616 else
1617 gspca_dev->ctrl_inac |= (1 << AWB_IDX);
1618
1609 if (gspca_dev->streaming) 1619 if (gspca_dev->streaming)
1610 setautogain(gspca_dev); 1620 setautogain(gspca_dev);
1611 return 0; 1621 return 0;