Loading drivers/media/video/gspca/ov534.c +113 −342 Original line number Original line Diff line number Diff line Loading @@ -49,54 +49,51 @@ MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>"); MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL"); /* controls */ enum e_ctrl { BRIGHTNESS, CONTRAST, GAIN, EXPOSURE, AGC, AWB, AEC, SHARPNESS, HFLIP, VFLIP, LIGHTFREQ, NCTRLS /* number of controls */ }; /* specific webcam descriptor */ /* specific webcam descriptor */ struct sd { struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_ctrl ctrls[NCTRLS]; __u32 last_pts; __u32 last_pts; u16 last_fid; u16 last_fid; u8 frame_rate; u8 frame_rate; u8 brightness; u8 contrast; u8 gain; u8 exposure; u8 agc; u8 awb; u8 aec; s8 sharpness; u8 hflip; u8 vflip; u8 freqfltr; }; }; /* V4L2 controls supported by the driver */ /* V4L2 controls supported by the driver */ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); static void setbrightness(struct gspca_dev *gspca_dev); static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static void setcontrast(struct gspca_dev *gspca_dev); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static void setgain(struct gspca_dev *gspca_dev); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); static void setexposure(struct gspca_dev *gspca_dev); static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val); static void setawb(struct gspca_dev *gspca_dev); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); static void setaec(struct gspca_dev *gspca_dev); static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static void setsharpness(struct gspca_dev *gspca_dev); static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); static void sethvflip(struct gspca_dev *gspca_dev); static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); static void setlightfreq(struct gspca_dev *gspca_dev); 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_start(struct gspca_dev *gspca_dev); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static void sd_stopN(struct gspca_dev *gspca_dev); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val); static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val); 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_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val); static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu); static const struct ctrl sd_ctrls[] = { static const struct ctrl sd_ctrls[] = { { /* 0 */ [BRIGHTNESS] = { { { .id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -104,13 +101,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define BRIGHTNESS_DEF 0 .default_value = 0, .default_value = BRIGHTNESS_DEF, }, }, .set = sd_setbrightness, .set_control = setbrightness .get = sd_getbrightness, }, }, { /* 1 */ [CONTRAST] = { { { .id = V4L2_CID_CONTRAST, .id = V4L2_CID_CONTRAST, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -118,13 +113,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define CONTRAST_DEF 32 .default_value = 32, .default_value = CONTRAST_DEF, }, }, .set = sd_setcontrast, .set_control = setcontrast .get = sd_getcontrast, }, }, { /* 2 */ [GAIN] = { { { .id = V4L2_CID_GAIN, .id = V4L2_CID_GAIN, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -132,13 +125,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 63, .maximum = 63, .step = 1, .step = 1, #define GAIN_DEF 20 .default_value = 20, .default_value = GAIN_DEF, }, }, .set = sd_setgain, .set_control = setgain .get = sd_getgain, }, }, { /* 3 */ [EXPOSURE] = { { { .id = V4L2_CID_EXPOSURE, .id = V4L2_CID_EXPOSURE, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -146,13 +137,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define EXPO_DEF 120 .default_value = 120, .default_value = EXPO_DEF, }, }, .set = sd_setexposure, .set_control = setexposure .get = sd_getexposure, }, }, { /* 4 */ [AGC] = { { { .id = V4L2_CID_AUTOGAIN, .id = V4L2_CID_AUTOGAIN, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -160,14 +149,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AGC_DEF 1 .default_value = 1, .default_value = AGC_DEF, }, }, .set = sd_setagc, .set = sd_setagc .get = sd_getagc, }, }, #define AWB_IDX 5 [AWB] = { { /* 5 */ { { .id = V4L2_CID_AUTO_WHITE_BALANCE, .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -175,13 +161,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AWB_DEF 1 .default_value = 1, .default_value = AWB_DEF, }, }, .set = sd_setawb, .set_control = setawb .get = sd_getawb, }, }, { /* 6 */ [AEC] = { { { .id = V4L2_CID_EXPOSURE_AUTO, .id = V4L2_CID_EXPOSURE_AUTO, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -189,13 +173,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AEC_DEF 1 .default_value = 1, .default_value = AEC_DEF, }, }, .set = sd_setaec, .set_control = setaec .get = sd_getaec, }, }, { /* 7 */ [SHARPNESS] = { { { .id = V4L2_CID_SHARPNESS, .id = V4L2_CID_SHARPNESS, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -203,13 +185,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 63, .maximum = 63, .step = 1, .step = 1, #define SHARPNESS_DEF 0 .default_value = 0, .default_value = SHARPNESS_DEF, }, }, .set = sd_setsharpness, .set_control = setsharpness .get = sd_getsharpness, }, }, { /* 8 */ [HFLIP] = { { { .id = V4L2_CID_HFLIP, .id = V4L2_CID_HFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -217,13 +197,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define HFLIP_DEF 0 .default_value = 0, .default_value = HFLIP_DEF, }, }, .set = sd_sethflip, .set_control = sethvflip .get = sd_gethflip, }, }, { /* 9 */ [VFLIP] = { { { .id = V4L2_CID_VFLIP, .id = V4L2_CID_VFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -231,13 +209,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define VFLIP_DEF 0 .default_value = 0, .default_value = VFLIP_DEF, }, }, .set = sd_setvflip, .set_control = sethvflip .get = sd_getvflip, }, }, { /* 10 */ [LIGHTFREQ] = { { { .id = V4L2_CID_POWER_LINE_FREQUENCY, .id = V4L2_CID_POWER_LINE_FREQUENCY, .type = V4L2_CTRL_TYPE_MENU, .type = V4L2_CTRL_TYPE_MENU, Loading @@ -245,11 +221,9 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define FREQFLTR_DEF 0 .default_value = 0, .default_value = FREQFLTR_DEF, }, }, .set = sd_setfreqfltr, .set_control = setlightfreq .get = sd_getfreqfltr, }, }, }; }; Loading Loading @@ -670,14 +644,14 @@ static void setbrightness(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sccb_reg_write(gspca_dev, 0x9b, sd->brightness); sccb_reg_write(gspca_dev, 0x9b, sd->ctrls[BRIGHTNESS].val); } } static void setcontrast(struct gspca_dev *gspca_dev) static void setcontrast(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sccb_reg_write(gspca_dev, 0x9c, sd->contrast); sccb_reg_write(gspca_dev, 0x9c, sd->ctrls[CONTRAST].val); } } static void setgain(struct gspca_dev *gspca_dev) static void setgain(struct gspca_dev *gspca_dev) Loading @@ -685,10 +659,10 @@ static void setgain(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; if (sd->agc) if (sd->ctrls[AGC].val) return; return; val = sd->gain; val = sd->ctrls[GAIN].val; switch (val & 0x30) { switch (val & 0x30) { case 0x00: case 0x00: val &= 0x0f; val &= 0x0f; Loading @@ -715,7 +689,7 @@ static void setexposure(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; if (sd->aec) if (sd->ctrls[AEC].val) return; return; /* 'val' is one byte and represents half of the exposure value we are /* 'val' is one byte and represents half of the exposure value we are Loading @@ -724,7 +698,7 @@ static void setexposure(struct gspca_dev *gspca_dev) * MSB: ((u16) val << 1) >> 8 == val >> 7 * MSB: ((u16) val << 1) >> 8 == val >> 7 * LSB: ((u16) val << 1) & 0xff == val << 1 * LSB: ((u16) val << 1) & 0xff == val << 1 */ */ val = sd->exposure; val = sd->ctrls[EXPOSURE].val; sccb_reg_write(gspca_dev, 0x08, val >> 7); sccb_reg_write(gspca_dev, 0x08, val >> 7); sccb_reg_write(gspca_dev, 0x10, val << 1); sccb_reg_write(gspca_dev, 0x10, val << 1); } } Loading @@ -733,7 +707,7 @@ static void setagc(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->agc) { if (sd->ctrls[AGC].val) { sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_write(gspca_dev, 0x64, sccb_reg_write(gspca_dev, 0x64, Loading @@ -752,7 +726,7 @@ static void setawb(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->awb) { if (sd->ctrls[AWB].val) { sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x02); sccb_reg_read(gspca_dev, 0x13) | 0x02); sccb_reg_write(gspca_dev, 0x63, sccb_reg_write(gspca_dev, 0x63, Loading @@ -769,7 +743,7 @@ static void setaec(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->aec) if (sd->ctrls[AEC].val) sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x01); sccb_reg_read(gspca_dev, 0x13) | 0x01); else { else { Loading @@ -784,40 +758,30 @@ static void setsharpness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; val = sd->sharpness; val = sd->ctrls[SHARPNESS].val; sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ } } static void sethflip(struct gspca_dev *gspca_dev) static void sethvflip(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; if (sd->hflip == 0) sccb_reg_write(gspca_dev, 0x0c, sccb_reg_read(gspca_dev, 0x0c) | 0x40); else sccb_reg_write(gspca_dev, 0x0c, sccb_reg_read(gspca_dev, 0x0c) & ~0x40); } static void setvflip(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; if (sd->vflip == 0) val = sccb_reg_read(gspca_dev, 0x0c); sccb_reg_write(gspca_dev, 0x0c, val &= ~0xc0; sccb_reg_read(gspca_dev, 0x0c) | 0x80); if (sd->ctrls[HFLIP].val == 0) else val |= 0x40; sccb_reg_write(gspca_dev, 0x0c, if (sd->ctrls[VFLIP].val == 0) sccb_reg_read(gspca_dev, 0x0c) & ~0x80); val |= 0x80; sccb_reg_write(gspca_dev, 0x0c, val); } } static void setfreqfltr(struct gspca_dev *gspca_dev) static void setlightfreq(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->freqfltr == 0) if (sd->ctrls[LIGHTFREQ].val == 0) sccb_reg_write(gspca_dev, 0x2b, 0x00); sccb_reg_write(gspca_dev, 0x2b, 0x00); else else sccb_reg_write(gspca_dev, 0x2b, 0x9e); sccb_reg_write(gspca_dev, 0x2b, 0x9e); Loading @@ -833,6 +797,12 @@ static int sd_config(struct gspca_dev *gspca_dev, cam = &gspca_dev->cam; cam = &gspca_dev->cam; cam->ctrls = sd->ctrls; /* the auto white balance control works only when auto gain is set */ if (sd_ctrls[AGC].qctrl.default_value == 0) gspca_dev->ctrl_inac |= (1 << AWB); cam->cam_mode = ov772x_mode; cam->cam_mode = ov772x_mode; cam->nmodes = ARRAY_SIZE(ov772x_mode); cam->nmodes = ARRAY_SIZE(ov772x_mode); cam->mode_framerates = ov772x_framerates; cam->mode_framerates = ov772x_framerates; Loading @@ -843,22 +813,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->frame_rate = 30; sd->frame_rate = 30; sd->brightness = BRIGHTNESS_DEF; sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; #if AGC_DEF != 0 sd->agc = AGC_DEF; #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif sd->awb = AWB_DEF; sd->aec = AEC_DEF; sd->sharpness = SHARPNESS_DEF; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; sd->freqfltr = FREQFLTR_DEF; return 0; return 0; } } Loading Loading @@ -917,17 +871,19 @@ static int sd_start(struct gspca_dev *gspca_dev) } } set_frame_rate(gspca_dev); set_frame_rate(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << AGC))) setagc(gspca_dev); setagc(gspca_dev); setawb(gspca_dev); setawb(gspca_dev); setaec(gspca_dev); setaec(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << GAIN))) setgain(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); setbrightness(gspca_dev); setcontrast(gspca_dev); setcontrast(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << SHARPNESS))) setsharpness(gspca_dev); setsharpness(gspca_dev); setvflip(gspca_dev); sethvflip(gspca_dev); sethflip(gspca_dev); setlightfreq(gspca_dev); setfreqfltr(gspca_dev); ov534_set_led(gspca_dev, 1); ov534_set_led(gspca_dev, 1); ov534_reg_write(gspca_dev, 0xe0, 0x00); ov534_reg_write(gspca_dev, 0xe0, 0x00); Loading Loading @@ -1026,212 +982,27 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, } while (remaining_len > 0); } while (remaining_len > 0); } } /* controls */ 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 0; } 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 0; } 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_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 0; } 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 0; } 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_setagc(struct gspca_dev *gspca_dev, __s32 val) static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sd->agc = val; sd->ctrls[AGC].val = val; if (gspca_dev->streaming) { /* the auto white balance control works only /* the auto white balance control works only * when auto gain is set */ * when auto gain is set */ if (val) if (val) { gspca_dev->ctrl_inac &= ~(1 << AWB_IDX); gspca_dev->ctrl_inac &= ~(1 << AWB); else } else { gspca_dev->ctrl_inac |= (1 << AWB_IDX); gspca_dev->ctrl_inac |= (1 << AWB); setagc(gspca_dev); if (sd->ctrls[AWB].val) { } sd->ctrls[AWB].val = 0; return 0; } static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->agc; return 0; } static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->awb = val; if (gspca_dev->streaming) if (gspca_dev->streaming) setawb(gspca_dev); setawb(gspca_dev); return 0; } static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->awb; return 0; } static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->aec = val; if (gspca_dev->streaming) setaec(gspca_dev); return 0; } } static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->aec; 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) if (gspca_dev->streaming) setsharpness(gspca_dev); setagc(gspca_dev); return 0; 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_sethflip(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->hflip = val; if (gspca_dev->streaming) sethflip(gspca_dev); return 0; } 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) setvflip(gspca_dev); return 0; } static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->vflip; return 0; } static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->freqfltr = val; if (gspca_dev->streaming) setfreqfltr(gspca_dev); return 0; } static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->freqfltr; return 0; } } static int sd_querymenu(struct gspca_dev *gspca_dev, static int sd_querymenu(struct gspca_dev *gspca_dev, Loading Loading
drivers/media/video/gspca/ov534.c +113 −342 Original line number Original line Diff line number Diff line Loading @@ -49,54 +49,51 @@ MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>"); MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver"); MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL"); /* controls */ enum e_ctrl { BRIGHTNESS, CONTRAST, GAIN, EXPOSURE, AGC, AWB, AEC, SHARPNESS, HFLIP, VFLIP, LIGHTFREQ, NCTRLS /* number of controls */ }; /* specific webcam descriptor */ /* specific webcam descriptor */ struct sd { struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_ctrl ctrls[NCTRLS]; __u32 last_pts; __u32 last_pts; u16 last_fid; u16 last_fid; u8 frame_rate; u8 frame_rate; u8 brightness; u8 contrast; u8 gain; u8 exposure; u8 agc; u8 awb; u8 aec; s8 sharpness; u8 hflip; u8 vflip; u8 freqfltr; }; }; /* V4L2 controls supported by the driver */ /* V4L2 controls supported by the driver */ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); static void setbrightness(struct gspca_dev *gspca_dev); static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static void setcontrast(struct gspca_dev *gspca_dev); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static void setgain(struct gspca_dev *gspca_dev); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); static void setexposure(struct gspca_dev *gspca_dev); static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val); static void setawb(struct gspca_dev *gspca_dev); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); static void setaec(struct gspca_dev *gspca_dev); static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static void setsharpness(struct gspca_dev *gspca_dev); static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); static void sethvflip(struct gspca_dev *gspca_dev); static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); static void setlightfreq(struct gspca_dev *gspca_dev); 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_start(struct gspca_dev *gspca_dev); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static void sd_stopN(struct gspca_dev *gspca_dev); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val); static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val); 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_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val); static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu); static const struct ctrl sd_ctrls[] = { static const struct ctrl sd_ctrls[] = { { /* 0 */ [BRIGHTNESS] = { { { .id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -104,13 +101,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define BRIGHTNESS_DEF 0 .default_value = 0, .default_value = BRIGHTNESS_DEF, }, }, .set = sd_setbrightness, .set_control = setbrightness .get = sd_getbrightness, }, }, { /* 1 */ [CONTRAST] = { { { .id = V4L2_CID_CONTRAST, .id = V4L2_CID_CONTRAST, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -118,13 +113,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define CONTRAST_DEF 32 .default_value = 32, .default_value = CONTRAST_DEF, }, }, .set = sd_setcontrast, .set_control = setcontrast .get = sd_getcontrast, }, }, { /* 2 */ [GAIN] = { { { .id = V4L2_CID_GAIN, .id = V4L2_CID_GAIN, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -132,13 +125,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 63, .maximum = 63, .step = 1, .step = 1, #define GAIN_DEF 20 .default_value = 20, .default_value = GAIN_DEF, }, }, .set = sd_setgain, .set_control = setgain .get = sd_getgain, }, }, { /* 3 */ [EXPOSURE] = { { { .id = V4L2_CID_EXPOSURE, .id = V4L2_CID_EXPOSURE, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -146,13 +137,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 255, .maximum = 255, .step = 1, .step = 1, #define EXPO_DEF 120 .default_value = 120, .default_value = EXPO_DEF, }, }, .set = sd_setexposure, .set_control = setexposure .get = sd_getexposure, }, }, { /* 4 */ [AGC] = { { { .id = V4L2_CID_AUTOGAIN, .id = V4L2_CID_AUTOGAIN, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -160,14 +149,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AGC_DEF 1 .default_value = 1, .default_value = AGC_DEF, }, }, .set = sd_setagc, .set = sd_setagc .get = sd_getagc, }, }, #define AWB_IDX 5 [AWB] = { { /* 5 */ { { .id = V4L2_CID_AUTO_WHITE_BALANCE, .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -175,13 +161,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AWB_DEF 1 .default_value = 1, .default_value = AWB_DEF, }, }, .set = sd_setawb, .set_control = setawb .get = sd_getawb, }, }, { /* 6 */ [AEC] = { { { .id = V4L2_CID_EXPOSURE_AUTO, .id = V4L2_CID_EXPOSURE_AUTO, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -189,13 +173,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define AEC_DEF 1 .default_value = 1, .default_value = AEC_DEF, }, }, .set = sd_setaec, .set_control = setaec .get = sd_getaec, }, }, { /* 7 */ [SHARPNESS] = { { { .id = V4L2_CID_SHARPNESS, .id = V4L2_CID_SHARPNESS, .type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER, Loading @@ -203,13 +185,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 63, .maximum = 63, .step = 1, .step = 1, #define SHARPNESS_DEF 0 .default_value = 0, .default_value = SHARPNESS_DEF, }, }, .set = sd_setsharpness, .set_control = setsharpness .get = sd_getsharpness, }, }, { /* 8 */ [HFLIP] = { { { .id = V4L2_CID_HFLIP, .id = V4L2_CID_HFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -217,13 +197,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define HFLIP_DEF 0 .default_value = 0, .default_value = HFLIP_DEF, }, }, .set = sd_sethflip, .set_control = sethvflip .get = sd_gethflip, }, }, { /* 9 */ [VFLIP] = { { { .id = V4L2_CID_VFLIP, .id = V4L2_CID_VFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN, Loading @@ -231,13 +209,11 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define VFLIP_DEF 0 .default_value = 0, .default_value = VFLIP_DEF, }, }, .set = sd_setvflip, .set_control = sethvflip .get = sd_getvflip, }, }, { /* 10 */ [LIGHTFREQ] = { { { .id = V4L2_CID_POWER_LINE_FREQUENCY, .id = V4L2_CID_POWER_LINE_FREQUENCY, .type = V4L2_CTRL_TYPE_MENU, .type = V4L2_CTRL_TYPE_MENU, Loading @@ -245,11 +221,9 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .minimum = 0, .maximum = 1, .maximum = 1, .step = 1, .step = 1, #define FREQFLTR_DEF 0 .default_value = 0, .default_value = FREQFLTR_DEF, }, }, .set = sd_setfreqfltr, .set_control = setlightfreq .get = sd_getfreqfltr, }, }, }; }; Loading Loading @@ -670,14 +644,14 @@ static void setbrightness(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sccb_reg_write(gspca_dev, 0x9b, sd->brightness); sccb_reg_write(gspca_dev, 0x9b, sd->ctrls[BRIGHTNESS].val); } } static void setcontrast(struct gspca_dev *gspca_dev) static void setcontrast(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sccb_reg_write(gspca_dev, 0x9c, sd->contrast); sccb_reg_write(gspca_dev, 0x9c, sd->ctrls[CONTRAST].val); } } static void setgain(struct gspca_dev *gspca_dev) static void setgain(struct gspca_dev *gspca_dev) Loading @@ -685,10 +659,10 @@ static void setgain(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; if (sd->agc) if (sd->ctrls[AGC].val) return; return; val = sd->gain; val = sd->ctrls[GAIN].val; switch (val & 0x30) { switch (val & 0x30) { case 0x00: case 0x00: val &= 0x0f; val &= 0x0f; Loading @@ -715,7 +689,7 @@ static void setexposure(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; if (sd->aec) if (sd->ctrls[AEC].val) return; return; /* 'val' is one byte and represents half of the exposure value we are /* 'val' is one byte and represents half of the exposure value we are Loading @@ -724,7 +698,7 @@ static void setexposure(struct gspca_dev *gspca_dev) * MSB: ((u16) val << 1) >> 8 == val >> 7 * MSB: ((u16) val << 1) >> 8 == val >> 7 * LSB: ((u16) val << 1) & 0xff == val << 1 * LSB: ((u16) val << 1) & 0xff == val << 1 */ */ val = sd->exposure; val = sd->ctrls[EXPOSURE].val; sccb_reg_write(gspca_dev, 0x08, val >> 7); sccb_reg_write(gspca_dev, 0x08, val >> 7); sccb_reg_write(gspca_dev, 0x10, val << 1); sccb_reg_write(gspca_dev, 0x10, val << 1); } } Loading @@ -733,7 +707,7 @@ static void setagc(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->agc) { if (sd->ctrls[AGC].val) { sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_write(gspca_dev, 0x64, sccb_reg_write(gspca_dev, 0x64, Loading @@ -752,7 +726,7 @@ static void setawb(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->awb) { if (sd->ctrls[AWB].val) { sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x02); sccb_reg_read(gspca_dev, 0x13) | 0x02); sccb_reg_write(gspca_dev, 0x63, sccb_reg_write(gspca_dev, 0x63, Loading @@ -769,7 +743,7 @@ static void setaec(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->aec) if (sd->ctrls[AEC].val) sccb_reg_write(gspca_dev, 0x13, sccb_reg_write(gspca_dev, 0x13, sccb_reg_read(gspca_dev, 0x13) | 0x01); sccb_reg_read(gspca_dev, 0x13) | 0x01); else { else { Loading @@ -784,40 +758,30 @@ static void setsharpness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; u8 val; val = sd->sharpness; val = sd->ctrls[SHARPNESS].val; sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ } } static void sethflip(struct gspca_dev *gspca_dev) static void sethvflip(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; if (sd->hflip == 0) sccb_reg_write(gspca_dev, 0x0c, sccb_reg_read(gspca_dev, 0x0c) | 0x40); else sccb_reg_write(gspca_dev, 0x0c, sccb_reg_read(gspca_dev, 0x0c) & ~0x40); } static void setvflip(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; u8 val; if (sd->vflip == 0) val = sccb_reg_read(gspca_dev, 0x0c); sccb_reg_write(gspca_dev, 0x0c, val &= ~0xc0; sccb_reg_read(gspca_dev, 0x0c) | 0x80); if (sd->ctrls[HFLIP].val == 0) else val |= 0x40; sccb_reg_write(gspca_dev, 0x0c, if (sd->ctrls[VFLIP].val == 0) sccb_reg_read(gspca_dev, 0x0c) & ~0x80); val |= 0x80; sccb_reg_write(gspca_dev, 0x0c, val); } } static void setfreqfltr(struct gspca_dev *gspca_dev) static void setlightfreq(struct gspca_dev *gspca_dev) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; if (sd->freqfltr == 0) if (sd->ctrls[LIGHTFREQ].val == 0) sccb_reg_write(gspca_dev, 0x2b, 0x00); sccb_reg_write(gspca_dev, 0x2b, 0x00); else else sccb_reg_write(gspca_dev, 0x2b, 0x9e); sccb_reg_write(gspca_dev, 0x2b, 0x9e); Loading @@ -833,6 +797,12 @@ static int sd_config(struct gspca_dev *gspca_dev, cam = &gspca_dev->cam; cam = &gspca_dev->cam; cam->ctrls = sd->ctrls; /* the auto white balance control works only when auto gain is set */ if (sd_ctrls[AGC].qctrl.default_value == 0) gspca_dev->ctrl_inac |= (1 << AWB); cam->cam_mode = ov772x_mode; cam->cam_mode = ov772x_mode; cam->nmodes = ARRAY_SIZE(ov772x_mode); cam->nmodes = ARRAY_SIZE(ov772x_mode); cam->mode_framerates = ov772x_framerates; cam->mode_framerates = ov772x_framerates; Loading @@ -843,22 +813,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->frame_rate = 30; sd->frame_rate = 30; sd->brightness = BRIGHTNESS_DEF; sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; #if AGC_DEF != 0 sd->agc = AGC_DEF; #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif sd->awb = AWB_DEF; sd->aec = AEC_DEF; sd->sharpness = SHARPNESS_DEF; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; sd->freqfltr = FREQFLTR_DEF; return 0; return 0; } } Loading Loading @@ -917,17 +871,19 @@ static int sd_start(struct gspca_dev *gspca_dev) } } set_frame_rate(gspca_dev); set_frame_rate(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << AGC))) setagc(gspca_dev); setagc(gspca_dev); setawb(gspca_dev); setawb(gspca_dev); setaec(gspca_dev); setaec(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << GAIN))) setgain(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); setbrightness(gspca_dev); setcontrast(gspca_dev); setcontrast(gspca_dev); if (!(gspca_dev->ctrl_dis & (1 << SHARPNESS))) setsharpness(gspca_dev); setsharpness(gspca_dev); setvflip(gspca_dev); sethvflip(gspca_dev); sethflip(gspca_dev); setlightfreq(gspca_dev); setfreqfltr(gspca_dev); ov534_set_led(gspca_dev, 1); ov534_set_led(gspca_dev, 1); ov534_reg_write(gspca_dev, 0xe0, 0x00); ov534_reg_write(gspca_dev, 0xe0, 0x00); Loading Loading @@ -1026,212 +982,27 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, } while (remaining_len > 0); } while (remaining_len > 0); } } /* controls */ 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 0; } 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 0; } 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_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 0; } 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 0; } 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_setagc(struct gspca_dev *gspca_dev, __s32 val) static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) { { struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev; sd->agc = val; sd->ctrls[AGC].val = val; if (gspca_dev->streaming) { /* the auto white balance control works only /* the auto white balance control works only * when auto gain is set */ * when auto gain is set */ if (val) if (val) { gspca_dev->ctrl_inac &= ~(1 << AWB_IDX); gspca_dev->ctrl_inac &= ~(1 << AWB); else } else { gspca_dev->ctrl_inac |= (1 << AWB_IDX); gspca_dev->ctrl_inac |= (1 << AWB); setagc(gspca_dev); if (sd->ctrls[AWB].val) { } sd->ctrls[AWB].val = 0; return 0; } static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->agc; return 0; } static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->awb = val; if (gspca_dev->streaming) if (gspca_dev->streaming) setawb(gspca_dev); setawb(gspca_dev); return 0; } static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->awb; return 0; } static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->aec = val; if (gspca_dev->streaming) setaec(gspca_dev); return 0; } } static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->aec; 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) if (gspca_dev->streaming) setsharpness(gspca_dev); setagc(gspca_dev); return 0; 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_sethflip(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->hflip = val; if (gspca_dev->streaming) sethflip(gspca_dev); return 0; } 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) setvflip(gspca_dev); return 0; } static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->vflip; return 0; } static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->freqfltr = val; if (gspca_dev->streaming) setfreqfltr(gspca_dev); return 0; } static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; *val = sd->freqfltr; return 0; } } static int sd_querymenu(struct gspca_dev *gspca_dev, static int sd_querymenu(struct gspca_dev *gspca_dev, Loading