Commit f0baad86 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

[media] gspca - sonixb: Update inactive flags to reflect autogain setting

Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f51a8caa
...@@ -209,7 +209,7 @@ static const struct ctrl sd_ctrls[NCTRLS] = { ...@@ -209,7 +209,7 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
.step = 1, .step = 1,
#define AUTOGAIN_DEF 1 #define AUTOGAIN_DEF 1
.default_value = AUTOGAIN_DEF, .default_value = AUTOGAIN_DEF,
.flags = 0, .flags = V4L2_CTRL_FLAG_UPDATE
}, },
.set = sd_setautogain, .set = sd_setautogain,
}, },
...@@ -1008,7 +1008,8 @@ static void do_autogain(struct gspca_dev *gspca_dev) ...@@ -1008,7 +1008,8 @@ static void do_autogain(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int avg_lum = atomic_read(&sd->avg_lum); 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; return;
if (sd->autogain_ignore_frames > 0) { if (sd->autogain_ignore_frames > 0) {
...@@ -1062,6 +1063,10 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -1062,6 +1063,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->bridge = id->driver_info & 0xff; sd->bridge = id->driver_info & 0xff;
gspca_dev->ctrl_dis = sensor_data[sd->sensor].ctrl_dis; 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 = &gspca_dev->cam;
cam->ctrls = sd->ctrls; cam->ctrls = sd->ctrls;
...@@ -1400,6 +1405,11 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) ...@@ -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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment