提交 2d19a2c1 编写于 作者: J Jean-Francois Moine 提交者: Mauro Carvalho Chehab

V4L/DVB (13449): gspca - ov534: The AWB control works only when autogain is set.

Signed-off-by: NJean-Francois Moine <moinejf@free.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 4af85668
...@@ -101,7 +101,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); ...@@ -101,7 +101,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls_ov772x[] = { static struct ctrl sd_ctrls_ov772x[] = {
{ { /* 0 */
{ {
.id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -115,7 +115,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -115,7 +115,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setbrightness, .set = sd_setbrightness,
.get = sd_getbrightness, .get = sd_getbrightness,
}, },
{ { /* 1 */
{ {
.id = V4L2_CID_CONTRAST, .id = V4L2_CID_CONTRAST,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -129,7 +129,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -129,7 +129,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setcontrast, .set = sd_setcontrast,
.get = sd_getcontrast, .get = sd_getcontrast,
}, },
{ { /* 2 */
{ {
.id = V4L2_CID_GAIN, .id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -143,7 +143,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -143,7 +143,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setgain, .set = sd_setgain,
.get = sd_getgain, .get = sd_getgain,
}, },
{ { /* 3 */
{ {
.id = V4L2_CID_EXPOSURE, .id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -157,7 +157,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -157,7 +157,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setexposure, .set = sd_setexposure,
.get = sd_getexposure, .get = sd_getexposure,
}, },
{ { /* 4 */
{ {
.id = V4L2_CID_RED_BALANCE, .id = V4L2_CID_RED_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -171,7 +171,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -171,7 +171,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setredblc, .set = sd_setredblc,
.get = sd_getredblc, .get = sd_getredblc,
}, },
{ { /* 5 */
{ {
.id = V4L2_CID_BLUE_BALANCE, .id = V4L2_CID_BLUE_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -185,7 +185,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -185,7 +185,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setblueblc, .set = sd_setblueblc,
.get = sd_getblueblc, .get = sd_getblueblc,
}, },
{ { /* 6 */
{ {
.id = V4L2_CID_HUE, .id = V4L2_CID_HUE,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -199,7 +199,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -199,7 +199,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_sethue, .set = sd_sethue,
.get = sd_gethue, .get = sd_gethue,
}, },
{ { /* 7 */
{ {
.id = V4L2_CID_AUTOGAIN, .id = V4L2_CID_AUTOGAIN,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -213,7 +213,8 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -213,7 +213,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setautogain, .set = sd_setautogain,
.get = sd_getautogain, .get = sd_getautogain,
}, },
{ #define AWB_IDX 8
{ /* 8 */
{ {
.id = V4L2_CID_AUTO_WHITE_BALANCE, .id = V4L2_CID_AUTO_WHITE_BALANCE,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -227,7 +228,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -227,7 +228,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setawb, .set = sd_setawb,
.get = sd_getawb, .get = sd_getawb,
}, },
{ { /* 9 */
{ {
.id = V4L2_CID_SHARPNESS, .id = V4L2_CID_SHARPNESS,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -241,7 +242,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -241,7 +242,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_setsharpness, .set = sd_setsharpness,
.get = sd_getsharpness, .get = sd_getsharpness,
}, },
{ { /* 10 */
{ {
.id = V4L2_CID_HFLIP, .id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -255,7 +256,7 @@ static struct ctrl sd_ctrls_ov772x[] = { ...@@ -255,7 +256,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
.set = sd_sethflip, .set = sd_sethflip,
.get = sd_gethflip, .get = sd_gethflip,
}, },
{ { /* 11 */
{ {
.id = V4L2_CID_VFLIP, .id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -1237,6 +1238,8 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -1237,6 +1238,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->hue = HUE_DEF; sd->hue = HUE_DEF;
#if AUTOGAIN_DEF != 0 #if AUTOGAIN_DEF != 0
sd->autogain = AUTOGAIN_DEF; sd->autogain = AUTOGAIN_DEF;
#else
gspca_dev->ctrl_inac |= (1 << AWB_IDX);
#endif #endif
#if AWB_DEF != 0 #if AWB_DEF != 0
sd->awb = AWB_DEF sd->awb = AWB_DEF
...@@ -1606,6 +1609,13 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) ...@@ -1606,6 +1609,13 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val; sd->autogain = val;
/* the auto white balance control works only when auto gain is set */
if (val)
gspca_dev->ctrl_inac &= ~(1 << AWB_IDX);
else
gspca_dev->ctrl_inac |= (1 << AWB_IDX);
if (gspca_dev->streaming) if (gspca_dev->streaming)
setautogain(gspca_dev); setautogain(gspca_dev);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册