Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] gspca: store current mode instead of individual parameters

Store complete current mode (struct v4l2_pix_format) in struct gspca_dev
instead of separate pixfmt, width and height parameters.
This is a preparation for variable resolution support.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Ondrej Zary and committed by
Mauro Carvalho Chehab
1966bc2a 08149ecf

+146 -136
+2 -1
drivers/media/usb/gspca/conex.c
··· 783 783 struct sd *sd = (struct sd *) gspca_dev; 784 784 785 785 /* create the JPEG header */ 786 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 786 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 787 + gspca_dev->pixfmt.width, 787 788 0x22); /* JPEG 411 */ 788 789 jpeg_set_qual(sd->jpeg_hdr, QUALITY); 789 790
+2 -2
drivers/media/usb/gspca/cpia1.c
··· 1553 1553 sd->params.format.videoSize = VIDEOSIZE_CIF; 1554 1554 1555 1555 sd->params.roi.colEnd = sd->params.roi.colStart + 1556 - (gspca_dev->width >> 3); 1556 + (gspca_dev->pixfmt.width >> 3); 1557 1557 sd->params.roi.rowEnd = sd->params.roi.rowStart + 1558 - (gspca_dev->height >> 2); 1558 + (gspca_dev->pixfmt.height >> 2); 1559 1559 1560 1560 /* And now set the camera to a known state */ 1561 1561 ret = do_command(gspca_dev, CPIA_COMMAND_SetGrabMode,
+11 -19
drivers/media/usb/gspca/gspca.c
··· 504 504 unsigned int frsz; 505 505 int i; 506 506 507 - i = gspca_dev->curr_mode; 508 - frsz = gspca_dev->cam.cam_mode[i].sizeimage; 507 + frsz = gspca_dev->pixfmt.sizeimage; 509 508 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); 510 509 frsz = PAGE_ALIGN(frsz); 511 510 if (count >= GSPCA_MAX_FRAMES) ··· 626 627 static u32 which_bandwidth(struct gspca_dev *gspca_dev) 627 628 { 628 629 u32 bandwidth; 629 - int i; 630 630 631 631 /* get the (max) image size */ 632 - i = gspca_dev->curr_mode; 633 - bandwidth = gspca_dev->cam.cam_mode[i].sizeimage; 632 + bandwidth = gspca_dev->pixfmt.sizeimage; 634 633 635 634 /* if the image is compressed, estimate its mean size */ 636 635 if (!gspca_dev->cam.needs_full_bandwidth && 637 - bandwidth < gspca_dev->cam.cam_mode[i].width * 638 - gspca_dev->cam.cam_mode[i].height) 636 + bandwidth < gspca_dev->pixfmt.width * 637 + gspca_dev->pixfmt.height) 639 638 bandwidth = bandwidth * 3 / 8; /* 0.375 */ 640 639 641 640 /* estimate the frame rate */ ··· 647 650 648 651 /* don't hope more than 15 fps with USB 1.1 and 649 652 * image resolution >= 640x480 */ 650 - if (gspca_dev->width >= 640 653 + if (gspca_dev->pixfmt.width >= 640 651 654 && gspca_dev->dev->speed == USB_SPEED_FULL) 652 655 bandwidth *= 15; /* 15 fps */ 653 656 else ··· 979 982 980 983 i = gspca_dev->cam.nmodes - 1; /* take the highest mode */ 981 984 gspca_dev->curr_mode = i; 982 - gspca_dev->width = gspca_dev->cam.cam_mode[i].width; 983 - gspca_dev->height = gspca_dev->cam.cam_mode[i].height; 984 - gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixelformat; 985 + gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i]; 985 986 986 987 /* does nothing if ctrl_handler == NULL */ 987 988 v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler); ··· 1100 1105 struct v4l2_format *fmt) 1101 1106 { 1102 1107 struct gspca_dev *gspca_dev = video_drvdata(file); 1103 - int mode; 1104 1108 1105 - mode = gspca_dev->curr_mode; 1106 - fmt->fmt.pix = gspca_dev->cam.cam_mode[mode]; 1109 + fmt->fmt.pix = gspca_dev->pixfmt; 1107 1110 /* some drivers use priv internally, zero it before giving it to 1108 1111 userspace */ 1109 1112 fmt->fmt.pix.priv = 0; ··· 1180 1187 ret = -EBUSY; 1181 1188 goto out; 1182 1189 } 1183 - gspca_dev->width = fmt->fmt.pix.width; 1184 - gspca_dev->height = fmt->fmt.pix.height; 1185 - gspca_dev->pixfmt = fmt->fmt.pix.pixelformat; 1186 1190 gspca_dev->curr_mode = ret; 1191 + gspca_dev->pixfmt = gspca_dev->cam.cam_mode[ret]; 1187 1192 1188 1193 ret = 0; 1189 1194 out: ··· 1462 1471 if (ret < 0) 1463 1472 goto out; 1464 1473 } 1465 - PDEBUG_MODE(gspca_dev, D_STREAM, "stream on OK", gspca_dev->pixfmt, 1466 - gspca_dev->width, gspca_dev->height); 1474 + PDEBUG_MODE(gspca_dev, D_STREAM, "stream on OK", 1475 + gspca_dev->pixfmt.pixelformat, 1476 + gspca_dev->pixfmt.width, gspca_dev->pixfmt.height); 1467 1477 ret = 0; 1468 1478 out: 1469 1479 mutex_unlock(&gspca_dev->queue_lock);
+1 -3
drivers/media/usb/gspca/gspca.h
··· 183 183 __u8 streaming; /* protected by both mutexes (*) */ 184 184 185 185 __u8 curr_mode; /* current camera mode */ 186 - __u32 pixfmt; /* current mode parameters */ 187 - __u16 width; 188 - __u16 height; 186 + struct v4l2_pix_format pixfmt; /* current mode parameters */ 189 187 __u32 sequence; /* frame sequence number */ 190 188 191 189 wait_queue_head_t wq; /* wait queue */
+3 -2
drivers/media/usb/gspca/jeilinj.c
··· 378 378 struct sd *dev = (struct sd *) gspca_dev; 379 379 380 380 /* create the JPEG header */ 381 - jpeg_define(dev->jpeg_hdr, gspca_dev->height, gspca_dev->width, 381 + jpeg_define(dev->jpeg_hdr, gspca_dev->pixfmt.height, 382 + gspca_dev->pixfmt.width, 382 383 0x21); /* JPEG 422 */ 383 384 jpeg_set_qual(dev->jpeg_hdr, dev->quality); 384 385 PDEBUG(D_STREAM, "Start streaming at %dx%d", 385 - gspca_dev->height, gspca_dev->width); 386 + gspca_dev->pixfmt.height, gspca_dev->pixfmt.width); 386 387 jlj_start(gspca_dev); 387 388 return gspca_dev->usb_err; 388 389 }
+1 -1
drivers/media/usb/gspca/jl2005bcd.c
··· 455 455 struct sd *sd = (struct sd *) gspca_dev; 456 456 sd->cap_mode = gspca_dev->cam.cam_mode; 457 457 458 - switch (gspca_dev->width) { 458 + switch (gspca_dev->pixfmt.width) { 459 459 case 640: 460 460 PDEBUG(D_STREAM, "Start streaming at vga resolution"); 461 461 jl2005c_stream_start_vga_lg(gspca_dev);
+1 -1
drivers/media/usb/gspca/m5602/m5602_mt9m111.c
··· 266 266 return err; 267 267 268 268 data[0] = MT9M111_RMB_OVER_SIZED; 269 - if (gspca_dev->width == 640) { 269 + if (gspca_dev->pixfmt.width == 640) { 270 270 data[1] = MT9M111_RMB_ROW_SKIP_2X | 271 271 MT9M111_RMB_COLUMN_SKIP_2X | 272 272 (hflip << 1) | vflip;
+4 -3
drivers/media/usb/gspca/mars.c
··· 254 254 int i; 255 255 256 256 /* create the JPEG header */ 257 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 257 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 258 + gspca_dev->pixfmt.width, 258 259 0x21); /* JPEG 422 */ 259 260 jpeg_set_qual(sd->jpeg_hdr, QUALITY); 260 261 ··· 271 270 data[0] = 0x00; /* address */ 272 271 data[1] = 0x0c | 0x01; /* reg 0 */ 273 272 data[2] = 0x01; /* reg 1 */ 274 - data[3] = gspca_dev->width / 8; /* h_size , reg 2 */ 275 - data[4] = gspca_dev->height / 8; /* v_size , reg 3 */ 273 + data[3] = gspca_dev->pixfmt.width / 8; /* h_size , reg 2 */ 274 + data[4] = gspca_dev->pixfmt.height / 8; /* v_size , reg 3 */ 276 275 data[5] = 0x30; /* reg 4, MI, PAS5101 : 277 276 * 0x30 for 24mhz , 0x28 for 12mhz */ 278 277 data[6] = 0x02; /* reg 5, H start - was 0x04 */
+3 -3
drivers/media/usb/gspca/mr97310a.c
··· 521 521 if (sd->sensor_type) 522 522 data[5] = 0xbb; 523 523 524 - switch (gspca_dev->width) { 524 + switch (gspca_dev->pixfmt.width) { 525 525 case 160: 526 526 data[9] |= 0x04; /* reg 8, 2:1 scale down from 320 */ 527 527 /* fall thru */ ··· 618 618 data[10] = 0x18; 619 619 } 620 620 621 - switch (gspca_dev->width) { 621 + switch (gspca_dev->pixfmt.width) { 622 622 case 160: 623 623 data[9] |= 0x0c; /* reg 8, 4:1 scale down */ 624 624 /* fall thru */ ··· 847 847 u8 clockdiv = (60 * expo + 7999) / 8000; 848 848 849 849 /* Limit framerate to not exceed usb bandwidth */ 850 - if (clockdiv < min_clockdiv && gspca_dev->width >= 320) 850 + if (clockdiv < min_clockdiv && gspca_dev->pixfmt.width >= 320) 851 851 clockdiv = min_clockdiv; 852 852 else if (clockdiv < 2) 853 853 clockdiv = 2;
+6 -5
drivers/media/usb/gspca/nw80x.c
··· 1708 1708 1709 1709 reg_r(gspca_dev, 0x1004, 1); 1710 1710 if (gspca_dev->usb_buf[0] & 0x04) { /* if AE_FULL_FRM */ 1711 - sd->ae_res = gspca_dev->width * gspca_dev->height; 1711 + sd->ae_res = gspca_dev->pixfmt.width * gspca_dev->pixfmt.height; 1712 1712 } else { /* get the AE window size */ 1713 1713 reg_r(gspca_dev, 0x1011, 8); 1714 1714 w = (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0] ··· 1717 1717 - (gspca_dev->usb_buf[7] << 8) - gspca_dev->usb_buf[6]; 1718 1718 sd->ae_res = h * w; 1719 1719 if (sd->ae_res == 0) 1720 - sd->ae_res = gspca_dev->width * gspca_dev->height; 1720 + sd->ae_res = gspca_dev->pixfmt.width * 1721 + gspca_dev->pixfmt.height; 1721 1722 } 1722 1723 } 1723 1724 ··· 1857 1856 reg_w_buf(gspca_dev, cmd); 1858 1857 switch (sd->webcam) { 1859 1858 case P35u: 1860 - if (gspca_dev->width == 320) 1859 + if (gspca_dev->pixfmt.width == 320) 1861 1860 reg_w_buf(gspca_dev, nw801_start_qvga); 1862 1861 else 1863 1862 reg_w_buf(gspca_dev, nw801_start_vga); 1864 1863 reg_w_buf(gspca_dev, nw801_start_2); 1865 1864 break; 1866 1865 case Kr651us: 1867 - if (gspca_dev->width == 320) 1866 + if (gspca_dev->pixfmt.width == 320) 1868 1867 reg_w_buf(gspca_dev, kr651_start_qvga); 1869 1868 else 1870 1869 reg_w_buf(gspca_dev, kr651_start_vga); 1871 1870 reg_w_buf(gspca_dev, kr651_start_2); 1872 1871 break; 1873 1872 case Proscope: 1874 - if (gspca_dev->width == 320) 1873 + if (gspca_dev->pixfmt.width == 320) 1875 1874 reg_w_buf(gspca_dev, proscope_start_qvga); 1876 1875 else 1877 1876 reg_w_buf(gspca_dev, proscope_start_vga);
+29 -23
drivers/media/usb/gspca/ov519.c
··· 3468 3468 3469 3469 switch (sd->bridge) { 3470 3470 case BRIDGE_OVFX2: 3471 - if (gspca_dev->width != 800) 3471 + if (gspca_dev->pixfmt.width != 800) 3472 3472 gspca_dev->cam.bulk_size = OVFX2_BULK_SIZE; 3473 3473 else 3474 3474 gspca_dev->cam.bulk_size = 7 * 4096; ··· 3507 3507 /* Here I'm assuming that snapshot size == image size. 3508 3508 * I hope that's always true. --claudio 3509 3509 */ 3510 - hsegs = (sd->gspca_dev.width >> 3) - 1; 3511 - vsegs = (sd->gspca_dev.height >> 3) - 1; 3510 + hsegs = (sd->gspca_dev.pixfmt.width >> 3) - 1; 3511 + vsegs = (sd->gspca_dev.pixfmt.height >> 3) - 1; 3512 3512 3513 3513 reg_w(sd, R511_CAM_PXCNT, hsegs); 3514 3514 reg_w(sd, R511_CAM_LNCNT, vsegs); ··· 3541 3541 case SEN_OV7640: 3542 3542 case SEN_OV7648: 3543 3543 case SEN_OV76BE: 3544 - if (sd->gspca_dev.width == 320) 3544 + if (sd->gspca_dev.pixfmt.width == 320) 3545 3545 interlaced = 1; 3546 3546 /* Fall through */ 3547 3547 case SEN_OV6630: ··· 3551 3551 case 30: 3552 3552 case 25: 3553 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 3555 sd->clockdiv = 0; 3556 3556 break; 3557 3557 } ··· 3584 3584 3585 3585 /* Check if we have enough bandwidth to disable compression */ 3586 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 3589 /* 1000 isoc packets/sec */ 3589 3590 if (needed > 1000 * packet_size) { 3590 3591 /* Enable Y and UV quantization and compression */ ··· 3647 3646 reg_w(sd, 0x38, 0x80); 3648 3647 } 3649 3648 3650 - hsegs = sd->gspca_dev.width / 16; 3651 - vsegs = sd->gspca_dev.height / 4; 3649 + hsegs = sd->gspca_dev.pixfmt.width / 16; 3650 + vsegs = sd->gspca_dev.pixfmt.height / 4; 3652 3651 3653 3652 reg_w(sd, 0x29, hsegs); 3654 3653 reg_w(sd, 0x2a, vsegs); ··· 3687 3686 * happened to be with revision < 2 cams using an 3688 3687 * OV7620 and revision 2 cams using an OV7620AE. 3689 3688 */ 3690 - if (sd->revision > 0 && sd->gspca_dev.width == 640) { 3689 + if (sd->revision > 0 && 3690 + sd->gspca_dev.pixfmt.width == 640) { 3691 3691 reg_w(sd, 0x20, 0x60); 3692 3692 reg_w(sd, 0x21, 0x1f); 3693 3693 } else { ··· 3814 3812 break; 3815 3813 } 3816 3814 3817 - reg_w(sd, OV519_R10_H_SIZE, sd->gspca_dev.width >> 4); 3818 - reg_w(sd, OV519_R11_V_SIZE, sd->gspca_dev.height >> 3); 3815 + reg_w(sd, OV519_R10_H_SIZE, sd->gspca_dev.pixfmt.width >> 4); 3816 + reg_w(sd, OV519_R11_V_SIZE, sd->gspca_dev.pixfmt.height >> 3); 3819 3817 if (sd->sensor == SEN_OV7670 && 3820 3818 sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv) 3821 3819 reg_w(sd, OV519_R12_X_OFFSETL, 0x04); ··· 3949 3947 } 3950 3948 case SEN_OV3610: 3951 3949 if (qvga) { 3952 - xstart = (1040 - gspca_dev->width) / 2 + (0x1f << 4); 3953 - ystart = (776 - gspca_dev->height) / 2; 3950 + xstart = (1040 - gspca_dev->pixfmt.width) / 2 + 3951 + (0x1f << 4); 3952 + ystart = (776 - gspca_dev->pixfmt.height) / 2; 3954 3953 } else { 3955 - xstart = (2076 - gspca_dev->width) / 2 + (0x10 << 4); 3956 - ystart = (1544 - gspca_dev->height) / 2; 3954 + xstart = (2076 - gspca_dev->pixfmt.width) / 2 + 3955 + (0x10 << 4); 3956 + ystart = (1544 - gspca_dev->pixfmt.height) / 2; 3957 3957 } 3958 - xend = xstart + gspca_dev->width; 3959 - yend = ystart + gspca_dev->height; 3958 + xend = xstart + gspca_dev->pixfmt.width; 3959 + yend = ystart + gspca_dev->pixfmt.height; 3960 3960 /* Writing to the COMH register resets the other windowing regs 3961 3961 to their default values, so we must do this first. */ 3962 3962 i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0xf0); ··· 4233 4229 struct sd *sd = (struct sd *) gspca_dev; 4234 4230 4235 4231 /* Default for most bridges, allow bridge_mode_init_regs to override */ 4236 - sd->sensor_width = sd->gspca_dev.width; 4237 - sd->sensor_height = sd->gspca_dev.height; 4232 + sd->sensor_width = sd->gspca_dev.pixfmt.width; 4233 + sd->sensor_height = sd->gspca_dev.pixfmt.height; 4238 4234 4239 4235 switch (sd->bridge) { 4240 4236 case BRIDGE_OV511: ··· 4349 4345 ov51x_handle_button(gspca_dev, (in[8] >> 2) & 1); 4350 4346 if (in[8] & 0x80) { 4351 4347 /* Frame end */ 4352 - if ((in[9] + 1) * 8 != gspca_dev->width || 4353 - (in[10] + 1) * 8 != gspca_dev->height) { 4348 + if ((in[9] + 1) * 8 != gspca_dev->pixfmt.width || 4349 + (in[10] + 1) * 8 != gspca_dev->pixfmt.height) { 4354 4350 PERR("Invalid frame size, got: %dx%d," 4355 4351 " requested: %dx%d\n", 4356 4352 (in[9] + 1) * 8, (in[10] + 1) * 8, 4357 - gspca_dev->width, gspca_dev->height); 4353 + gspca_dev->pixfmt.width, 4354 + gspca_dev->pixfmt.height); 4358 4355 gspca_dev->last_packet_type = DISCARD_PACKET; 4359 4356 return; 4360 4357 } ··· 4475 4470 if (sd->first_frame) { 4476 4471 sd->first_frame--; 4477 4472 if (gspca_dev->image_len < 4478 - sd->gspca_dev.width * sd->gspca_dev.height) 4473 + sd->gspca_dev.pixfmt.width * 4474 + sd->gspca_dev.pixfmt.height) 4479 4475 gspca_dev->last_packet_type = DISCARD_PACKET; 4480 4476 } 4481 4477 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
+3 -2
drivers/media/usb/gspca/ov534.c
··· 1440 1440 /* If this packet is marked as EOF, end the frame */ 1441 1441 } else if (data[1] & UVC_STREAM_EOF) { 1442 1442 sd->last_pts = 0; 1443 - if (gspca_dev->pixfmt == V4L2_PIX_FMT_YUYV 1443 + if (gspca_dev->pixfmt.pixelformat == V4L2_PIX_FMT_YUYV 1444 1444 && gspca_dev->image_len + len - 12 != 1445 - gspca_dev->width * gspca_dev->height * 2) { 1445 + gspca_dev->pixfmt.width * 1446 + gspca_dev->pixfmt.height * 2) { 1446 1447 PDEBUG(D_PACK, "wrong sized frame"); 1447 1448 goto discard; 1448 1449 }
+2 -2
drivers/media/usb/gspca/pac207.c
··· 299 299 pac207_write_regs(gspca_dev, 0x0042, pac207_sensor_init[3], 8); 300 300 301 301 /* Compression Balance */ 302 - if (gspca_dev->width == 176) 302 + if (gspca_dev->pixfmt.width == 176) 303 303 pac207_write_reg(gspca_dev, 0x4a, 0xff); 304 304 else 305 305 pac207_write_reg(gspca_dev, 0x4a, 0x30); ··· 317 317 mode = 0x00; 318 318 else 319 319 mode = 0x02; 320 - if (gspca_dev->width == 176) { /* 176x144 */ 320 + if (gspca_dev->pixfmt.width == 176) { /* 176x144 */ 321 321 mode |= 0x01; 322 322 PDEBUG(D_STREAM, "pac207_start mode 176x144"); 323 323 } else { /* 352x288 */
+3 -3
drivers/media/usb/gspca/pac7311.c
··· 326 326 * 640x480 mode and page 4 reg 2 <= 3 then it must be 9 327 327 */ 328 328 reg_w(gspca_dev, 0xff, 0x01); 329 - if (gspca_dev->width != 640 && val <= 3) 329 + if (gspca_dev->pixfmt.width != 640 && val <= 3) 330 330 reg_w(gspca_dev, 0x08, 0x09); 331 331 else 332 332 reg_w(gspca_dev, 0x08, 0x08); ··· 337 337 * camera to use higher compression or we may run out of 338 338 * bandwidth. 339 339 */ 340 - if (gspca_dev->width == 640 && val == 2) 340 + if (gspca_dev->pixfmt.width == 640 && val == 2) 341 341 reg_w(gspca_dev, 0x80, 0x01); 342 342 else 343 343 reg_w(gspca_dev, 0x80, 0x1c); ··· 615 615 616 616 /* Start the new frame with the jpeg header */ 617 617 pac_start_frame(gspca_dev, 618 - gspca_dev->height, gspca_dev->width); 618 + gspca_dev->pixfmt.height, gspca_dev->pixfmt.width); 619 619 } 620 620 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); 621 621 }
+3 -3
drivers/media/usb/gspca/se401.c
··· 354 354 355 355 /* set size + mode */ 356 356 se401_write_req(gspca_dev, SE401_REQ_SET_WIDTH, 357 - gspca_dev->width * mult, 0); 357 + gspca_dev->pixfmt.width * mult, 0); 358 358 se401_write_req(gspca_dev, SE401_REQ_SET_HEIGHT, 359 - gspca_dev->height * mult, 0); 359 + gspca_dev->pixfmt.height * mult, 0); 360 360 /* 361 361 * HDG: disabled this as it does not seem to do anything 362 362 * se401_write_req(gspca_dev, SE401_REQ_SET_OUTPUT_MODE, ··· 480 480 static void sd_pkt_scan_janggu(struct gspca_dev *gspca_dev, u8 *data, int len) 481 481 { 482 482 struct sd *sd = (struct sd *)gspca_dev; 483 - int imagesize = gspca_dev->width * gspca_dev->height; 483 + int imagesize = gspca_dev->pixfmt.width * gspca_dev->pixfmt.height; 484 484 int i, plen, bits, pixels, info, count; 485 485 486 486 if (sd->restart_stream)
+3 -3
drivers/media/usb/gspca/sn9c20x.c
··· 1955 1955 return 0; 1956 1956 } 1957 1957 1958 - switch (gspca_dev->width) { 1958 + switch (gspca_dev->pixfmt.width) { 1959 1959 case 160: /* 160x120 */ 1960 1960 gspca_dev->alt = 2; 1961 1961 break; ··· 1985 1985 { 1986 1986 struct sd *sd = (struct sd *) gspca_dev; 1987 1987 int mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 1988 - int width = gspca_dev->width; 1989 - int height = gspca_dev->height; 1988 + int width = gspca_dev->pixfmt.width; 1989 + int height = gspca_dev->pixfmt.height; 1990 1990 u8 fmt, scale = 0; 1991 1991 1992 1992 jpeg_define(sd->jpeg_hdr, height, width,
+1 -1
drivers/media/usb/gspca/sonixb.c
··· 753 753 /* In 640x480, if the reg11 has less than 4, the image is 754 754 unstable (the bridge goes into a higher compression mode 755 755 which we have not reverse engineered yet). */ 756 - if (gspca_dev->width == 640 && reg11 < 4) 756 + if (gspca_dev->pixfmt.width == 640 && reg11 < 4) 757 757 reg11 = 4; 758 758 759 759 /* frame exposure time in ms = 1000 * reg11 / 30 ->
+2 -1
drivers/media/usb/gspca/sonixj.c
··· 2204 2204 { 0x14, 0xe7, 0x1e, 0xdd }; 2205 2205 2206 2206 /* create the JPEG header */ 2207 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 2207 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 2208 + gspca_dev->pixfmt.width, 2208 2209 0x21); /* JPEG 422 */ 2209 2210 2210 2211 /* initialize the bridge */
+2 -1
drivers/media/usb/gspca/spca1528.c
··· 255 255 struct sd *sd = (struct sd *) gspca_dev; 256 256 257 257 /* initialize the JPEG header */ 258 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 258 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 259 + gspca_dev->pixfmt.width, 259 260 0x22); /* JPEG 411 */ 260 261 261 262 /* the JPEG quality shall be 85% */
+2 -1
drivers/media/usb/gspca/spca500.c
··· 608 608 __u8 xmult, ymult; 609 609 610 610 /* create the JPEG header */ 611 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 611 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 612 + gspca_dev->pixfmt.width, 612 613 0x22); /* JPEG 411 */ 613 614 jpeg_set_qual(sd->jpeg_hdr, QUALITY); 614 615
+1 -1
drivers/media/usb/gspca/sq905c.c
··· 272 272 273 273 dev->cap_mode = gspca_dev->cam.cam_mode; 274 274 /* "Open the shutter" and set size, to start capture */ 275 - switch (gspca_dev->width) { 275 + switch (gspca_dev->pixfmt.width) { 276 276 case 640: 277 277 PDEBUG(D_STREAM, "Start streaming at high resolution"); 278 278 dev->cap_mode++;
+2 -1
drivers/media/usb/gspca/sq930x.c
··· 906 906 907 907 gspca_dev->cam.bulk_nurbs = 1; /* there must be one URB only */ 908 908 sd->do_ctrl = 0; 909 - gspca_dev->cam.bulk_size = gspca_dev->width * gspca_dev->height + 8; 909 + gspca_dev->cam.bulk_size = gspca_dev->pixfmt.width * 910 + gspca_dev->pixfmt.height + 8; 910 911 return 0; 911 912 } 912 913
+3 -2
drivers/media/usb/gspca/stk014.c
··· 250 250 int ret, value; 251 251 252 252 /* create the JPEG header */ 253 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 253 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 254 + gspca_dev->pixfmt.width, 254 255 0x22); /* JPEG 411 */ 255 256 jpeg_set_qual(sd->jpeg_hdr, QUALITY); 256 257 ··· 262 261 set_par(gspca_dev, 0x00000000); 263 262 set_par(gspca_dev, 0x8002e001); 264 263 set_par(gspca_dev, 0x14000000); 265 - if (gspca_dev->width > 320) 264 + if (gspca_dev->pixfmt.width > 320) 266 265 value = 0x8002e001; /* 640x480 */ 267 266 else 268 267 value = 0x4001f000; /* 320x240 */
+4 -4
drivers/media/usb/gspca/stk1135.c
··· 347 347 sensor_write(gspca_dev, cfg[i].reg, cfg[i].val); 348 348 349 349 /* set output size */ 350 - width = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].width; 351 - height = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].height; 350 + width = gspca_dev->pixfmt.width; 351 + height = gspca_dev->pixfmt.height; 352 352 if (width <= 640) { /* use context A (half readout speed by default) */ 353 353 sensor_write(gspca_dev, 0x1a7, width); 354 354 sensor_write(gspca_dev, 0x1aa, height); ··· 484 484 reg_w(gspca_dev, STK1135_REG_CISPO + 3, 0x00); 485 485 486 486 /* set capture end position */ 487 - width = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].width; 488 - height = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].height; 487 + width = gspca_dev->pixfmt.width; 488 + height = gspca_dev->pixfmt.height; 489 489 reg_w(gspca_dev, STK1135_REG_CIEPO + 0, width & 0xff); 490 490 reg_w(gspca_dev, STK1135_REG_CIEPO + 1, width >> 8); 491 491 reg_w(gspca_dev, STK1135_REG_CIEPO + 2, height & 0xff);
+1 -1
drivers/media/usb/gspca/stv06xx/stv06xx.c
··· 452 452 NULL, 0); 453 453 454 454 if (sd->bridge == BRIDGE_ST6422) 455 - sd->to_skip = gspca_dev->width * 4; 455 + sd->to_skip = gspca_dev->pixfmt.width * 4; 456 456 457 457 if (chunk_len) 458 458 PERR("Chunk length is "
+1 -1
drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
··· 421 421 422 422 /* Number of pixels counted by the sensor when subsampling the pixels. 423 423 * Slightly larger than the real value to avoid oscillation */ 424 - totalpixels = gspca_dev->width * gspca_dev->height; 424 + totalpixels = gspca_dev->pixfmt.width * gspca_dev->pixfmt.height; 425 425 totalpixels = totalpixels/(8*8) + totalpixels/(64*64); 426 426 427 427 brightpixels = (totalpixels * val) >> 8;
+2 -1
drivers/media/usb/gspca/sunplus.c
··· 715 715 int enable; 716 716 717 717 /* create the JPEG header */ 718 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 718 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 719 + gspca_dev->pixfmt.width, 719 720 0x22); /* JPEG 411 */ 720 721 jpeg_set_qual(sd->jpeg_hdr, QUALITY); 721 722
+7 -6
drivers/media/usb/gspca/topro.c
··· 3856 3856 3857 3857 if (sd->bridge == BRIDGE_TP6800) { 3858 3858 val |= 0x08; /* grid compensation enable */ 3859 - if (gspca_dev->width == 640) 3859 + if (gspca_dev->pixfmt.width == 640) 3860 3860 reg_w(gspca_dev, TP6800_R78_FORMAT, 0x00); /* vga */ 3861 3861 else 3862 3862 val |= 0x04; /* scaling down enable */ ··· 3880 3880 struct sd *sd = (struct sd *) gspca_dev; 3881 3881 3882 3882 reg_w(gspca_dev, TP6800_R21_ENDP_1_CTL, 0x00); 3883 - if (gspca_dev->width == 320) { 3883 + if (gspca_dev->pixfmt.width == 320) { 3884 3884 reg_w(gspca_dev, TP6800_R3F_FRAME_RATE, 0x06); 3885 3885 msleep(100); 3886 3886 i2c_w(gspca_dev, CX0342_AUTO_ADC_CALIB, 0x01); ··· 3924 3924 3925 3925 /* 640x480 * 30 fps does not work */ 3926 3926 if (i == 6 /* if 30 fps */ 3927 - && gspca_dev->width == 640) 3927 + && gspca_dev->pixfmt.width == 640) 3928 3928 i = 0x05; /* 15 fps */ 3929 3929 } else { 3930 3930 for (i = 0; i < ARRAY_SIZE(rates_6810) - 1; i++) { ··· 3935 3935 3936 3936 /* 640x480 * 30 fps does not work */ 3937 3937 if (i == 7 /* if 30 fps */ 3938 - && gspca_dev->width == 640) 3938 + && gspca_dev->pixfmt.width == 640) 3939 3939 i = 6; /* 15 fps */ 3940 3940 i |= 0x80; /* clock * 1 */ 3941 3941 } ··· 4554 4554 { 4555 4555 struct sd *sd = (struct sd *) gspca_dev; 4556 4556 4557 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width); 4557 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 4558 + gspca_dev->pixfmt.width); 4558 4559 set_dqt(gspca_dev, sd->quality); 4559 4560 if (sd->bridge == BRIDGE_TP6800) { 4560 4561 if (sd->sensor == SENSOR_CX0342) ··· 4738 4737 (gspca_dev->usb_buf[26] << 8) + gspca_dev->usb_buf[25] + 4739 4738 (gspca_dev->usb_buf[29] << 8) + gspca_dev->usb_buf[28]) 4740 4739 / 8; 4741 - if (gspca_dev->width == 640) 4740 + if (gspca_dev->pixfmt.width == 640) 4742 4741 luma /= 4; 4743 4742 reg_w(gspca_dev, 0x7d, 0x00); 4744 4743
+4 -3
drivers/media/usb/gspca/tv8532.c
··· 268 268 packet_type0 = packet_type1 = INTER_PACKET; 269 269 if (gspca_dev->empty_packet) { 270 270 gspca_dev->empty_packet = 0; 271 - sd->packet = gspca_dev->height / 2; 271 + sd->packet = gspca_dev->pixfmt.height / 2; 272 272 packet_type0 = FIRST_PACKET; 273 273 } else if (sd->packet == 0) 274 274 return; /* 2 more lines in 352x288 ! */ ··· 284 284 * - 4 bytes 285 285 */ 286 286 gspca_frame_add(gspca_dev, packet_type0, 287 - data + 2, gspca_dev->width); 287 + data + 2, gspca_dev->pixfmt.width); 288 288 gspca_frame_add(gspca_dev, packet_type1, 289 - data + gspca_dev->width + 5, gspca_dev->width); 289 + data + gspca_dev->pixfmt.width + 5, 290 + gspca_dev->pixfmt.width); 290 291 } 291 292 292 293 static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
+4 -4
drivers/media/usb/gspca/vicam.c
··· 121 121 122 122 memset(req_data, 0, 16); 123 123 req_data[0] = gain; 124 - if (gspca_dev->width == 256) 124 + if (gspca_dev->pixfmt.width == 256) 125 125 req_data[1] |= 0x01; /* low nibble x-scale */ 126 - if (gspca_dev->height <= 122) { 126 + if (gspca_dev->pixfmt.height <= 122) { 127 127 req_data[1] |= 0x10; /* high nibble y-scale */ 128 - unscaled_height = gspca_dev->height * 2; 128 + unscaled_height = gspca_dev->pixfmt.height * 2; 129 129 } else 130 - unscaled_height = gspca_dev->height; 130 + unscaled_height = gspca_dev->pixfmt.height; 131 131 req_data[2] = 0x90; /* unknown, does not seem to do anything */ 132 132 if (unscaled_height <= 200) 133 133 req_data[3] = 0x06; /* vend? */
+14 -14
drivers/media/usb/gspca/w996Xcf.c
··· 430 430 #define SC(x) ((x) << 10) 431 431 432 432 /* Scaling factors */ 433 - fw = SC(sd->gspca_dev.width) / max_width; 434 - fh = SC(sd->gspca_dev.height) / max_height; 433 + fw = SC(sd->gspca_dev.pixfmt.width) / max_width; 434 + fh = SC(sd->gspca_dev.pixfmt.height) / max_height; 435 435 436 - cw = (fw >= fh) ? max_width : SC(sd->gspca_dev.width) / fh; 437 - ch = (fw >= fh) ? SC(sd->gspca_dev.height) / fw : max_height; 436 + cw = (fw >= fh) ? max_width : SC(sd->gspca_dev.pixfmt.width) / fh; 437 + ch = (fw >= fh) ? SC(sd->gspca_dev.pixfmt.height) / fw : max_height; 438 438 439 439 sd->sensor_width = max_width; 440 440 sd->sensor_height = max_height; ··· 454 454 455 455 w9968cf_set_crop_window(sd); 456 456 457 - reg_w(sd, 0x14, sd->gspca_dev.width); 458 - reg_w(sd, 0x15, sd->gspca_dev.height); 457 + reg_w(sd, 0x14, sd->gspca_dev.pixfmt.width); 458 + reg_w(sd, 0x15, sd->gspca_dev.pixfmt.height); 459 459 460 460 /* JPEG width & height */ 461 - reg_w(sd, 0x30, sd->gspca_dev.width); 462 - reg_w(sd, 0x31, sd->gspca_dev.height); 461 + reg_w(sd, 0x30, sd->gspca_dev.pixfmt.width); 462 + reg_w(sd, 0x31, sd->gspca_dev.pixfmt.height); 463 463 464 464 /* Y & UV frame buffer strides (in WORD) */ 465 465 if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat == 466 466 V4L2_PIX_FMT_JPEG) { 467 - reg_w(sd, 0x2c, sd->gspca_dev.width / 2); 468 - reg_w(sd, 0x2d, sd->gspca_dev.width / 4); 467 + reg_w(sd, 0x2c, sd->gspca_dev.pixfmt.width / 2); 468 + reg_w(sd, 0x2d, sd->gspca_dev.pixfmt.width / 4); 469 469 } else 470 - reg_w(sd, 0x2c, sd->gspca_dev.width); 470 + reg_w(sd, 0x2c, sd->gspca_dev.pixfmt.width); 471 471 472 472 reg_w(sd, 0x00, 0xbf17); /* reset everything */ 473 473 reg_w(sd, 0x00, 0xbf10); /* normal operation */ 474 474 475 475 /* Transfer size in WORDS (for UYVY format only) */ 476 - val = sd->gspca_dev.width * sd->gspca_dev.height; 476 + val = sd->gspca_dev.pixfmt.width * sd->gspca_dev.pixfmt.height; 477 477 reg_w(sd, 0x3d, val & 0xffff); /* low bits */ 478 478 reg_w(sd, 0x3e, val >> 16); /* high bits */ 479 479 480 480 if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat == 481 481 V4L2_PIX_FMT_JPEG) { 482 482 /* We may get called multiple times (usb isoc bw negotiat.) */ 483 - jpeg_define(sd->jpeg_hdr, sd->gspca_dev.height, 484 - sd->gspca_dev.width, 0x22); /* JPEG 420 */ 483 + jpeg_define(sd->jpeg_hdr, sd->gspca_dev.pixfmt.height, 484 + sd->gspca_dev.pixfmt.width, 0x22); /* JPEG 420 */ 485 485 jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); 486 486 w9968cf_upload_quantizationtables(sd); 487 487 v4l2_ctrl_grab(sd->jpegqual, true);
+2 -1
drivers/media/usb/gspca/zc3xx.c
··· 6700 6700 }; 6701 6701 6702 6702 /* create the JPEG header */ 6703 - jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 6703 + jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, 6704 + gspca_dev->pixfmt.width, 6704 6705 0x21); /* JPEG 422 */ 6705 6706 6706 6707 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;