summaryrefslogtreecommitdiff
path: root/drivers/media/video/gspca/sonixb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-13 16:05:55 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 04:54:46 -0300
commitf0baad866b3c71d448747b06b1cf6b3493d2f7ce (patch)
treeb95ef80c78794beeb9452850bafb5e3ec42a3769 /drivers/media/video/gspca/sonixb.c
parentf51a8caafedfc643b3dfa2ffdfb02da31a13db3f (diff)
[media] gspca - sonixb: Update inactive flags to reflect autogain setting
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sonixb.c')
-rw-r--r--drivers/media/video/gspca/sonixb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 13cca7a82cb4..c6c65f2da351 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -209,7 +209,7 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
.step = 1,
#define AUTOGAIN_DEF 1
.default_value = AUTOGAIN_DEF,
- .flags = 0,
+ .flags = V4L2_CTRL_FLAG_UPDATE
},
.set = sd_setautogain,
},
@@ -1008,7 +1008,8 @@ static void do_autogain(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int avg_lum = atomic_read(&sd->avg_lum);
- if (avg_lum == -1 || !sd->ctrls[AUTOGAIN].val)
+ if ((gspca_dev->ctrl_dis & (1 << AUTOGAIN)) ||
+ avg_lum == -1 || !sd->ctrls[AUTOGAIN].val)
return;
if (sd->autogain_ignore_frames > 0) {
@@ -1062,6 +1063,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->bridge = id->driver_info & 0xff;
gspca_dev->ctrl_dis = sensor_data[sd->sensor].ctrl_dis;
+#if AUTOGAIN_DEF
+ if (!(gspca_dev->ctrl_dis & (1 << AUTOGAIN)))
+ gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
+#endif
cam = &gspca_dev->cam;
cam->ctrls = sd->ctrls;
@@ -1400,6 +1405,11 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
}
}
+ if (sd->ctrls[AUTOGAIN].val)
+ gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
+ else
+ gspca_dev->ctrl_inac = 0;
+
return 0;
}