[media] gspca: always call v4l2_ctrl_handler_setup after start

This ensures the controls are setup correctly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans Verkuil 2012-06-15 05:24:26 -03:00 committed by Mauro Carvalho Chehab
parent ac3322b0d4
commit 82b343b231
14 changed files with 4 additions and 34 deletions

View File

@ -930,6 +930,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
goto out; goto out;
} }
gspca_dev->streaming = 1; gspca_dev->streaming = 1;
v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler);
/* some bulk transfers are started by the subdriver */ /* some bulk transfers are started by the subdriver */
if (gspca_dev->cam.bulk && gspca_dev->cam.bulk_nurbs == 0) if (gspca_dev->cam.bulk && gspca_dev->cam.bulk_nurbs == 0)
@ -2428,7 +2429,6 @@ int gspca_resume(struct usb_interface *intf)
*/ */
streaming = gspca_dev->streaming; streaming = gspca_dev->streaming;
gspca_dev->streaming = 0; gspca_dev->streaming = 0;
v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler);
if (streaming) if (streaming)
ret = gspca_init_transfer(gspca_dev); ret = gspca_init_transfer(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock); mutex_unlock(&gspca_dev->usb_lock);

View File

@ -1878,7 +1878,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break; break;
} }
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
sd->exp_too_high_cnt = 0; sd->exp_too_high_cnt = 0;
sd->exp_too_low_cnt = 0; sd->exp_too_low_cnt = 0;
return gspca_dev->usb_err; return gspca_dev->usb_err;

View File

@ -4209,8 +4209,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
set_ov_sensor_window(sd); set_ov_sensor_window(sd);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Force clear snapshot state in case the snapshot button was /* Force clear snapshot state in case the snapshot button was
pressed while we weren't streaming */ pressed while we weren't streaming */
sd->snapshot_needs_reset = 1; sd->snapshot_needs_reset = 1;

View File

@ -1235,10 +1235,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
if (sd->sensor == SENSOR_OV971x) if (sd->sensor == SENSOR_OV971x)
return gspca_dev->usb_err; return gspca_dev->usb_err;
else if (sd->sensor == SENSOR_OV562x) { if (sd->sensor == SENSOR_OV562x)
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
return gspca_dev->usb_err; return gspca_dev->usb_err;
}
switch (gspca_dev->curr_mode) { switch (gspca_dev->curr_mode) {
case QVGA_MODE: /* 320x240 */ case QVGA_MODE: /* 320x240 */
sccb_w_array(gspca_dev, ov965x_start_1_vga, sccb_w_array(gspca_dev, ov965x_start_1_vga,
@ -1283,8 +1282,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break; break;
} }
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
reg_w(gspca_dev, 0xe0, 0x00); reg_w(gspca_dev, 0xe0, 0x00);
reg_w(gspca_dev, 0xe0, 0x00); reg_w(gspca_dev, 0xe0, 0x00);
set_led(gspca_dev, 1); set_led(gspca_dev, 1);

View File

@ -373,7 +373,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
} }
se401_set_feature(gspca_dev, SE401_OPERATINGMODE, mode); se401_set_feature(gspca_dev, SE401_OPERATINGMODE, mode);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel); se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel);
sd->packet_read = 0; sd->packet_read = 0;

View File

@ -261,10 +261,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* the JPEG quality shall be 85% */ /* the JPEG quality shall be 85% */
jpeg_set_qual(sd->jpeg_hdr, 85); jpeg_set_qual(sd->jpeg_hdr, 85);
/* set the controls */
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
msleep(5);
reg_r(gspca_dev, 0x00, 0x2520, 1); reg_r(gspca_dev, 0x00, 0x2520, 1);
msleep(8); msleep(8);

View File

@ -1910,11 +1910,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
} }
reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02); reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);
/* HDG atleast the Intel CreateAndShare needs to have one of its
* brightness / contrast / color set otherwise it assumes what seems
* max contrast. Note that strange enough setting any of these is
* enough to fix the max contrast problem, to be sure we set all 3 */
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
return 0; return 0;
} }

