diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-07-06 04:00:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 15:42:50 -0400 |
commit | fe854ec07cada95296e882aa795db83409c61eeb (patch) | |
tree | cd55cd23072c534116bf61d12ba8414929a025bb /drivers | |
parent | 98475cb642b520a5d50bd6d6abaadfee8688c110 (diff) |
V4L/DVB: gspca - vc032x: Stop the USB exchanges on error
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 152 |
1 files changed, 87 insertions, 65 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index de9e4f9e59c1..c9df1ac5dff5 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -3073,13 +3073,21 @@ static void reg_r(struct gspca_dev *gspca_dev, | |||
3073 | u16 index, | 3073 | u16 index, |
3074 | u16 len) | 3074 | u16 len) |
3075 | { | 3075 | { |
3076 | usb_control_msg(gspca_dev->dev, | 3076 | int ret; |
3077 | |||
3078 | if (gspca_dev->usb_err < 0) | ||
3079 | return; | ||
3080 | ret = usb_control_msg(gspca_dev->dev, | ||
3077 | usb_rcvctrlpipe(gspca_dev->dev, 0), | 3081 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
3078 | req, | 3082 | req, |
3079 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 3083 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3080 | 1, /* value */ | 3084 | 1, /* value */ |
3081 | index, gspca_dev->usb_buf, len, | 3085 | index, gspca_dev->usb_buf, len, |
3082 | 500); | 3086 | 500); |
3087 | if (ret < 0) { | ||
3088 | PDEBUG(D_ERR, "reg_r err %d", ret); | ||
3089 | gspca_dev->usb_err = ret; | ||
3090 | } | ||
3083 | } | 3091 | } |
3084 | 3092 | ||
3085 | static void reg_w(struct usb_device *dev, | 3093 | static void reg_w(struct usb_device *dev, |
@@ -3087,18 +3095,37 @@ static void reg_w(struct usb_device *dev, | |||
3087 | u16 value, | 3095 | u16 value, |
3088 | u16 index) | 3096 | u16 index) |
3089 | { | 3097 | { |
3090 | usb_control_msg(dev, | 3098 | int ret; |
3091 | usb_sndctrlpipe(dev, 0), | 3099 | |
3100 | if (gspca_dev->usb_err < 0) | ||
3101 | return; | ||
3102 | ret = usb_control_msg(gspca_dev->dev, | ||
3103 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
3092 | req, | 3104 | req, |
3093 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 3105 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3094 | value, index, NULL, 0, | 3106 | value, index, NULL, 0, |
3095 | 500); | 3107 | 500); |
3108 | if (ret < 0) { | ||
3109 | PDEBUG(D_ERR, "reg_w err %d", ret); | ||
3110 | gspca_dev->usb_err = ret; | ||
3111 | } | ||
3112 | } | ||
3113 | static void reg_w(struct gspca_dev *gspca_dev, | ||
3114 | u16 req, | ||
3115 | u16 value, | ||
3116 | u16 index) | ||
3117 | { | ||
3118 | #ifdef GSPCA_DEBUG | ||
3119 | if (gspca_dev->usb_err < 0) | ||
3120 | return; | ||
3121 | PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index); | ||
3122 | #endif | ||
3123 | reg_w_i(gspca_dev, req, value, index); | ||
3096 | } | 3124 | } |
3097 | 3125 | ||
3098 | static u16 read_sensor_register(struct gspca_dev *gspca_dev, | 3126 | static u16 read_sensor_register(struct gspca_dev *gspca_dev, |
3099 | u16 address) | 3127 | u16 address) |
3100 | { | 3128 | { |
3101 | struct usb_device *dev = gspca_dev->dev; | ||
3102 | u8 ldata, mdata, hdata; | 3129 | u8 ldata, mdata, hdata; |
3103 | int retry = 50; | 3130 | int retry = 50; |
3104 | 3131 | ||
@@ -3108,8 +3135,8 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, | |||
3108 | gspca_dev->usb_buf[0]); | 3135 | gspca_dev->usb_buf[0]); |
3109 | return 0; | 3136 | return 0; |
3110 | } | 3137 | } |
3111 | reg_w(dev, 0xa0, address, 0xb33a); | 3138 | reg_w(gspca_dev, 0xa0, address, 0xb33a); |
3112 | reg_w(dev, 0xa0, 0x02, 0xb339); | 3139 | reg_w(gspca_dev, 0xa0, 0x02, 0xb339); |
3113 | 3140 | ||
3114 | do { | 3141 | do { |
3115 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); | 3142 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); |
@@ -3136,15 +3163,15 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, | |||
3136 | static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) | 3163 | static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) |
3137 | { | 3164 | { |
3138 | struct sd *sd = (struct sd *) gspca_dev; | 3165 | struct sd *sd = (struct sd *) gspca_dev; |
3139 | struct usb_device *dev = gspca_dev->dev; | ||
3140 | int i, n; | 3166 | int i, n; |
3141 | u16 value; | 3167 | u16 value; |
3142 | const struct sensor_info *ptsensor_info; | 3168 | const struct sensor_info *ptsensor_info; |
3143 | 3169 | ||
3144 | /*fixme: should also check the other sensor (back mi1320_soc, front mc501cb)*/ | 3170 | /*fixme: should also check the other sensor (back mi1320_soc, front mc501cb)*/ |
3145 | if (sd->flags & FL_SAMSUNG) { | 3171 | if (sd->flags & FL_SAMSUNG) { |
3146 | reg_w(dev, 0xa0, 0x01, 0xb301); | 3172 | reg_w(gspca_dev, 0xa0, 0x01, 0xb301); |
3147 | reg_w(dev, 0x89, 0xf0ff, 0xffff); /* select the back sensor */ | 3173 | reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff); |
3174 | /* select the back sensor */ | ||
3148 | } | 3175 | } |
3149 | 3176 | ||
3150 | reg_r(gspca_dev, 0xa1, 0xbfcf, 1); | 3177 | reg_r(gspca_dev, 0xa1, 0xbfcf, 1); |
@@ -3158,13 +3185,13 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) | |||
3158 | n = ARRAY_SIZE(vc0323_probe_data); | 3185 | n = ARRAY_SIZE(vc0323_probe_data); |
3159 | } | 3186 | } |
3160 | for (i = 0; i < n; i++) { | 3187 | for (i = 0; i < n; i++) { |
3161 | reg_w(dev, 0xa0, 0x02, 0xb334); | 3188 | reg_w(gspca_dev, 0xa0, 0x02, 0xb334); |
3162 | reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300); | 3189 | reg_w(gspca_dev, 0xa0, ptsensor_info->m1, 0xb300); |
3163 | reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300); | 3190 | reg_w(gspca_dev, 0xa0, ptsensor_info->m2, 0xb300); |
3164 | reg_w(dev, 0xa0, 0x01, 0xb308); | 3191 | reg_w(gspca_dev, 0xa0, 0x01, 0xb308); |
3165 | reg_w(dev, 0xa0, 0x0c, 0xb309); | 3192 | reg_w(gspca_dev, 0xa0, 0x0c, 0xb309); |
3166 | reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); | 3193 | reg_w(gspca_dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); |
3167 | reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); | 3194 | reg_w(gspca_dev, 0xa0, ptsensor_info->op, 0xb301); |
3168 | value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); | 3195 | value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); |
3169 | if (value == 0 && ptsensor_info->IdAdd == 0x82) | 3196 | if (value == 0 && ptsensor_info->IdAdd == 0x82) |
3170 | value = read_sensor_register(gspca_dev, 0x83); | 3197 | value = read_sensor_register(gspca_dev, 0x83); |
@@ -3192,17 +3219,16 @@ static void i2c_write(struct gspca_dev *gspca_dev, | |||
3192 | u8 reg, const u8 *val, | 3219 | u8 reg, const u8 *val, |
3193 | u8 size) /* 1 or 2 */ | 3220 | u8 size) /* 1 or 2 */ |
3194 | { | 3221 | { |
3195 | struct usb_device *dev = gspca_dev->dev; | ||
3196 | int retry; | 3222 | int retry; |
3197 | 3223 | ||
3198 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); | 3224 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); |
3199 | /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/ | 3225 | /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/ |
3200 | reg_w(dev, 0xa0, size, 0xb334); | 3226 | reg_w(gspca_dev, 0xa0, size, 0xb334); |
3201 | reg_w(dev, 0xa0, reg, 0xb33a); | 3227 | reg_w(gspca_dev, 0xa0, reg, 0xb33a); |
3202 | reg_w(dev, 0xa0, val[0], 0xb336); | 3228 | reg_w(gspca_dev, 0xa0, val[0], 0xb336); |
3203 | if (size > 1) | 3229 | if (size > 1) |
3204 | reg_w(dev, 0xa0, val[1], 0xb337); | 3230 | reg_w(gspca_dev, 0xa0, val[1], 0xb337); |
3205 | reg_w(dev, 0xa0, 0x01, 0xb339); | 3231 | reg_w(gspca_dev, 0xa0, 0x01, 0xb339); |
3206 | retry = 4; | 3232 | retry = 4; |
3207 | do { | 3233 | do { |
3208 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); | 3234 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); |
@@ -3221,13 +3247,12 @@ static void put_tab_to_reg(struct gspca_dev *gspca_dev, | |||
3221 | u16 ad = addr; | 3247 | u16 ad = addr; |
3222 | 3248 | ||
3223 | for (j = 0; j < tabsize; j++) | 3249 | for (j = 0; j < tabsize; j++) |
3224 | reg_w(gspca_dev->dev, 0xa0, tab[j], ad++); | 3250 | reg_w(gspca_dev, 0xa0, tab[j], ad++); |
3225 | } | 3251 | } |
3226 | 3252 | ||
3227 | static void usb_exchange(struct gspca_dev *gspca_dev, | 3253 | static void usb_exchange(struct gspca_dev *gspca_dev, |
3228 | const u8 data[][4]) | 3254 | const u8 data[][4]) |
3229 | { | 3255 | { |
3230 | struct usb_device *dev = gspca_dev->dev; | ||
3231 | int i = 0; | 3256 | int i = 0; |
3232 | 3257 | ||
3233 | for (;;) { | 3258 | for (;;) { |
@@ -3235,7 +3260,7 @@ static void usb_exchange(struct gspca_dev *gspca_dev, | |||
3235 | default: | 3260 | default: |
3236 | return; | 3261 | return; |
3237 | case 0xcc: /* normal write */ | 3262 | case 0xcc: /* normal write */ |
3238 | reg_w(dev, 0xa0, data[i][2], | 3263 | reg_w(gspca_dev, 0xa0, data[i][2], |
3239 | (data[i][0]) << 8 | data[i][1]); | 3264 | (data[i][0]) << 8 | data[i][1]); |
3240 | break; | 3265 | break; |
3241 | case 0xaa: /* i2c op */ | 3266 | case 0xaa: /* i2c op */ |
@@ -3259,7 +3284,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
3259 | const struct usb_device_id *id) | 3284 | const struct usb_device_id *id) |
3260 | { | 3285 | { |
3261 | struct sd *sd = (struct sd *) gspca_dev; | 3286 | struct sd *sd = (struct sd *) gspca_dev; |
3262 | struct usb_device *dev = gspca_dev->dev; | ||
3263 | struct cam *cam; | 3287 | struct cam *cam; |
3264 | int sensor; | 3288 | int sensor; |
3265 | static u8 npkt[] = { /* number of packets per ISOC message */ | 3289 | static u8 npkt[] = { /* number of packets per ISOC message */ |
@@ -3365,10 +3389,10 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
3365 | 3389 | ||
3366 | if (sd->bridge == BRIDGE_VC0321) { | 3390 | if (sd->bridge == BRIDGE_VC0321) { |
3367 | reg_r(gspca_dev, 0x8a, 0, 3); | 3391 | reg_r(gspca_dev, 0x8a, 0, 3); |
3368 | reg_w(dev, 0x87, 0x00, 0x0f0f); | 3392 | reg_w(gspca_dev, 0x87, 0x00, 0x0f0f); |
3369 | 3393 | ||
3370 | reg_r(gspca_dev, 0x8b, 0, 3); | 3394 | reg_r(gspca_dev, 0x8b, 0, 3); |
3371 | reg_w(dev, 0x88, 0x00, 0x0202); | 3395 | reg_w(gspca_dev, 0x88, 0x00, 0x0202); |
3372 | } | 3396 | } |
3373 | return 0; | 3397 | return 0; |
3374 | } | 3398 | } |
@@ -3381,12 +3405,12 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
3381 | if (sd->sensor == SENSOR_POxxxx) { | 3405 | if (sd->sensor == SENSOR_POxxxx) { |
3382 | reg_r(gspca_dev, 0xa1, 0xb300, 1); | 3406 | reg_r(gspca_dev, 0xa1, 0xb300, 1); |
3383 | if (gspca_dev->usb_buf[0] != 0) { | 3407 | if (gspca_dev->usb_buf[0] != 0) { |
3384 | reg_w(gspca_dev->dev, 0xa0, 0x26, 0xb300); | 3408 | reg_w(gspca_dev, 0xa0, 0x26, 0xb300); |
3385 | reg_w(gspca_dev->dev, 0xa0, 0x04, 0xb300); | 3409 | reg_w(gspca_dev, 0xa0, 0x04, 0xb300); |
3386 | reg_w(gspca_dev->dev, 0xa0, 0x00, 0xb300); | 3410 | reg_w(gspca_dev, 0xa0, 0x00, 0xb300); |
3387 | } | 3411 | } |
3388 | } | 3412 | } |
3389 | return 0; | 3413 | return gspca_dev->usb_err; |
3390 | } | 3414 | } |
3391 | 3415 | ||
3392 | static void setbrightness(struct gspca_dev *gspca_dev) | 3416 | static void setbrightness(struct gspca_dev *gspca_dev) |
@@ -3516,17 +3540,17 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3516 | 3540 | ||
3517 | /*fixme: back sensor only*/ | 3541 | /*fixme: back sensor only*/ |
3518 | if (sd->flags & FL_SAMSUNG) { | 3542 | if (sd->flags & FL_SAMSUNG) { |
3519 | reg_w(gspca_dev->dev, 0x89, 0xf0ff, 0xffff); | 3543 | reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff); |
3520 | reg_w(gspca_dev->dev, 0xa9, 0x8348, 0x000e); | 3544 | reg_w(gspca_dev, 0xa9, 0x8348, 0x000e); |
3521 | reg_w(gspca_dev->dev, 0xa9, 0x0000, 0x001a); | 3545 | reg_w(gspca_dev, 0xa9, 0x0000, 0x001a); |
3522 | } | 3546 | } |
3523 | 3547 | ||
3524 | /* Assume start use the good resolution from gspca_dev->mode */ | 3548 | /* Assume start use the good resolution from gspca_dev->mode */ |
3525 | if (sd->bridge == BRIDGE_VC0321) { | 3549 | if (sd->bridge == BRIDGE_VC0321) { |
3526 | reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfec); | 3550 | reg_w(gspca_dev, 0xa0, 0xff, 0xbfec); |
3527 | reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfed); | 3551 | reg_w(gspca_dev, 0xa0, 0xff, 0xbfed); |
3528 | reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfee); | 3552 | reg_w(gspca_dev, 0xa0, 0xff, 0xbfee); |
3529 | reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef); | 3553 | reg_w(gspca_dev, 0xa0, 0xff, 0xbfef); |
3530 | sd->image_offset = 46; | 3554 | sd->image_offset = 46; |
3531 | } else { | 3555 | } else { |
3532 | if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat | 3556 | if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat |
@@ -3617,7 +3641,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3617 | init = poxxxx_initVGA; | 3641 | init = poxxxx_initVGA; |
3618 | usb_exchange(gspca_dev, init); | 3642 | usb_exchange(gspca_dev, init); |
3619 | reg_r(gspca_dev, 0x8c, 0x0000, 3); | 3643 | reg_r(gspca_dev, 0x8c, 0x0000, 3); |
3620 | reg_w(gspca_dev->dev, 0xa0, | 3644 | reg_w(gspca_dev, 0xa0, |
3621 | gspca_dev->usb_buf[2] & 1 ? 0 : 1, | 3645 | gspca_dev->usb_buf[2] & 1 ? 0 : 1, |
3622 | 0xb35c); | 3646 | 0xb35c); |
3623 | msleep(300); | 3647 | msleep(300); |
@@ -3635,10 +3659,10 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3635 | switch (sd->sensor) { | 3659 | switch (sd->sensor) { |
3636 | case SENSOR_PO1200: | 3660 | case SENSOR_PO1200: |
3637 | case SENSOR_HV7131R: | 3661 | case SENSOR_HV7131R: |
3638 | reg_w(gspca_dev->dev, 0x89, 0x0400, 0x1415); | 3662 | reg_w(gspca_dev, 0x89, 0x0400, 0x1415); |
3639 | break; | 3663 | break; |
3640 | case SENSOR_MI1310_SOC: | 3664 | case SENSOR_MI1310_SOC: |
3641 | reg_w(gspca_dev->dev, 0x89, 0x058c, 0x0000); | 3665 | reg_w(gspca_dev, 0x89, 0x058c, 0x0000); |
3642 | break; | 3666 | break; |
3643 | } | 3667 | } |
3644 | msleep(100); | 3668 | msleep(100); |
@@ -3648,9 +3672,9 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3648 | } | 3672 | } |
3649 | switch (sd->sensor) { | 3673 | switch (sd->sensor) { |
3650 | case SENSOR_OV7670: | 3674 | case SENSOR_OV7670: |
3651 | reg_w(gspca_dev->dev, 0x87, 0xffff, 0xffff); | 3675 | reg_w(gspca_dev, 0x87, 0xffff, 0xffff); |
3652 | reg_w(gspca_dev->dev, 0x88, 0xff00, 0xf0f1); | 3676 | reg_w(gspca_dev, 0x88, 0xff00, 0xf0f1); |
3653 | reg_w(gspca_dev->dev, 0xa0, 0x0000, 0xbfff); | 3677 | reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff); |
3654 | break; | 3678 | break; |
3655 | case SENSOR_POxxxx: | 3679 | case SENSOR_POxxxx: |
3656 | setcolors(gspca_dev); | 3680 | setcolors(gspca_dev); |
@@ -3659,51 +3683,49 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3659 | 3683 | ||
3660 | /* led on */ | 3684 | /* led on */ |
3661 | msleep(80); | 3685 | msleep(80); |
3662 | reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff); | 3686 | reg_w(gspca_dev, 0x89, 0xffff, 0xfdff); |
3663 | usb_exchange(gspca_dev, poxxxx_init_end_2); | 3687 | usb_exchange(gspca_dev, poxxxx_init_end_2); |
3664 | break; | 3688 | break; |
3665 | } | 3689 | } |
3666 | return 0; | 3690 | return gspca_dev->usb_err; |
3667 | } | 3691 | } |
3668 | 3692 | ||
3669 | static void sd_stopN(struct gspca_dev *gspca_dev) | 3693 | static void sd_stopN(struct gspca_dev *gspca_dev) |
3670 | { | 3694 | { |
3671 | struct usb_device *dev = gspca_dev->dev; | ||
3672 | struct sd *sd = (struct sd *) gspca_dev; | 3695 | struct sd *sd = (struct sd *) gspca_dev; |
3673 | 3696 | ||
3674 | switch (sd->sensor) { | 3697 | switch (sd->sensor) { |
3675 | case SENSOR_MI1310_SOC: | 3698 | case SENSOR_MI1310_SOC: |
3676 | reg_w(dev, 0x89, 0x058c, 0x00ff); | 3699 | reg_w(gspca_dev, 0x89, 0x058c, 0x00ff); |
3677 | break; | 3700 | break; |
3678 | case SENSOR_POxxxx: | 3701 | case SENSOR_POxxxx: |
3679 | return; | 3702 | return; |
3680 | default: | 3703 | default: |
3681 | if (!(sd->flags & FL_SAMSUNG)) | 3704 | if (!(sd->flags & FL_SAMSUNG)) |
3682 | reg_w(dev, 0x89, 0xffff, 0xffff); | 3705 | reg_w(gspca_dev, 0x89, 0xffff, 0xffff); |
3683 | break; | 3706 | break; |
3684 | } | 3707 | } |
3685 | reg_w(dev, 0xa0, 0x01, 0xb301); | 3708 | reg_w(gspca_dev, 0xa0, 0x01, 0xb301); |
3686 | reg_w(dev, 0xa0, 0x09, 0xb003); | 3709 | reg_w(gspca_dev, 0xa0, 0x09, 0xb003); |
3687 | } | 3710 | } |
3688 | 3711 | ||
3689 | /* called on streamoff with alt 0 and on disconnect */ | 3712 | /* called on streamoff with alt 0 and on disconnect */ |
3690 | static void sd_stop0(struct gspca_dev *gspca_dev) | 3713 | static void sd_stop0(struct gspca_dev *gspca_dev) |
3691 | { | 3714 | { |
3692 | struct usb_device *dev = gspca_dev->dev; | ||
3693 | struct sd *sd = (struct sd *) gspca_dev; | 3715 | struct sd *sd = (struct sd *) gspca_dev; |
3694 | 3716 | ||
3695 | if (!gspca_dev->present) | 3717 | if (!gspca_dev->present) |
3696 | return; | 3718 | return; |
3697 | /*fixme: is this useful?*/ | 3719 | /*fixme: is this useful?*/ |
3698 | if (sd->sensor == SENSOR_MI1310_SOC) | 3720 | if (sd->sensor == SENSOR_MI1310_SOC) |
3699 | reg_w(dev, 0x89, 0x058c, 0x00ff); | 3721 | reg_w(gspca_dev, 0x89, 0x058c, 0x00ff); |
3700 | else if (!(sd->flags & FL_SAMSUNG)) | 3722 | else if (!(sd->flags & FL_SAMSUNG)) |
3701 | reg_w(dev, 0x89, 0xffff, 0xffff); | 3723 | reg_w(gspca_dev, 0x89, 0xffff, 0xffff); |
3702 | 3724 | ||
3703 | if (sd->sensor == SENSOR_POxxxx) { | 3725 | if (sd->sensor == SENSOR_POxxxx) { |
3704 | reg_w(dev, 0xa0, 0x26, 0xb300); | 3726 | reg_w(gspca_dev, 0xa0, 0x26, 0xb300); |
3705 | reg_w(dev, 0xa0, 0x04, 0xb300); | 3727 | reg_w(gspca_dev, 0xa0, 0x04, 0xb300); |
3706 | reg_w(dev, 0xa0, 0x00, 0xb300); | 3728 | reg_w(gspca_dev, 0xa0, 0x00, 0xb300); |
3707 | } | 3729 | } |
3708 | } | 3730 | } |
3709 | 3731 | ||
@@ -3743,7 +3765,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | |||
3743 | sd->brightness = val; | 3765 | sd->brightness = val; |
3744 | if (gspca_dev->streaming) | 3766 | if (gspca_dev->streaming) |
3745 | setbrightness(gspca_dev); | 3767 | setbrightness(gspca_dev); |
3746 | return 0; | 3768 | return gspca_dev->usb_err; |
3747 | } | 3769 | } |
3748 | 3770 | ||
3749 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | 3771 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3761,7 +3783,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | |||
3761 | sd->contrast = val; | 3783 | sd->contrast = val; |
3762 | if (gspca_dev->streaming) | 3784 | if (gspca_dev->streaming) |
3763 | setcontrast(gspca_dev); | 3785 | setcontrast(gspca_dev); |
3764 | return 0; | 3786 | return gspca_dev->usb_err; |
3765 | } | 3787 | } |
3766 | 3788 | ||
3767 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) | 3789 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3779,7 +3801,7 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val) | |||
3779 | sd->colors = val; | 3801 | sd->colors = val; |
3780 | if (gspca_dev->streaming) | 3802 | if (gspca_dev->streaming) |
3781 | setcolors(gspca_dev); | 3803 | setcolors(gspca_dev); |
3782 | return 0; | 3804 | return gspca_dev->usb_err; |
3783 | } | 3805 | } |
3784 | 3806 | ||
3785 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) | 3807 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3797,7 +3819,7 @@ static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val) | |||
3797 | sd->hflip = val; | 3819 | sd->hflip = val; |
3798 | if (gspca_dev->streaming) | 3820 | if (gspca_dev->streaming) |
3799 | sethvflip(gspca_dev); | 3821 | sethvflip(gspca_dev); |
3800 | return 0; | 3822 | return gspca_dev->usb_err; |
3801 | } | 3823 | } |
3802 | 3824 | ||
3803 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val) | 3825 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3815,7 +3837,7 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) | |||
3815 | sd->vflip = val; | 3837 | sd->vflip = val; |
3816 | if (gspca_dev->streaming) | 3838 | if (gspca_dev->streaming) |
3817 | sethvflip(gspca_dev); | 3839 | sethvflip(gspca_dev); |
3818 | return 0; | 3840 | return gspca_dev->usb_err; |
3819 | } | 3841 | } |
3820 | 3842 | ||
3821 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) | 3843 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3833,7 +3855,7 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val) | |||
3833 | sd->lightfreq = val; | 3855 | sd->lightfreq = val; |
3834 | if (gspca_dev->streaming) | 3856 | if (gspca_dev->streaming) |
3835 | setlightfreq(gspca_dev); | 3857 | setlightfreq(gspca_dev); |
3836 | return 0; | 3858 | return gspca_dev->usb_err; |
3837 | } | 3859 | } |
3838 | 3860 | ||
3839 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) | 3861 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -3851,7 +3873,7 @@ static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) | |||
3851 | sd->sharpness = val; | 3873 | sd->sharpness = val; |
3852 | if (gspca_dev->streaming) | 3874 | if (gspca_dev->streaming) |
3853 | setsharpness(gspca_dev); | 3875 | setsharpness(gspca_dev); |
3854 | return 0; | 3876 | return gspca_dev->usb_err; |
3855 | } | 3877 | } |
3856 | 3878 | ||
3857 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | 3879 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) |