From: Hans Verkuil Date: Fri, 15 Jun 2012 08:24:26 +0000 (-0300) Subject: [media] gspca: always call v4l2_ctrl_handler_setup after start X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=82b343b231e0e29bc5d88998943cc4fd2fb61598;p=linux-beck.git [media] gspca: always call v4l2_ctrl_handler_setup after start This ensures the controls are setup correctly. Signed-off-by: Hans Verkuil Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index b4fd548ada76..7bb23a91cb05 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -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); diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c index 74a05bab9f60..b8ab612243de 100644 --- a/drivers/media/video/gspca/nw80x.c +++ b/drivers/media/video/gspca/nw80x.c @@ -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; diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 35fa141945c0..3ae5e35dce40 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -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; diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c index e934393cd806..06274871b783 100644 --- a/drivers/media/video/gspca/ov534_9.c +++ b/drivers/media/video/gspca/ov534_9.c @@ -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); diff --git a/drivers/media/video/gspca/se401.c b/drivers/media/video/gspca/se401.c index 17e7f89a1122..0b019ad72fbf 100644 --- a/drivers/media/video/gspca/se401.c +++ b/drivers/media/video/gspca/se401.c @@ -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; diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c index 315a5bf2034c..fa2075a7e486 100644 --- a/drivers/media/video/gspca/spca1528.c +++ b/drivers/media/video/gspca/spca1528.c @@ -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); diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 8e2136a2b923..6d4debdd5b5c 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c @@ -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; } diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index a1def079a0c9..fea17a8217f3 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c @@ -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) diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 168be551576e..00f4de7c6e84 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -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); diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 247365c2a519..18674570f13a 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c @@ -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 ? */ diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index 530652dcbfb2..bd3d5a615384 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -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: diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 8baa03f7c604..ef39981bfb69 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c @@ -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); diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index ee1a1c558e48..54a6cf92b745 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -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: diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c index 4fe2ab1c17d5..e074718658d8 100644 --- a/drivers/media/video/gspca/xirlink_cit.c +++ b/drivers/media/video/gspca/xirlink_cit.c @@ -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);