Commit 82b343b2 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] gspca: always call v4l2_ctrl_handler_setup after start

This ensures the controls are setup correctly.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ac3322b0
......@@ -930,6 +930,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
goto out;
}
gspca_dev->streaming = 1;
v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler);
/* some bulk transfers are started by the subdriver */
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;
gspca_dev->streaming = 0;
v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler);
if (streaming)
ret = gspca_init_transfer(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
......
......@@ -1878,7 +1878,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break;
}
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
sd->exp_too_high_cnt = 0;
sd->exp_too_low_cnt = 0;
return gspca_dev->usb_err;
......
......@@ -4209,8 +4209,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
set_ov_sensor_window(sd);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Force clear snapshot state in case the snapshot button was
pressed while we weren't streaming */
sd->snapshot_needs_reset = 1;
......
......@@ -1235,10 +1235,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
if (sd->sensor == SENSOR_OV971x)
return gspca_dev->usb_err;
else if (sd->sensor == SENSOR_OV562x) {
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
if (sd->sensor == SENSOR_OV562x)
return gspca_dev->usb_err;
}
switch (gspca_dev->curr_mode) {
case QVGA_MODE: /* 320x240 */
sccb_w_array(gspca_dev, ov965x_start_1_vga,
......@@ -1283,8 +1282,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break;
}
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
reg_w(gspca_dev, 0xe0, 0x00);
reg_w(gspca_dev, 0xe0, 0x00);
set_led(gspca_dev, 1);
......
......@@ -373,7 +373,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
}
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);
sd->packet_read = 0;
......
......@@ -261,10 +261,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* the JPEG quality shall be 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);
msleep(8);
......
......@@ -1910,11 +1910,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
}
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;
}
......
......@@ -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, 0x07, mode_tb[mode][2]);
ret = reg_write(dev, SPCA50X_REG_USB,
return reg_write(dev, SPCA50X_REG_USB,
SPCA50X_USB_CTRL,
SPCA50X_CUSB_ENABLE);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
return ret;
}
static void sd_stopN(struct gspca_dev *gspca_dev)
......
......@@ -592,7 +592,6 @@ static int sd_start_12a(struct gspca_dev *gspca_dev)
memcpy(gspca_dev->usb_buf, Reg8391, 8);
reg_w_buf(gspca_dev, 0x8391, 8);
reg_w_buf(gspca_dev, 0x8390, 8);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Led ON (bit 3 -> 0 */
reg_w_val(gspca_dev->dev, 0x8114, 0x00);
......
......@@ -287,7 +287,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x0640, 0);
reg_w(gspca_dev, 0x0650, 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, 0x0a800000); /* Green ? */
set_par(gspca_dev, 0x0b800000); /* Blue ? */
......
......@@ -558,8 +558,6 @@ static void init_ctl_reg(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int pollreg = 1;
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
switch (sd->bridge) {
case BRIDGE_SPCA504:
case BRIDGE_SPCA504C:
......
......@@ -242,8 +242,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
tv_8532_setReg(gspca_dev);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/************************************************/
reg_w1(gspca_dev, R31_UPD, 0x01); /* update registers */
msleep(200);
......
......@@ -3543,7 +3543,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* case SENSOR_POxxxx: */
usb_exchange(gspca_dev, poxxxx_init_common);
setgamma(gspca_dev);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
usb_exchange(gspca_dev, poxxxx_init_start_3);
if (mode)
init = poxxxx_initQVGA;
......@@ -3576,7 +3575,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break;
}
msleep(100);
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
}
switch (sd->sensor) {
case SENSOR_OV7670:
......
......@@ -2620,8 +2620,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
break;
}
v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler);
/* Program max isoc packet size */
cit_write_reg(gspca_dev, packet_size >> 8, 0x0106);
cit_write_reg(gspca_dev, packet_size & 0xff, 0x0107);
......
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