View File

@ -679,13 +679,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_write(dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]); reg_write(dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]);
reg_write(dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]); reg_write(dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]);
ret = reg_write(dev, SPCA50X_REG_USB, return reg_write(dev, SPCA50X_REG_USB,
SPCA50X_USB_CTRL, SPCA50X_USB_CTRL,
SPCA50X_CUSB_ENABLE); SPCA50X_CUSB_ENABLE);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
return ret;
} }
static void sd_stopN(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -592,7 +592,6 @@ static int sd_start_12a(struct gspca_dev *gspca_dev)
memcpy(gspca_dev->usb_buf, Reg8391, 8); memcpy(gspca_dev->usb_buf, Reg8391, 8);
reg_w_buf(gspca_dev, 0x8391, 8); reg_w_buf(gspca_dev, 0x8391, 8);
reg_w_buf(gspca_dev, 0x8390, 8); reg_w_buf(gspca_dev, 0x8390, 8);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Led ON (bit 3 -> 0 */ /* Led ON (bit 3 -> 0 */
reg_w_val(gspca_dev->dev, 0x8114, 0x00); reg_w_val(gspca_dev->dev, 0x8114, 0x00);

View File

@ -287,7 +287,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x0640, 0); reg_w(gspca_dev, 0x0640, 0);
reg_w(gspca_dev, 0x0650, 0); reg_w(gspca_dev, 0x0650, 0);
reg_w(gspca_dev, 0x0660, 0); reg_w(gspca_dev, 0x0660, 0);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
set_par(gspca_dev, 0x09800000); /* Red ? */ set_par(gspca_dev, 0x09800000); /* Red ? */
set_par(gspca_dev, 0x0a800000); /* Green ? */ set_par(gspca_dev, 0x0a800000); /* Green ? */
set_par(gspca_dev, 0x0b800000); /* Blue ? */ set_par(gspca_dev, 0x0b800000); /* Blue ? */

View File

@ -558,8 +558,6 @@ static void init_ctl_reg(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int pollreg = 1; int pollreg = 1;
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
switch (sd->bridge) { switch (sd->bridge) {
case BRIDGE_SPCA504: case BRIDGE_SPCA504:
case BRIDGE_SPCA504C: case BRIDGE_SPCA504C:

View File

@ -242,8 +242,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
tv_8532_setReg(gspca_dev); tv_8532_setReg(gspca_dev);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/************************************************/ /************************************************/
reg_w1(gspca_dev, R31_UPD, 0x01); /* update registers */ reg_w1(gspca_dev, R31_UPD, 0x01); /* update registers */
msleep(200); msleep(200);

View File

@ -3543,7 +3543,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* case SENSOR_POxxxx: */ /* case SENSOR_POxxxx: */
usb_exchange(gspca_dev, poxxxx_init_common); usb_exchange(gspca_dev, poxxxx_init_common);
setgamma(gspca_dev); setgamma(gspca_dev);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
usb_exchange(gspca_dev, poxxxx_init_start_3); usb_exchange(gspca_dev, poxxxx_init_start_3);
if (mode) if (mode)
init = poxxxx_initQVGA; init = poxxxx_initQVGA;
@ -3576,7 +3575,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break; break;
} }
msleep(100); msleep(100);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
} }
switch (sd->sensor) { switch (sd->sensor) {
case SENSOR_OV7670: case SENSOR_OV7670:

View File

@ -2620,8 +2620,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break; break;
} }
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Program max isoc packet size */ /* Program max isoc packet size */
cit_write_reg(gspca_dev, packet_size >> 8, 0x0106); cit_write_reg(gspca_dev, packet_size >> 8, 0x0106);
cit_write_reg(gspca_dev, packet_size & 0xff, 0x0107); cit_write_reg(gspca_dev, packet_size & 0xff, 0x0107);