V4L/DVB: gspca - vc032x: Do sensor probe at resume time
authorJean-François Moine <moinejf@free.fr>
Mon, 26 Jul 2010 10:59:23 +0000 (07:59 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 9 Aug 2010 02:42:53 +0000 (23:42 -0300)
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/vc032x.c

index d450a95480bdadde4a98f3751ece620637677b33..48a8af3078a3d7e24fc96101b1c18809c535e647 100644 (file)
@@ -3389,6 +3389,33 @@ static void usb_exchange(struct gspca_dev *gspca_dev,
 /* this function is called at probe time */
 static int sd_config(struct gspca_dev *gspca_dev,
                        const struct usb_device_id *id)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->bridge = id->driver_info >> 8;
+       sd->flags = id->driver_info & 0xff;
+
+       if (id->idVendor == 0x046d &&
+           (id->idProduct == 0x0892 || id->idProduct == 0x0896))
+               sd->sensor = SENSOR_POxxxx;     /* no probe */
+
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+       sd->colors = COLOR_DEF;
+       sd->hflip = HFLIP_DEF;
+       sd->vflip = VFLIP_DEF;
+       sd->lightfreq = FREQ_DEF;
+       sd->sharpness = SHARPNESS_DEF;
+       sd->gain = GAIN_DEF;
+       sd->exposure = EXPOSURE_DEF;
+       sd->autogain = AUTOGAIN_DEF;
+       sd->backlight = BACKLIGHT_DEF;
+
+       return 0;
+}
+
+/* this function is called at probe and resume time */
+static int sd_init(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
@@ -3406,14 +3433,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
                128,            /* POxxxx 9 */
        };
 
-       cam = &gspca_dev->cam;
-       sd->bridge = id->driver_info >> 8;
-       sd->flags = id->driver_info & 0xff;
-       if (id->idVendor == 0x046d &&
-           (id->idProduct == 0x0892 || id->idProduct == 0x0896))
-               sensor = SENSOR_POxxxx;
-       else
+       if (sd->sensor != SENSOR_POxxxx)
                sensor = vc032x_probe_sensor(gspca_dev);
+       else
+               sensor = sd->sensor;
+
        switch (sensor) {
        case -1:
                PDEBUG(D_PROBE, "Unknown sensor...");
@@ -3452,6 +3476,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
        sd->sensor = sensor;
 
+       cam = &gspca_dev->cam;
        if (sd->bridge == BRIDGE_VC0321) {
                cam->cam_mode = vc0321_mode;
                cam->nmodes = ARRAY_SIZE(vc0321_mode);
@@ -3480,32 +3505,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
                }
        }
        cam->npkt = npkt[sd->sensor];
-
-       sd->brightness = BRIGHTNESS_DEF;
-       sd->contrast = CONTRAST_DEF;
-       sd->colors = COLOR_DEF;
-       sd->hflip = HFLIP_DEF;
-       sd->vflip = VFLIP_DEF;
-       sd->lightfreq = FREQ_DEF;
-       sd->sharpness = SHARPNESS_DEF;
-       sd->gain = GAIN_DEF;
-       sd->exposure = EXPOSURE_DEF;
-       sd->autogain = AUTOGAIN_DEF;
-       sd->backlight = BACKLIGHT_DEF;
-
        gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
 
        if (sd->sensor == SENSOR_OV7670)
                sd->flags |= FL_HFLIP | FL_VFLIP;
 
-       return 0;
-}
-
-/* this function is called at probe and resume time */
-static int sd_init(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
        if (sd->bridge == BRIDGE_VC0321) {
                reg_r(gspca_dev, 0x8a, 0, 3);
                reg_w(gspca_dev, 0x87, 0x00, 0x0f0f);