diff options
Diffstat (limited to 'drivers/media/usb/gspca/ov519.c')
-rw-r--r-- | drivers/media/usb/gspca/ov519.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c index 8937d79fd176..c95f32a0c02b 100644 --- a/drivers/media/usb/gspca/ov519.c +++ b/drivers/media/usb/gspca/ov519.c | |||
@@ -3468,7 +3468,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) | |||
3468 | 3468 | ||
3469 | switch (sd->bridge) { | 3469 | switch (sd->bridge) { |
3470 | case BRIDGE_OVFX2: | 3470 | case BRIDGE_OVFX2: |
3471 | if (gspca_dev->width != 800) | 3471 | if (gspca_dev->pixfmt.width != 800) |
3472 | gspca_dev->cam.bulk_size = OVFX2_BULK_SIZE; | 3472 | gspca_dev->cam.bulk_size = OVFX2_BULK_SIZE; |
3473 | else | 3473 | else |
3474 | gspca_dev->cam.bulk_size = 7 * 4096; | 3474 | gspca_dev->cam.bulk_size = 7 * 4096; |
@@ -3507,8 +3507,8 @@ static void ov511_mode_init_regs(struct sd *sd) | |||
3507 | /* Here I'm assuming that snapshot size == image size. | 3507 | /* Here I'm assuming that snapshot size == image size. |
3508 | * I hope that's always true. --claudio | 3508 | * I hope that's always true. --claudio |
3509 | */ | 3509 | */ |
3510 | hsegs = (sd->gspca_dev.width >> 3) - 1; | 3510 | hsegs = (sd->gspca_dev.pixfmt.width >> 3) - 1; |
3511 | vsegs = (sd->gspca_dev.height >> 3) - 1; | 3511 | vsegs = (sd->gspca_dev.pixfmt.height >> 3) - 1; |
3512 | 3512 | ||
3513 | reg_w(sd, R511_CAM_PXCNT, hsegs); | 3513 | reg_w(sd, R511_CAM_PXCNT, hsegs); |
3514 | reg_w(sd, R511_CAM_LNCNT, vsegs); | 3514 | reg_w(sd, R511_CAM_LNCNT, vsegs); |
@@ -3541,7 +3541,7 @@ static void ov511_mode_init_regs(struct sd *sd) | |||
3541 | case SEN_OV7640: | 3541 | case SEN_OV7640: |
3542 | case SEN_OV7648: | 3542 | case SEN_OV7648: |
3543 | case SEN_OV76BE: | 3543 | case SEN_OV76BE: |
3544 | if (sd->gspca_dev.width == 320) | 3544 | if (sd->gspca_dev.pixfmt.width == 320) |
3545 | interlaced = 1; | 3545 | interlaced = 1; |
3546 | /* Fall through */ | 3546 | /* Fall through */ |
3547 | case SEN_OV6630: | 3547 | case SEN_OV6630: |
@@ -3551,7 +3551,7 @@ static void ov511_mode_init_regs(struct sd *sd) | |||
3551 | case 30: | 3551 | case 30: |
3552 | case 25: | 3552 | case 25: |
3553 | /* Not enough bandwidth to do 640x480 @ 30 fps */ | 3553 | /* Not enough bandwidth to do 640x480 @ 30 fps */ |
3554 | if (sd->gspca_dev.width != 640) { | 3554 | if (sd->gspca_dev.pixfmt.width != 640) { |
3555 | sd->clockdiv = 0; | 3555 | sd->clockdiv = 0; |
3556 | break; | 3556 | break; |
3557 | } | 3557 | } |
@@ -3584,7 +3584,8 @@ static void ov511_mode_init_regs(struct sd *sd) | |||
3584 | 3584 | ||
3585 | /* Check if we have enough bandwidth to disable compression */ | 3585 | /* Check if we have enough bandwidth to disable compression */ |
3586 | fps = (interlaced ? 60 : 30) / (sd->clockdiv + 1) + 1; | 3586 | fps = (interlaced ? 60 : 30) / (sd->clockdiv + 1) + 1; |
3587 | needed = fps * sd->gspca_dev.width * sd->gspca_dev.height * 3 / 2; | 3587 | needed = fps * sd->gspca_dev.pixfmt.width * |
3588 | sd->gspca_dev.pixfmt.height * 3 / 2; | ||
3588 | /* 1000 isoc packets/sec */ | 3589 | /* 1000 isoc packets/sec */ |
3589 | if (needed > 1000 * packet_size) { | 3590 | if (needed > 1000 * packet_size) { |
3590 | /* Enable Y and UV quantization and compression */ | 3591 | /* Enable Y and UV quantization and compression */ |
@@ -3646,8 +3647,8 @@ static void ov518_mode_init_regs(struct sd *sd) | |||
3646 | reg_w(sd, 0x38, 0x80); | 3647 | reg_w(sd, 0x38, 0x80); |
3647 | } | 3648 | } |
3648 | 3649 | ||
3649 | hsegs = sd->gspca_dev.width / 16; | 3650 | hsegs = sd->gspca_dev.pixfmt.width / 16; |
3650 | vsegs = sd->gspca_dev.height / 4; | 3651 | vsegs = sd->gspca_dev.pixfmt.height / 4; |
3651 | 3652 | ||
3652 | reg_w(sd, 0x29, hsegs); | 3653 | reg_w(sd, 0x29, hsegs); |
3653 | reg_w(sd, 0x2a, vsegs); | 3654 | reg_w(sd, 0x2a, vsegs); |
@@ -3686,7 +3687,8 @@ static void ov518_mode_init_regs(struct sd *sd) | |||
3686 | * happened to be with revision < 2 cams using an | 3687 | * happened to be with revision < 2 cams using an |
3687 | * OV7620 and revision 2 cams using an OV7620AE. | 3688 | * OV7620 and revision 2 cams using an OV7620AE. |
3688 | */ | 3689 | */ |
3689 | if (sd->revision > 0 && sd->gspca_dev.width == 640) { | 3690 | if (sd->revision > 0 && |
3691 | sd->gspca_dev.pixfmt.width == 640) { | ||
3690 | reg_w(sd, 0x20, 0x60); | 3692 | reg_w(sd, 0x20, 0x60); |
3691 | reg_w(sd, 0x21, 0x1f); | 3693 | reg_w(sd, 0x21, 0x1f); |
3692 | } else { | 3694 | } else { |
@@ -3812,8 +3814,8 @@ static void ov519_mode_init_regs(struct sd *sd) | |||
3812 | break; | 3814 | break; |
3813 | } | 3815 | } |
3814 | 3816 | ||
3815 | reg_w(sd, OV519_R10_H_SIZE, sd->gspca_dev.width >> 4); | 3817 | reg_w(sd, OV519_R10_H_SIZE, sd->gspca_dev.pixfmt.width >> 4); |
3816 | reg_w(sd, OV519_R11_V_SIZE, sd->gspca_dev.height >> 3); | 3818 | reg_w(sd, OV519_R11_V_SIZE, sd->gspca_dev.pixfmt.height >> 3); |
3817 | if (sd->sensor == SEN_OV7670 && | 3819 | if (sd->sensor == SEN_OV7670 && |
3818 | sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv) | 3820 | sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv) |
3819 | reg_w(sd, OV519_R12_X_OFFSETL, 0x04); | 3821 | reg_w(sd, OV519_R12_X_OFFSETL, 0x04); |
@@ -3947,14 +3949,16 @@ static void mode_init_ov_sensor_regs(struct sd *sd) | |||
3947 | } | 3949 | } |
3948 | case SEN_OV3610: | 3950 | case SEN_OV3610: |
3949 | if (qvga) { | 3951 | if (qvga) { |
3950 | xstart = (1040 - gspca_dev->width) / 2 + (0x1f << 4); | 3952 | xstart = (1040 - gspca_dev->pixfmt.width) / 2 + |
3951 | ystart = (776 - gspca_dev->height) / 2; | 3953 | (0x1f << 4); |
3954 | ystart = (776 - gspca_dev->pixfmt.height) / 2; | ||
3952 | } else { | 3955 | } else { |
3953 | xstart = (2076 - gspca_dev->width) / 2 + (0x10 << 4); | 3956 | xstart = (2076 - gspca_dev->pixfmt.width) / 2 + |
3954 | ystart = (1544 - gspca_dev->height) / 2; | 3957 | (0x10 << 4); |
3958 | ystart = (1544 - gspca_dev->pixfmt.height) / 2; | ||
3955 | } | 3959 | } |
3956 | xend = xstart + gspca_dev->width; | 3960 | xend = xstart + gspca_dev->pixfmt.width; |
3957 | yend = ystart + gspca_dev->height; | 3961 | yend = ystart + gspca_dev->pixfmt.height; |
3958 | /* Writing to the COMH register resets the other windowing regs | 3962 | /* Writing to the COMH register resets the other windowing regs |
3959 | to their default values, so we must do this first. */ | 3963 | to their default values, so we must do this first. */ |
3960 | i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0xf0); | 3964 | i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0xf0); |
@@ -4229,8 +4233,8 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
4229 | struct sd *sd = (struct sd *) gspca_dev; | 4233 | struct sd *sd = (struct sd *) gspca_dev; |
4230 | 4234 | ||
4231 | /* Default for most bridges, allow bridge_mode_init_regs to override */ | 4235 | /* Default for most bridges, allow bridge_mode_init_regs to override */ |
4232 | sd->sensor_width = sd->gspca_dev.width; | 4236 | sd->sensor_width = sd->gspca_dev.pixfmt.width; |
4233 | sd->sensor_height = sd->gspca_dev.height; | 4237 | sd->sensor_height = sd->gspca_dev.pixfmt.height; |
4234 | 4238 | ||
4235 | switch (sd->bridge) { | 4239 | switch (sd->bridge) { |
4236 | case BRIDGE_OV511: | 4240 | case BRIDGE_OV511: |
@@ -4345,12 +4349,13 @@ static void ov511_pkt_scan(struct gspca_dev *gspca_dev, | |||
4345 | ov51x_handle_button(gspca_dev, (in[8] >> 2) & 1); | 4349 | ov51x_handle_button(gspca_dev, (in[8] >> 2) & 1); |
4346 | if (in[8] & 0x80) { | 4350 | if (in[8] & 0x80) { |
4347 | /* Frame end */ | 4351 | /* Frame end */ |
4348 | if ((in[9] + 1) * 8 != gspca_dev->width || | 4352 | if ((in[9] + 1) * 8 != gspca_dev->pixfmt.width || |
4349 | (in[10] + 1) * 8 != gspca_dev->height) { | 4353 | (in[10] + 1) * 8 != gspca_dev->pixfmt.height) { |
4350 | PERR("Invalid frame size, got: %dx%d," | 4354 | PERR("Invalid frame size, got: %dx%d," |
4351 | " requested: %dx%d\n", | 4355 | " requested: %dx%d\n", |
4352 | (in[9] + 1) * 8, (in[10] + 1) * 8, | 4356 | (in[9] + 1) * 8, (in[10] + 1) * 8, |
4353 | gspca_dev->width, gspca_dev->height); | 4357 | gspca_dev->pixfmt.width, |
4358 | gspca_dev->pixfmt.height); | ||
4354 | gspca_dev->last_packet_type = DISCARD_PACKET; | 4359 | gspca_dev->last_packet_type = DISCARD_PACKET; |
4355 | return; | 4360 | return; |
4356 | } | 4361 | } |
@@ -4470,7 +4475,8 @@ static void ovfx2_pkt_scan(struct gspca_dev *gspca_dev, | |||
4470 | if (sd->first_frame) { | 4475 | if (sd->first_frame) { |
4471 | sd->first_frame--; | 4476 | sd->first_frame--; |
4472 | if (gspca_dev->image_len < | 4477 | if (gspca_dev->image_len < |
4473 | sd->gspca_dev.width * sd->gspca_dev.height) | 4478 | sd->gspca_dev.pixfmt.width * |
4479 | sd->gspca_dev.pixfmt.height) | ||
4474 | gspca_dev->last_packet_type = DISCARD_PACKET; | 4480 | gspca_dev->last_packet_type = DISCARD_PACKET; |
4475 | } | 4481 | } |
4476 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); | 4482 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |