From 930806cb92325e43889b320ae2e705af774742ff Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 18 May 2012 06:45:30 -0300 Subject: [media] vc032x: convert to the control framework Signed-off-by: Hans Verkuil Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/vc032x.c | 695 +++++++++---------------------------- 1 file changed, 158 insertions(+), 537 deletions(-) (limited to 'drivers/media/video/gspca/vc032x.c') diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 208f6b2d512a..ee1a1c558e48 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -33,18 +33,10 @@ MODULE_LICENSE("GPL"); /* specific webcam descriptor */ struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ - - u8 brightness; - u8 contrast; - u8 colors; - u8 hflip; - u8 vflip; - u8 lightfreq; - s8 sharpness; - u16 exposure; - u8 gain; - u8 autogain; - u8 backlight; + struct { /* hvflip cluster */ + struct v4l2_ctrl *hflip; + struct v4l2_ctrl *vflip; + }; u8 image_offset; @@ -73,252 +65,6 @@ enum sensors { NSENSORS }; -/* V4L2 controls supported by the driver */ -static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); -static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val); - -static const struct ctrl sd_ctrls[] = { -#define BRIGHTNESS_IDX 0 - { - { - .id = V4L2_CID_BRIGHTNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Brightness", - .minimum = 0, - .maximum = 255, - .step = 1, -#define BRIGHTNESS_DEF 128 - .default_value = BRIGHTNESS_DEF, - }, - .set = sd_setbrightness, - .get = sd_getbrightness, - }, -#define CONTRAST_IDX 1 - { - { - .id = V4L2_CID_CONTRAST, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contrast", - .minimum = 0, - .maximum = 255, - .step = 1, -#define CONTRAST_DEF 127 - .default_value = CONTRAST_DEF, - }, - .set = sd_setcontrast, - .get = sd_getcontrast, - }, -#define COLORS_IDX 2 - { - { - .id = V4L2_CID_SATURATION, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Saturation", - .minimum = 1, - .maximum = 127, - .step = 1, -#define COLOR_DEF 63 - .default_value = COLOR_DEF, - }, - .set = sd_setcolors, - .get = sd_getcolors, - }, -/* next 2 controls work with some sensors only */ -#define HFLIP_IDX 3 - { - { - .id = V4L2_CID_HFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Mirror", - .minimum = 0, - .maximum = 1, - .step = 1, -#define HFLIP_DEF 0 - .default_value = HFLIP_DEF, - }, - .set = sd_sethflip, - .get = sd_gethflip, - }, -#define VFLIP_IDX 4 - { - { - .id = V4L2_CID_VFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Vflip", - .minimum = 0, - .maximum = 1, - .step = 1, -#define VFLIP_DEF 0 - .default_value = VFLIP_DEF, - }, - .set = sd_setvflip, - .get = sd_getvflip, - }, -#define LIGHTFREQ_IDX 5 - { - { - .id = V4L2_CID_POWER_LINE_FREQUENCY, - .type = V4L2_CTRL_TYPE_MENU, - .name = "Light frequency filter", - .minimum = 0, - .maximum = 2, /* 0: No, 1: 50Hz, 2:60Hz */ - .step = 1, -#define FREQ_DEF 1 - .default_value = FREQ_DEF, - }, - .set = sd_setfreq, - .get = sd_getfreq, - }, -#define SHARPNESS_IDX 6 - { - { - .id = V4L2_CID_SHARPNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Sharpness", - .minimum = -1, - .maximum = 2, - .step = 1, -#define SHARPNESS_DEF -1 - .default_value = SHARPNESS_DEF, - }, - .set = sd_setsharpness, - .get = sd_getsharpness, - }, -#define GAIN_IDX 7 - { - { - .id = V4L2_CID_GAIN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Gain", - .minimum = 0, - .maximum = 78, - .step = 1, -#define GAIN_DEF 0 - .default_value = GAIN_DEF, - }, - .set = sd_setgain, - .get = sd_getgain, - }, -#define EXPOSURE_IDX 8 - { - { - .id = V4L2_CID_EXPOSURE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Exposure", -#define EXPOSURE_DEF 450 - .minimum = 0, - .maximum = 4095, - .step = 1, - .default_value = EXPOSURE_DEF, - }, - .set = sd_setexposure, - .get = sd_getexposure, - }, -#define AUTOGAIN_IDX 9 - { - { - .id = V4L2_CID_AUTOGAIN, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Automatic Gain and Exposure", - .minimum = 0, - .maximum = 1, - .step = 1, -#define AUTOGAIN_DEF 1 - .default_value = AUTOGAIN_DEF, - }, - .set = sd_setautogain, - .get = sd_getautogain, - }, -#define BACKLIGHT_IDX 10 - { - { - .id = V4L2_CID_BACKLIGHT_COMPENSATION, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Backlight Compensation", - .minimum = 0, - .maximum = 15, - .step = 1, -#define BACKLIGHT_DEF 15 - .default_value = BACKLIGHT_DEF, - }, - .set = sd_setbacklight, - .get = sd_getbacklight, - }, -}; - -/* table of the disabled controls */ -static u32 ctrl_dis[NSENSORS] = { - [SENSOR_HV7131R] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) - | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_MI0360] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) - | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_MI1310_SOC] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_MI1320] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_MI1320_SOC] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_OV7660] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_OV7670] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_PO1200] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << LIGHTFREQ_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_PO3130NC] = - (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) - | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) - | (1 << SHARPNESS_IDX) - | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) - | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), - [SENSOR_POxxxx] = - (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX), -}; static const struct v4l2_pix_format vc0321_mode[] = { {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE, @@ -3405,18 +3151,6 @@ static int sd_config(struct gspca_dev *gspca_dev, (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; } @@ -3512,7 +3246,6 @@ static int sd_init(struct gspca_dev *gspca_dev) } } cam->npkt = npkt[sd->sensor]; - gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; if (sd->sensor == SENSOR_OV7670) sd->flags |= FL_HFLIP | FL_VFLIP; @@ -3534,14 +3267,11 @@ static int sd_init(struct gspca_dev *gspca_dev) return gspca_dev->usb_err; } -static void setbrightness(struct gspca_dev *gspca_dev) +static void setbrightness(struct gspca_dev *gspca_dev, s32 val) { - struct sd *sd = (struct sd *) gspca_dev; u8 data; - if (gspca_dev->ctrl_dis & (1 << BRIGHTNESS_IDX)) - return; - data = sd->brightness; + data = val; if (data >= 0x80) data &= 0x7f; else @@ -3549,36 +3279,27 @@ static void setbrightness(struct gspca_dev *gspca_dev) i2c_write(gspca_dev, 0x98, &data, 1); } -static void setcontrast(struct gspca_dev *gspca_dev) +static void setcontrast(struct gspca_dev *gspca_dev, u8 val) { - struct sd *sd = (struct sd *) gspca_dev; - - if (gspca_dev->ctrl_dis & (1 << CONTRAST_IDX)) - return; - i2c_write(gspca_dev, 0x99, &sd->contrast, 1); + i2c_write(gspca_dev, 0x99, &val, 1); } -static void setcolors(struct gspca_dev *gspca_dev) +static void setcolors(struct gspca_dev *gspca_dev, u8 val) { - struct sd *sd = (struct sd *) gspca_dev; u8 data; - if (gspca_dev->ctrl_dis & (1 << COLORS_IDX)) - return; - data = sd->colors - (sd->colors >> 3) - 1; + data = val - (val >> 3) - 1; i2c_write(gspca_dev, 0x94, &data, 1); - i2c_write(gspca_dev, 0x95, &sd->colors, 1); + i2c_write(gspca_dev, 0x95, &val, 1); } -static void sethvflip(struct gspca_dev *gspca_dev) +static void sethvflip(struct gspca_dev *gspca_dev, bool hflip, bool vflip) { struct sd *sd = (struct sd *) gspca_dev; - u8 data[2], hflip, vflip; + u8 data[2]; - hflip = sd->hflip; if (sd->flags & FL_HFLIP) hflip = !hflip; - vflip = sd->vflip; if (sd->flags & FL_VFLIP) vflip = !vflip; switch (sd->sensor) { @@ -3610,7 +3331,7 @@ static void sethvflip(struct gspca_dev *gspca_dev) } } -static void setlightfreq(struct gspca_dev *gspca_dev) +static void setlightfreq(struct gspca_dev *gspca_dev, s32 val) { struct sd *sd = (struct sd *) gspca_dev; static const u8 (*ov7660_freq_tb[3])[4] = @@ -3618,10 +3339,10 @@ static void setlightfreq(struct gspca_dev *gspca_dev) if (sd->sensor != SENSOR_OV7660) return; - usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]); + usb_exchange(gspca_dev, ov7660_freq_tb[val]); } -static void setsharpness(struct gspca_dev *gspca_dev) +static void setsharpness(struct gspca_dev *gspca_dev, s32 val) { struct sd *sd = (struct sd *) gspca_dev; u8 data; @@ -3630,51 +3351,41 @@ static void setsharpness(struct gspca_dev *gspca_dev) case SENSOR_PO1200: data = 0; i2c_write(gspca_dev, 0x03, &data, 1); - if (sd->sharpness < 0) + if (val < 0) data = 0x6a; else - data = 0xb5 + sd->sharpness * 3; + data = 0xb5 + val * 3; i2c_write(gspca_dev, 0x61, &data, 1); break; case SENSOR_POxxxx: - if (sd->sharpness < 0) + if (val < 0) data = 0x7e; /* def = max */ else - data = 0x60 + sd->sharpness * 0x0f; + data = 0x60 + val * 0x0f; i2c_write(gspca_dev, 0x59, &data, 1); break; } } -static void setgain(struct gspca_dev *gspca_dev) +static void setgain(struct gspca_dev *gspca_dev, u8 val) { - struct sd *sd = (struct sd *) gspca_dev; - - if (gspca_dev->ctrl_dis & (1 << GAIN_IDX)) - return; - i2c_write(gspca_dev, 0x15, &sd->gain, 1); + i2c_write(gspca_dev, 0x15, &val, 1); } -static void setexposure(struct gspca_dev *gspca_dev) +static void setexposure(struct gspca_dev *gspca_dev, s32 val) { - struct sd *sd = (struct sd *) gspca_dev; u8 data; - if (gspca_dev->ctrl_dis & (1 << EXPOSURE_IDX)) - return; - data = sd->exposure >> 8; + data = val >> 8; i2c_write(gspca_dev, 0x1a, &data, 1); - data = sd->exposure; + data = val; i2c_write(gspca_dev, 0x1b, &data, 1); } -static void setautogain(struct gspca_dev *gspca_dev) +static void setautogain(struct gspca_dev *gspca_dev, s32 val) { - struct sd *sd = (struct sd *) gspca_dev; static const u8 data[2] = {0x28, 0x3c}; - if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) - return; - i2c_write(gspca_dev, 0xd1, &data[sd->autogain], 1); + i2c_write(gspca_dev, 0xd1, &data[val], 1); } static void setgamma(struct gspca_dev *gspca_dev) @@ -3683,30 +3394,29 @@ static void setgamma(struct gspca_dev *gspca_dev) usb_exchange(gspca_dev, poxxxx_gamma); } -static void setbacklight(struct gspca_dev *gspca_dev) +static void setbacklight(struct gspca_dev *gspca_dev, s32 val) { - struct sd *sd = (struct sd *) gspca_dev; u16 v; u8 data; - data = (sd->backlight << 4) | 0x0f; + data = (val << 4) | 0x0f; i2c_write(gspca_dev, 0xaa, &data, 1); - v = 613 + 12 * sd->backlight; + v = 613 + 12 * val; data = v >> 8; i2c_write(gspca_dev, 0xc4, &data, 1); data = v; i2c_write(gspca_dev, 0xc5, &data, 1); - v = 1093 - 12 * sd->backlight; + v = 1093 - 12 * val; data = v >> 8; i2c_write(gspca_dev, 0xc6, &data, 1); data = v; i2c_write(gspca_dev, 0xc7, &data, 1); - v = 342 + 9 * sd->backlight; + v = 342 + 9 * val; data = v >> 8; i2c_write(gspca_dev, 0xc8, &data, 1); data = v; i2c_write(gspca_dev, 0xc9, &data, 1); - v = 702 - 9 * sd->backlight; + v = 702 - 9 * val; data = v >> 8; i2c_write(gspca_dev, 0xca, &data, 1); data = v; @@ -3833,14 +3543,7 @@ static int sd_start(struct gspca_dev *gspca_dev) /* case SENSOR_POxxxx: */ usb_exchange(gspca_dev, poxxxx_init_common); setgamma(gspca_dev); - setbacklight(gspca_dev); - setbrightness(gspca_dev); - setcontrast(gspca_dev); - setcolors(gspca_dev); - setsharpness(gspca_dev); - setautogain(gspca_dev); - setexposure(gspca_dev); - setgain(gspca_dev); + v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler); usb_exchange(gspca_dev, poxxxx_init_start_3); if (mode) init = poxxxx_initQVGA; @@ -3873,8 +3576,7 @@ static int sd_start(struct gspca_dev *gspca_dev) break; } msleep(100); - sethvflip(gspca_dev); - setlightfreq(gspca_dev); + v4l2_ctrl_handler_setup(&gspca_dev->ctrl_handler); } switch (sd->sensor) { case SENSOR_OV7670: @@ -3960,233 +3662,152 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, gspca_frame_add(gspca_dev, INTER_PACKET, data, len); } -static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->brightness = val; - if (gspca_dev->streaming) - setbrightness(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->brightness; - return 0; -} - -static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->contrast = val; - if (gspca_dev->streaming) - setcontrast(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->contrast; - return 0; -} - -static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val) +static int sd_s_ctrl(struct v4l2_ctrl *ctrl) { - struct sd *sd = (struct sd *) gspca_dev; - - sd->colors = val; - if (gspca_dev->streaming) - setcolors(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->colors; - return 0; -} - -static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->hflip = val; - if (gspca_dev->streaming) - sethvflip(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->hflip; - return 0; -} - -static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->vflip = val; - if (gspca_dev->streaming) - sethvflip(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; + struct gspca_dev *gspca_dev = + container_of(ctrl->handler, struct gspca_dev, ctrl_handler); + struct sd *sd = (struct sd *)gspca_dev; - *val = sd->vflip; - return 0; -} + gspca_dev->usb_err = 0; -static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->lightfreq = val; - if (gspca_dev->streaming) - setlightfreq(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->lightfreq; - return 0; -} - -static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->sharpness = val; - if (gspca_dev->streaming) - setsharpness(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->sharpness; - return 0; -} - -static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->gain = val; - if (gspca_dev->streaming) - setgain(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->gain; - return 0; -} - -static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->exposure = val; - if (gspca_dev->streaming) - setexposure(gspca_dev); - return gspca_dev->usb_err; -} - -static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->exposure; - return 0; -} - -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->autogain = val; - if (gspca_dev->streaming) - setautogain(gspca_dev); + if (!gspca_dev->streaming && ctrl->id != V4L2_CID_POWER_LINE_FREQUENCY) + return 0; + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + setbrightness(gspca_dev, ctrl->val); + break; + case V4L2_CID_CONTRAST: + setcontrast(gspca_dev, ctrl->val); + break; + case V4L2_CID_SATURATION: + setcolors(gspca_dev, ctrl->val); + break; + case V4L2_CID_HFLIP: + sethvflip(gspca_dev, sd->hflip->val, sd->vflip->val); + break; + case V4L2_CID_SHARPNESS: + setsharpness(gspca_dev, ctrl->val); + break; + case V4L2_CID_AUTOGAIN: + setautogain(gspca_dev, ctrl->val); + break; + case V4L2_CID_GAIN: + setgain(gspca_dev, ctrl->val); + break; + case V4L2_CID_EXPOSURE: + setexposure(gspca_dev, ctrl->val); + break; + case V4L2_CID_BACKLIGHT_COMPENSATION: + setbacklight(gspca_dev, ctrl->val); + break; + case V4L2_CID_POWER_LINE_FREQUENCY: + setlightfreq(gspca_dev, ctrl->val); + break; + } return gspca_dev->usb_err; } -static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->autogain; - return 0; -} - -static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->backlight = val; - if (gspca_dev->streaming) - setbacklight(gspca_dev); - - return gspca_dev->usb_err; -} +static const struct v4l2_ctrl_ops sd_ctrl_ops = { + .s_ctrl = sd_s_ctrl, +}; -static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val) +static int sd_init_controls(struct gspca_dev *gspca_dev) { - struct sd *sd = (struct sd *) gspca_dev; + struct sd *sd = (struct sd *)gspca_dev; + struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; + bool has_brightness = false; + bool has_contrast = false; + bool has_sat = false; + bool has_hvflip = false; + bool has_freq = false; + bool has_backlight = false; + bool has_exposure = false; + bool has_autogain = false; + bool has_gain = false; + bool has_sharpness = false; - *val = sd->backlight; - return 0; -} - -static int sd_querymenu(struct gspca_dev *gspca_dev, - struct v4l2_querymenu *menu) -{ - static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"}; + switch (sd->sensor) { + case SENSOR_HV7131R: + case SENSOR_MI0360: + case SENSOR_PO3130NC: + break; + case SENSOR_MI1310_SOC: + case SENSOR_MI1320: + case SENSOR_MI1320_SOC: + case SENSOR_OV7660: + has_hvflip = true; + break; + case SENSOR_OV7670: + has_hvflip = has_freq = true; + break; + case SENSOR_PO1200: + has_hvflip = has_sharpness = true; + break; + case SENSOR_POxxxx: + has_brightness = has_contrast = has_sat = has_backlight = + has_exposure = has_autogain = has_gain = + has_sharpness = true; + break; + } - switch (menu->id) { - case V4L2_CID_POWER_LINE_FREQUENCY: - if (menu->index >= ARRAY_SIZE(freq_nm)) - break; - strcpy((char *) menu->name, freq_nm[menu->index]); - return 0; + gspca_dev->vdev.ctrl_handler = hdl; + v4l2_ctrl_handler_init(hdl, 8); + if (has_brightness) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); + if (has_contrast) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_CONTRAST, 0, 255, 1, 127); + if (has_sat) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_SATURATION, 1, 127, 1, 63); + if (has_hvflip) { + sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_HFLIP, 0, 1, 1, 0); + sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_VFLIP, 0, 1, 1, 0); } - return -EINVAL; + if (has_sharpness) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_SHARPNESS, -1, 2, 1, -1); + if (has_freq) + v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, + V4L2_CID_POWER_LINE_FREQUENCY, + V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0, + V4L2_CID_POWER_LINE_FREQUENCY_50HZ); + if (has_autogain) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_AUTOGAIN, 0, 1, 1, 1); + if (has_gain) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_GAIN, 0, 78, 1, 0); + if (has_exposure) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_EXPOSURE, 0, 4095, 1, 450); + if (has_backlight) + v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, + V4L2_CID_BACKLIGHT_COMPENSATION, 0, 15, 1, 15); + + if (hdl->error) { + pr_err("Could not initialize controls\n"); + return hdl->error; + } + if (sd->hflip) + v4l2_ctrl_cluster(2, &sd->hflip); + return 0; } /* sub-driver description */ static const struct sd_desc sd_desc = { .name = MODULE_NAME, - .ctrls = sd_ctrls, - .nctrls = ARRAY_SIZE(sd_ctrls), + .init_controls = sd_init_controls, .config = sd_config, .init = sd_init, .start = sd_start, .stopN = sd_stopN, .stop0 = sd_stop0, .pkt_scan = sd_pkt_scan, - .querymenu = sd_querymenu, }; /* -- module initialisation -- */ -- cgit v1.2.3 From 82b343b231e0e29bc5d88998943cc4fd2fb61598 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 15 Jun 2012 05:24:26 -0300 Subject: [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 --- drivers/media/video/gspca/gspca.c | 2 +- drivers/media/video/gspca/nw80x.c | 1 - drivers/media/video/gspca/ov519.c | 2 -- drivers/media/video/gspca/ov534_9.c | 7 ++----- drivers/media/video/gspca/se401.c | 1 - drivers/media/video/gspca/spca1528.c | 4 ---- drivers/media/video/gspca/spca501.c | 5 ----- drivers/media/video/gspca/spca505.c | 6 +----- drivers/media/video/gspca/spca561.c | 1 - drivers/media/video/gspca/stk014.c | 1 - drivers/media/video/gspca/sunplus.c | 2 -- drivers/media/video/gspca/tv8532.c | 2 -- drivers/media/video/gspca/vc032x.c | 2 -- drivers/media/video/gspca/xirlink_cit.c | 2 -- 14 files changed, 4 insertions(+), 34 deletions(-) (limited to 'drivers/media/video/gspca/vc032x.c') 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); -- cgit v1.2.3 From 8bb58964bc139d5ff5285f84aa302977d221754d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 30 Jun 2012 06:44:47 -0300 Subject: [media] gspca: Add reset_resume callback to all sub-drivers 1) The gspca-core's suspend/resume code is such that resume being called after a reset is safe / ok. 2) All devices tested sofar seem to need the reset_resume callback to work properly over a suspend 3) The USB-core won't call the reset_resume callback for devices which don't need it Thus it seems the simplest and the best to just add the callback to all sub-drivers, rather then adding the callbacks one-by-one as each driver gets tested with suspend/resume. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/benq.c | 1 + drivers/media/video/gspca/conex.c | 1 + drivers/media/video/gspca/cpia1.c | 1 + drivers/media/video/gspca/etoms.c | 1 + drivers/media/video/gspca/finepix.c | 1 + drivers/media/video/gspca/gl860/gl860.c | 1 + drivers/media/video/gspca/jeilinj.c | 1 + drivers/media/video/gspca/jl2005bcd.c | 3 +-- drivers/media/video/gspca/kinect.c | 1 + drivers/media/video/gspca/konica.c | 1 + drivers/media/video/gspca/m5602/m5602_core.c | 1 + drivers/media/video/gspca/mr97310a.c | 1 + drivers/media/video/gspca/nw80x.c | 1 + drivers/media/video/gspca/ov519.c | 1 + drivers/media/video/gspca/ov534.c | 1 + drivers/media/video/gspca/ov534_9.c | 1 + drivers/media/video/gspca/pac207.c | 1 + drivers/media/video/gspca/pac7302.c | 1 + drivers/media/video/gspca/pac7311.c | 1 + drivers/media/video/gspca/se401.c | 1 + drivers/media/video/gspca/sn9c2028.c | 1 + drivers/media/video/gspca/sonixb.c | 1 + drivers/media/video/gspca/sonixj.c | 1 + drivers/media/video/gspca/spca1528.c | 1 + drivers/media/video/gspca/spca500.c | 1 + drivers/media/video/gspca/spca501.c | 1 + drivers/media/video/gspca/spca505.c | 1 + drivers/media/video/gspca/spca506.c | 1 + drivers/media/video/gspca/spca508.c | 1 + drivers/media/video/gspca/spca561.c | 1 + drivers/media/video/gspca/sq905.c | 1 + drivers/media/video/gspca/sq905c.c | 1 + drivers/media/video/gspca/sq930x.c | 1 + drivers/media/video/gspca/stk014.c | 1 + drivers/media/video/gspca/stv0680.c | 1 + drivers/media/video/gspca/sunplus.c | 1 + drivers/media/video/gspca/t613.c | 1 + drivers/media/video/gspca/tv8532.c | 1 + drivers/media/video/gspca/vc032x.c | 1 + drivers/media/video/gspca/vicam.c | 1 + drivers/media/video/gspca/xirlink_cit.c | 1 + 41 files changed, 41 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/gspca/vc032x.c') diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c index f03314869622..352f32190e68 100644 --- a/drivers/media/video/gspca/benq.c +++ b/drivers/media/video/gspca/benq.c @@ -282,6 +282,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index f06ba9020cdc..c9052f20435e 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c @@ -959,6 +959,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c index 57cad7b94311..2499a881d9a3 100644 --- a/drivers/media/video/gspca/cpia1.c +++ b/drivers/media/video/gspca/cpia1.c @@ -1898,6 +1898,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index 8da77a8dc365..38f68e11c3a2 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c @@ -792,6 +792,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c index 6e26c93b4656..c8f2201cc35a 100644 --- a/drivers/media/video/gspca/finepix.c +++ b/drivers/media/video/gspca/finepix.c @@ -299,6 +299,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c index c549574c1c7e..ced3b71f14e5 100644 --- a/drivers/media/video/gspca/gl860/gl860.c +++ b/drivers/media/video/gspca/gl860/gl860.c @@ -521,6 +521,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c index 51016db2fc62..26b99310d628 100644 --- a/drivers/media/video/gspca/jeilinj.c +++ b/drivers/media/video/gspca/jeilinj.c @@ -541,6 +541,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/jl2005bcd.c b/drivers/media/video/gspca/jl2005bcd.c index 9c591c7c6f54..cf9d9fca5b84 100644 --- a/drivers/media/video/gspca/jl2005bcd.c +++ b/drivers/media/video/gspca/jl2005bcd.c @@ -505,8 +505,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev) /* sub-driver description */ static const struct sd_desc sd_desc = { .name = MODULE_NAME, - /* .ctrls = none have been detected */ - /* .nctrls = ARRAY_SIZE(sd_ctrls), */ .config = sd_config, .init = sd_init, .start = sd_start, @@ -536,6 +534,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/kinect.c b/drivers/media/video/gspca/kinect.c index f71ec0cfe15e..40ad6687ee5d 100644 --- a/drivers/media/video/gspca/kinect.c +++ b/drivers/media/video/gspca/kinect.c @@ -401,6 +401,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c index 5dcfed208c31..46e1ae402767 100644 --- a/drivers/media/video/gspca/konica.c +++ b/drivers/media/video/gspca/konica.c @@ -472,6 +472,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c index 0c4493675438..ed22638978ce 100644 --- a/drivers/media/video/gspca/m5602/m5602_core.c +++ b/drivers/media/video/gspca/m5602/m5602_core.c @@ -400,6 +400,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif .disconnect = m5602_disconnect }; diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 3ede41b67468..8f4714df5990 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c @@ -1084,6 +1084,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c index b8ab612243de..44c9964b1b3e 100644 --- a/drivers/media/video/gspca/nw80x.c +++ b/drivers/media/video/gspca/nw80x.c @@ -2087,6 +2087,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 3ae5e35dce40..bfc7cefa59f8 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -4981,6 +4981,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 78d11dd67817..bb09d7884b89 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -1537,6 +1537,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c index 06274871b783..e4c3c8fdab3e 100644 --- a/drivers/media/video/gspca/ov534_9.c +++ b/drivers/media/video/gspca/ov534_9.c @@ -1493,6 +1493,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index fa661c6d6d55..d236d1791f78 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c @@ -462,6 +462,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index f5133cfb1556..4877f7ab3d59 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c @@ -925,6 +925,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 115da169f32a..ba3558d3f017 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c @@ -694,6 +694,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/se401.c b/drivers/media/video/gspca/se401.c index 0b019ad72fbf..a33cb78a839c 100644 --- a/drivers/media/video/gspca/se401.c +++ b/drivers/media/video/gspca/se401.c @@ -730,6 +730,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif .pre_reset = sd_pre_reset, .post_reset = sd_post_reset, diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c index 478533cb1152..516a17e38f67 100644 --- a/drivers/media/video/gspca/sn9c2028.c +++ b/drivers/media/video/gspca/sn9c2028.c @@ -734,6 +734,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index dfc70771c1f1..fd1f8d2d3b0b 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c @@ -1486,6 +1486,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index f38faa9b37c3..150b2df40f7f 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -3199,6 +3199,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c index fa2075a7e486..14d635277d71 100644 --- a/drivers/media/video/gspca/spca1528.c +++ b/drivers/media/video/gspca/spca1528.c @@ -437,6 +437,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 08fdedb83c6e..25cb68d0556d 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c @@ -983,6 +983,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 6d4debdd5b5c..3b7f777785b4 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c @@ -2047,6 +2047,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index fea17a8217f3..bc7d67c3cb04 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c @@ -800,6 +800,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c index 7b54f63e9542..969bb5a4cd93 100644 --- a/drivers/media/video/gspca/spca506.c +++ b/drivers/media/video/gspca/spca506.c @@ -605,6 +605,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index da5345de9701..1286b4170b88 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c @@ -1533,6 +1533,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 00f4de7c6e84..7ea5e9112b2f 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -922,6 +922,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c index 04f54654a026..a8ac97931ad6 100644 --- a/drivers/media/video/gspca/sq905.c +++ b/drivers/media/video/gspca/sq905.c @@ -433,6 +433,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c index f34ddb0570c8..2c2f3d2f357f 100644 --- a/drivers/media/video/gspca/sq905c.c +++ b/drivers/media/video/gspca/sq905c.c @@ -340,6 +340,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c index 2d068867d0a4..3e1e486af883 100644 --- a/drivers/media/video/gspca/sq930x.c +++ b/drivers/media/video/gspca/sq930x.c @@ -1165,6 +1165,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index e83e683958a8..8c0982607f25 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c @@ -439,6 +439,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c index 461ed645f309..4e4f86cd5bb0 100644 --- a/drivers/media/video/gspca/stv0680.c +++ b/drivers/media/video/gspca/stv0680.c @@ -352,6 +352,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index c73748b2d21f..9ccfcb1c6479 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -1078,6 +1078,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 5f5d569ab646..01414bafaacf 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -1043,6 +1043,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index ef39981bfb69..8591324a53e1 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c @@ -371,6 +371,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 54a6cf92b745..f21fd1677c38 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -3846,6 +3846,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/vicam.c b/drivers/media/video/gspca/vicam.c index 35afbd002233..b1a64b912666 100644 --- a/drivers/media/video/gspca/vicam.c +++ b/drivers/media/video/gspca/vicam.c @@ -358,6 +358,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c index e074718658d8..42d51dadb46b 100644 --- a/drivers/media/video/gspca/xirlink_cit.c +++ b/drivers/media/video/gspca/xirlink_cit.c @@ -3135,6 +3135,7 @@ static struct usb_driver sd_driver = { #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, + .reset_resume = gspca_resume, #endif }; -- cgit v1.2.3