aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-05 10:49:20 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:17:15 -0400
commitc2446b3eba97243acbe2ad0939a28b5edb97eae7 (patch)
treef7ff764cf48062c4ef7c243205b85ae73d69763e /drivers/media
parentefab8211db79d20032fa7d09b8a3671e68a9c5b9 (diff)
V4L/DVB (8201): gspca: v4l2_pix_format in each subdriver.
main: Parameter comp_fac removed. main, pac207: get_buff_size op removed. (all) v4l2_pix_format in each subdriver. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/conex.c54
-rw-r--r--drivers/media/video/gspca/etoms.c42
-rw-r--r--drivers/media/video/gspca/gspca.c134
-rw-r--r--drivers/media/video/gspca/gspca.h13
-rw-r--r--drivers/media/video/gspca/mars.c18
-rw-r--r--drivers/media/video/gspca/ov519.c32
-rw-r--r--drivers/media/video/gspca/pac207.c33
-rw-r--r--drivers/media/video/gspca/pac7311.c26
-rw-r--r--drivers/media/video/gspca/sonixb.c41
-rw-r--r--drivers/media/video/gspca/sonixj.c26
-rw-r--r--drivers/media/video/gspca/spca500.c34
-rw-r--r--drivers/media/video/gspca/spca501.c26
-rw-r--r--drivers/media/video/gspca/spca505.c38
-rw-r--r--drivers/media/video/gspca/spca506.c52
-rw-r--r--drivers/media/video/gspca/spca508.c32
-rw-r--r--drivers/media/video/gspca/spca561.c32
-rw-r--r--drivers/media/video/gspca/stk014.c18
-rw-r--r--drivers/media/video/gspca/sunplus.c60
-rw-r--r--drivers/media/video/gspca/t613.c38
-rw-r--r--drivers/media/video/gspca/tv8532.c20
-rw-r--r--drivers/media/video/gspca/vc032x.c34
-rw-r--r--drivers/media/video/gspca/zc3xx.c36
22 files changed, 519 insertions, 320 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 6d50247b7ad2..b5481017dd4f 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -25,8 +25,8 @@
25#define CONEX_CAM 1 /* special JPEG header */ 25#define CONEX_CAM 1 /* special JPEG header */
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
29static const char version[] = "2.1.4"; 29static const char version[] = "2.1.5";
30 30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); 32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
@@ -52,7 +52,6 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
52static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); 52static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
53 53
54static struct ctrl sd_ctrls[] = { 54static struct ctrl sd_ctrls[] = {
55#define SD_BRIGHTNESS 0
56 { 55 {
57 { 56 {
58 .id = V4L2_CID_BRIGHTNESS, 57 .id = V4L2_CID_BRIGHTNESS,
@@ -61,12 +60,12 @@ static struct ctrl sd_ctrls[] = {
61 .minimum = 0, 60 .minimum = 0,
62 .maximum = 255, 61 .maximum = 255,
63 .step = 1, 62 .step = 1,
64 .default_value = 0xd4, 63#define BRIGHTNESS_DEF 0xd4
64 .default_value = BRIGHTNESS_DEF,
65 }, 65 },
66 .set = sd_setbrightness, 66 .set = sd_setbrightness,
67 .get = sd_getbrightness, 67 .get = sd_getbrightness,
68 }, 68 },
69#define SD_CONTRAST 1
70 { 69 {
71 { 70 {
72 .id = V4L2_CID_CONTRAST, 71 .id = V4L2_CID_CONTRAST,
@@ -75,12 +74,12 @@ static struct ctrl sd_ctrls[] = {
75 .minimum = 0x0a, 74 .minimum = 0x0a,
76 .maximum = 0x1f, 75 .maximum = 0x1f,
77 .step = 1, 76 .step = 1,
78 .default_value = 0x0c, 77#define CONTRAST_DEF 0x0c
78 .default_value = CONTRAST_DEF,
79 }, 79 },
80 .set = sd_setcontrast, 80 .set = sd_setcontrast,
81 .get = sd_getcontrast, 81 .get = sd_getcontrast,
82 }, 82 },
83#define SD_COLOR 2
84 { 83 {
85 { 84 {
86 .id = V4L2_CID_SATURATION, 85 .id = V4L2_CID_SATURATION,
@@ -89,18 +88,35 @@ static struct ctrl sd_ctrls[] = {
89 .minimum = 0, 88 .minimum = 0,
90 .maximum = 7, 89 .maximum = 7,
91 .step = 1, 90 .step = 1,
92 .default_value = 3, 91#define COLOR_DEF 3
92 .default_value = COLOR_DEF,
93 }, 93 },
94 .set = sd_setcolors, 94 .set = sd_setcolors,
95 .get = sd_getcolors, 95 .get = sd_getcolors,
96 }, 96 },
97}; 97};
98 98
99static struct cam_mode vga_mode[] = { 99static struct v4l2_pix_format vga_mode[] = {
100 {V4L2_PIX_FMT_JPEG, 176, 144, 3}, 100 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
101 {V4L2_PIX_FMT_JPEG, 320, 240, 2}, 101 .bytesperline = 176,
102 {V4L2_PIX_FMT_JPEG, 352, 288, 1}, 102 .sizeimage = 176 * 144 * 3 / 8 + 590,
103 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 103 .colorspace = V4L2_COLORSPACE_JPEG,
104 .priv = 3},
105 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
106 .bytesperline = 320,
107 .sizeimage = 320 * 240 * 3 / 8 + 590,
108 .colorspace = V4L2_COLORSPACE_JPEG,
109 .priv = 2},
110 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
111 .bytesperline = 352,
112 .sizeimage = 352 * 288 * 3 / 8 + 590,
113 .colorspace = V4L2_COLORSPACE_JPEG,
114 .priv = 1},
115 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
116 .bytesperline = 640,
117 .sizeimage = 640 * 480 * 3 / 8 + 590,
118 .colorspace = V4L2_COLORSPACE_JPEG,
119 .priv = 0},
104}; 120};
105 121
106static void reg_r(struct usb_device *dev, 122static void reg_r(struct usb_device *dev,
@@ -269,7 +285,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
269 val = 0x03; 285 val = 0x03;
270 reg_w(gspca_dev->dev, 0x0092, &val, 1); 286 reg_w(gspca_dev->dev, 0x0092, &val, 1);
271 287
272 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 288 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
273 case 0: 289 case 0:
274 reg_w(gspca_dev->dev, 0x0071, reg71a, 4); 290 reg_w(gspca_dev->dev, 0x0071, reg71a, 4);
275 break; 291 break;
@@ -350,7 +366,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev)
350 static const __u8 reg17[] = 366 static const __u8 reg17[] =
351 { 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 }; 367 { 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 };
352 368
353 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 369 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
354 case 0: 370 case 0:
355 cxinit = cx_inits_640; 371 cxinit = cx_inits_640;
356 break; 372 break;
@@ -668,7 +684,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
668 reg_w(gspca_dev->dev, 0x00c0, &val, 1); 684 reg_w(gspca_dev->dev, 0x00c0, &val, 1);
669 reg_r(gspca_dev->dev, 0x0001, &val, 1); 685 reg_r(gspca_dev->dev, 0x0001, &val, 1);
670 length = 8; 686 length = 8;
671 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 687 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
672 case 0: 688 case 0:
673 for (i = 0; i < 27; i++) { 689 for (i = 0; i < 27; i++) {
674 if (i == 26) 690 if (i == 26)
@@ -832,9 +848,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
832 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 848 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
833 849
834 sd->qindex = 0; /* set the quantization */ 850 sd->qindex = 0; /* set the quantization */
835 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 851 sd->brightness = BRIGHTNESS_DEF;
836 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 852 sd->contrast = CONTRAST_DEF;
837 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; 853 sd->colors = COLOR_DEF;
838 return 0; 854 return 0;
839} 855}
840 856
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index bbbe65923cfc..4db33618af6b 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -22,8 +22,8 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
26static const char version[] = "2.1.4"; 26static const char version[] = "2.1.5";
27 27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("Etoms USB Camera Driver"); 29MODULE_DESCRIPTION("Etoms USB Camera Driver");
@@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = {
114 }, 114 },
115}; 115};
116 116
117static struct cam_mode vga_mode[] = { 117static struct v4l2_pix_format vga_mode[] = {
118 {V4L2_PIX_FMT_SBGGR8, 320, 240, 1}, 118 {320, 240, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
119/* {V4L2_PIX_FMT_SBGGR8, 640, 480, 0}, */ 119 .bytesperline = 320,
120 .sizeimage = 320 * 240,
121 .colorspace = V4L2_COLORSPACE_SRGB,
122 .priv = 1},
123/* {640, 480, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
124 .bytesperline = 640,
125 .sizeimage = 640 * 480,
126 .colorspace = V4L2_COLORSPACE_SRGB,
127 .priv = 0}, */
120}; 128};
121 129
122static struct cam_mode sif_mode[] = { 130static struct v4l2_pix_format sif_mode[] = {
123 {V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, 131 {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
124 {V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, 132 .bytesperline = 176,
133 .sizeimage = 176 * 144,
134 .colorspace = V4L2_COLORSPACE_SRGB,
135 .priv = 1},
136 {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
137 .bytesperline = 352,
138 .sizeimage = 352 * 288,
139 .colorspace = V4L2_COLORSPACE_SRGB,
140 .priv = 0},
125}; 141};
126 142
127#define ETOMS_ALT_SIZE_1000 12 143#define ETOMS_ALT_SIZE_1000 12
@@ -334,7 +350,7 @@ static void Et_init2(struct gspca_dev *gspca_dev)
334 reg_w_val(dev, ET_CTRL, 0x1b); 350 reg_w_val(dev, ET_CTRL, 0x1b);
335 351
336 /* compression et subsampling */ 352 /* compression et subsampling */
337 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) 353 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
338 value = ET_COMP_VAL1; /* 320 */ 354 value = ET_COMP_VAL1; /* 320 */
339 else 355 else
340 value = ET_COMP_VAL0; /* 640 */ 356 value = ET_COMP_VAL0; /* 640 */
@@ -410,7 +426,7 @@ static void Et_init2(struct gspca_dev *gspca_dev)
410/* reg_r(dev, ET_I2C_BASE, &received, 1); 426/* reg_r(dev, ET_I2C_BASE, &received, 1);
411 always 0x40 as the pas106 ??? */ 427 always 0x40 as the pas106 ??? */
412 /* set the sensor */ 428 /* set the sensor */
413 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) 429 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
414 value = 0x04; /* 320 */ 430 value = 0x04; /* 320 */
415 else /* 640 */ 431 else /* 640 */
416 value = 0x1e; /* 0x17 * setting PixelClock 432 value = 0x1e; /* 0x17 * setting PixelClock
@@ -487,12 +503,12 @@ static void Et_init1(struct gspca_dev *gspca_dev)
487 reg_w_val(dev, ET_ClCK, 0x10); 503 reg_w_val(dev, ET_ClCK, 0x10);
488 reg_w_val(dev, ET_CTRL, 0x19); 504 reg_w_val(dev, ET_CTRL, 0x19);
489 /* compression et subsampling */ 505 /* compression et subsampling */
490 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) 506 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
491 value = ET_COMP_VAL1; 507 value = ET_COMP_VAL1;
492 else 508 else
493 value = ET_COMP_VAL0; 509 value = ET_COMP_VAL0;
494 PDEBUG(D_STREAM, "Open mode %d Compression %d", 510 PDEBUG(D_STREAM, "Open mode %d Compression %d",
495 gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode, 511 gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv,
496 value); 512 value);
497 reg_w_val(dev, ET_COMP, value); 513 reg_w_val(dev, ET_COMP, value);
498 reg_w_val(dev, ET_MAXQt, 0x1d); 514 reg_w_val(dev, ET_MAXQt, 0x1d);
@@ -533,7 +549,7 @@ static void Et_init1(struct gspca_dev *gspca_dev)
533 reg_w_val(dev, ET_I2C_CLK, 0x04); 549 reg_w_val(dev, ET_I2C_CLK, 0x04);
534 reg_w_val(dev, ET_PXL_CLK, 0x01); 550 reg_w_val(dev, ET_PXL_CLK, 0x01);
535 /* set the sensor */ 551 /* set the sensor */
536 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 552 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
537 I2c0[0] = 0x06; 553 I2c0[0] = 0x06;
538 Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); 554 Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1);
539 Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); 555 Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1);
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 1225c0fe26f0..cb0aeb0c0a45 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -43,13 +43,11 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
43MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 43MODULE_DESCRIPTION("GSPCA USB Camera Driver");
44MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
45 45
46#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 46#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
47static const char version[] = "2.1.4"; 47static const char version[] = "2.1.5";
48 48
49static int video_nr = -1; 49static int video_nr = -1;
50 50
51static int comp_fac = 30; /* Buffer size ratio when compressed in % */
52
53#ifdef CONFIG_VIDEO_ADV_DEBUG 51#ifdef CONFIG_VIDEO_ADV_DEBUG
54int gspca_debug = D_ERR | D_PROBE; 52int gspca_debug = D_ERR | D_PROBE;
55EXPORT_SYMBOL(gspca_debug); 53EXPORT_SYMBOL(gspca_debug);
@@ -361,58 +359,6 @@ static void rvfree(void *mem, unsigned long size)
361 vfree(mem); 359 vfree(mem);
362} 360}
363 361
364static __u32 get_v4l2_depth(__u32 pixfmt)
365{
366 switch (pixfmt) {
367/* case V4L2_PIX_FMT_BGR32:
368 case V4L2_PIX_FMT_RGB32:
369 return 32; */
370 case V4L2_PIX_FMT_RGB24: /* 'RGB3' */
371 case V4L2_PIX_FMT_BGR24:
372 return 24;
373/* case V4L2_PIX_FMT_RGB565: * 'RGBP' */
374 case V4L2_PIX_FMT_YUYV: /* 'YUYV' packed 4.2.2 */
375 case V4L2_PIX_FMT_YYUV: /* 'YYUV' */
376 return 16;
377 case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */
378 case V4L2_PIX_FMT_SPCA501: /* 'S501' YUYV per line */
379 return 12;
380 case V4L2_PIX_FMT_MJPEG:
381 case V4L2_PIX_FMT_JPEG:
382 case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */
383 case V4L2_PIX_FMT_SN9C10X: /* 'S910' SN9C10x compression */
384 case V4L2_PIX_FMT_SPCA561: /* 'S561' compressed GBRG bayer */
385 case V4L2_PIX_FMT_PAC207: /* 'P207' compressed BGGR bayer */
386 return 8;
387 }
388 PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c",
389 pixfmt & 0xff,
390 (pixfmt >> 8) & 0xff,
391 (pixfmt >> 16) & 0xff,
392 pixfmt >> 24);
393 return 24;
394}
395
396static int gspca_get_buff_size(struct gspca_dev *gspca_dev, int mode)
397{
398 unsigned int size;
399
400 if (gspca_dev->sd_desc->get_buff_size)
401 return gspca_dev->sd_desc->get_buff_size(gspca_dev, mode);
402
403 size = gspca_dev->cam.cam_mode[mode].width *
404 gspca_dev->cam.cam_mode[mode].height *
405 get_v4l2_depth(gspca_dev->cam.cam_mode[mode].pixfmt) / 8;
406 if (!size)
407 return -ENOMEM;
408
409 /* if compressed (JPEG), reduce the buffer size */
410 if (gspca_is_compressed(gspca_dev->cam.cam_mode[mode].pixfmt))
411 size = (size * comp_fac) / 100 + 600; /* (+ JPEG header sz) */
412
413 return size;
414}
415
416static int frame_alloc(struct gspca_dev *gspca_dev, 362static int frame_alloc(struct gspca_dev *gspca_dev,
417 unsigned int count) 363 unsigned int count)
418{ 364{
@@ -420,15 +366,14 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
420 unsigned int frsz; 366 unsigned int frsz;
421 int i; 367 int i;
422 368
423 frsz = gspca_get_buff_size(gspca_dev, gspca_dev->curr_mode); 369 i = gspca_dev->curr_mode;
424 if (frsz < 0) 370 frsz = gspca_dev->cam.cam_mode[i].sizeimage;
425 return frsz;
426 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); 371 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
427 if (count > GSPCA_MAX_FRAMES)
428 count = GSPCA_MAX_FRAMES;
429 frsz = PAGE_ALIGN(frsz); 372 frsz = PAGE_ALIGN(frsz);
430 PDEBUG(D_STREAM, "new fr_sz: %d", frsz); 373 PDEBUG(D_STREAM, "new fr_sz: %d", frsz);
431 gspca_dev->frsz = frsz; 374 gspca_dev->frsz = frsz;
375 if (count > GSPCA_MAX_FRAMES)
376 count = GSPCA_MAX_FRAMES;
432 if (gspca_dev->memory == V4L2_MEMORY_MMAP) { 377 if (gspca_dev->memory == V4L2_MEMORY_MMAP) {
433 gspca_dev->frbuf = rvmalloc(frsz * count); 378 gspca_dev->frbuf = rvmalloc(frsz * count);
434 if (!gspca_dev->frbuf) { 379 if (!gspca_dev->frbuf) {
@@ -711,7 +656,7 @@ static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
711 gspca_dev->curr_mode = i; 656 gspca_dev->curr_mode = i;
712 gspca_dev->width = gspca_dev->cam.cam_mode[i].width; 657 gspca_dev->width = gspca_dev->cam.cam_mode[i].width;
713 gspca_dev->height = gspca_dev->cam.cam_mode[i].height; 658 gspca_dev->height = gspca_dev->cam.cam_mode[i].height;
714 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt; 659 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixelformat;
715} 660}
716 661
717static int wxh_to_mode(struct gspca_dev *gspca_dev, 662static int wxh_to_mode(struct gspca_dev *gspca_dev,
@@ -739,11 +684,13 @@ static int gspca_get_mode(struct gspca_dev *gspca_dev,
739 modeU = modeD = mode; 684 modeU = modeD = mode;
740 while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) { 685 while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) {
741 if (--modeD >= 0) { 686 if (--modeD >= 0) {
742 if (gspca_dev->cam.cam_mode[modeD].pixfmt == pixfmt) 687 if (gspca_dev->cam.cam_mode[modeD].pixelformat
688 == pixfmt)
743 return modeD; 689 return modeD;
744 } 690 }
745 if (++modeU < gspca_dev->cam.nmodes) { 691 if (++modeU < gspca_dev->cam.nmodes) {
746 if (gspca_dev->cam.cam_mode[modeU].pixfmt == pixfmt) 692 if (gspca_dev->cam.cam_mode[modeU].pixelformat
693 == pixfmt)
747 return modeU; 694 return modeU;
748 } 695 }
749 } 696 }
@@ -761,7 +708,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
761 index = 0; 708 index = 0;
762 j = 0; 709 j = 0;
763 for (i = gspca_dev->cam.nmodes; --i >= 0; ) { 710 for (i = gspca_dev->cam.nmodes; --i >= 0; ) {
764 fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixfmt; 711 fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixelformat;
765 j = 0; 712 j = 0;
766 for (;;) { 713 for (;;) {
767 if (fmt_tb[j] == fmt_tb[index]) 714 if (fmt_tb[j] == fmt_tb[index])
@@ -795,20 +742,13 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
795 struct v4l2_format *fmt) 742 struct v4l2_format *fmt)
796{ 743{
797 struct gspca_dev *gspca_dev = priv; 744 struct gspca_dev *gspca_dev = priv;
745 int mode;
798 746
799 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 747 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
800 return -EINVAL; 748 return -EINVAL;
801 fmt->fmt.pix.width = gspca_dev->width; 749 mode = gspca_dev->curr_mode;
802 fmt->fmt.pix.height = gspca_dev->height; 750 memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
803 fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; 751 sizeof fmt->fmt.pix);
804 fmt->fmt.pix.field = V4L2_FIELD_NONE;
805 fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat)
806 * fmt->fmt.pix.width / 8;
807 fmt->fmt.pix.sizeimage = gspca_get_buff_size(gspca_dev,
808 gspca_dev->curr_mode);
809/* (should be in the subdriver) */
810 fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
811 fmt->fmt.pix.priv = 0;
812 return 0; 752 return 0;
813} 753}
814 754
@@ -833,34 +773,19 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
833 mode = wxh_to_mode(gspca_dev, w, h); 773 mode = wxh_to_mode(gspca_dev, w, h);
834 774
835 /* OK if right palette */ 775 /* OK if right palette */
836 if (gspca_dev->cam.cam_mode[mode].pixfmt != fmt->fmt.pix.pixelformat) { 776 if (gspca_dev->cam.cam_mode[mode].pixelformat
777 != fmt->fmt.pix.pixelformat) {
837 778
838 /* else, search the closest mode with the same pixel format */ 779 /* else, search the closest mode with the same pixel format */
839 mode2 = gspca_get_mode(gspca_dev, mode, 780 mode2 = gspca_get_mode(gspca_dev, mode,
840 fmt->fmt.pix.pixelformat); 781 fmt->fmt.pix.pixelformat);
841 if (mode2 >= 0) { 782 if (mode2 >= 0)
842 mode = mode2; 783 mode = mode2;
843 } else { 784/* else
844 785 ; * no chance, return this mode */
845 /* no chance, return this mode */
846 fmt->fmt.pix.pixelformat =
847 gspca_dev->cam.cam_mode[mode].pixfmt;
848#ifdef CONFIG_VIDEO_ADV_DEBUG
849 if (gspca_debug & D_CONF) {
850 PDEBUG_MODE("new format",
851 fmt->fmt.pix.pixelformat,
852 gspca_dev->cam.cam_mode[mode].width,
853 gspca_dev->cam.cam_mode[mode].height);
854 }
855#endif
856 }
857 } 786 }
858 fmt->fmt.pix.width = gspca_dev->cam.cam_mode[mode].width; 787 memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
859 fmt->fmt.pix.height = gspca_dev->cam.cam_mode[mode].height; 788 sizeof fmt->fmt.pix);
860 fmt->fmt.pix.field = V4L2_FIELD_NONE;
861 fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat)
862 * fmt->fmt.pix.width / 8;
863 fmt->fmt.pix.sizeimage = gspca_get_buff_size(gspca_dev, mode);
864 return mode; /* used when s_fmt */ 789 return mode; /* used when s_fmt */
865} 790}
866 791
@@ -883,16 +808,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
883 struct gspca_dev *gspca_dev = priv; 808 struct gspca_dev *gspca_dev = priv;
884 int ret; 809 int ret;
885 810
886#ifdef CONFIG_VIDEO_V4L1_COMPAT
887 /* if v4l1 got JPEG */
888 if (fmt->fmt.pix.pixelformat == 0
889 && gspca_dev->streaming) {
890 fmt->fmt.pix.width = gspca_dev->width;
891 fmt->fmt.pix.height = gspca_dev->height;
892 fmt->fmt.pix.pixelformat = gspca_dev->pixfmt;
893 return 0;
894 }
895#endif
896 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 811 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
897 return -ERESTARTSYS; 812 return -ERESTARTSYS;
898 813
@@ -1994,6 +1909,3 @@ MODULE_PARM_DESC(debug,
1994 " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout" 1909 " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"
1995 " 0x0100: v4l2"); 1910 " 0x0100: v4l2");
1996#endif 1911#endif
1997module_param(comp_fac, int, 0644);
1998MODULE_PARM_DESC(comp_fac,
1999 "Buffer size ratio when compressed in percent");
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 05e8ee06071b..945f1ab4c9eb 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -52,15 +52,9 @@ extern int gspca_debug;
52#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */ 52#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */
53 53
54/* device information - set at probe time */ 54/* device information - set at probe time */
55struct cam_mode {
56 __u32 pixfmt;
57 short width;
58 short height;
59 short mode; /* subdriver value */
60};
61struct cam { 55struct cam {
62 char *dev_name; 56 char *dev_name;
63 struct cam_mode *cam_mode; /* size nmodes */ 57 struct v4l2_pix_format *cam_mode; /* size nmodes */
64 char nmodes; 58 char nmodes;
65 __u8 epaddr; 59 __u8 epaddr;
66}; 60};
@@ -80,7 +74,6 @@ typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev,
80 struct gspca_frame *frame, 74 struct gspca_frame *frame,
81 __u8 *data, 75 __u8 *data,
82 int len); 76 int len);
83typedef int (*cam_get_buff_size_op) (struct gspca_dev *gspca_dev, int mode);
84 77
85struct ctrl { 78struct ctrl {
86 struct v4l2_queryctrl qctrl; 79 struct v4l2_queryctrl qctrl;
@@ -102,12 +95,12 @@ struct sd_desc {
102 cam_v_op stopN; /* called on stream off - main alt */ 95 cam_v_op stopN; /* called on stream off - main alt */
103 cam_v_op stop0; /* called on stream off - alt 0 */ 96 cam_v_op stop0; /* called on stream off - alt 0 */
104 cam_v_op close; /* called on close */ 97 cam_v_op close; /* called on close */
105 cam_v_op dq_callback; /* called when a frame has been dequeued */
106 cam_pkt_op pkt_scan; 98 cam_pkt_op pkt_scan;
99/* optional operations */
100 cam_v_op dq_callback; /* called when a frame has been dequeued */
107 cam_jpg_op get_jcomp; 101 cam_jpg_op get_jcomp;
108 cam_jpg_op set_jcomp; 102 cam_jpg_op set_jcomp;
109 cam_qmnu_op querymenu; 103 cam_qmnu_op querymenu;
110 cam_get_buff_size_op get_buff_size; /* optional */
111}; 104};
112 105
113/* packet types when moving from iso buf to frame buf */ 106/* packet types when moving from iso buf to frame buf */
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index c70ccc8fe68b..23f3dba8012a 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -24,8 +24,8 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
@@ -42,9 +42,17 @@ struct sd {
42static struct ctrl sd_ctrls[] = { 42static struct ctrl sd_ctrls[] = {
43}; 43};
44 44
45static struct cam_mode vga_mode[] = { 45static struct v4l2_pix_format vga_mode[] = {
46 {V4L2_PIX_FMT_JPEG, 320, 240, 2}, 46 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
47 {V4L2_PIX_FMT_JPEG, 640, 480, 1}, 47 .bytesperline = 320,
48 .sizeimage = 320 * 240 * 3 / 8 + 589,
49 .colorspace = V4L2_COLORSPACE_JPEG,
50 .priv = 2},
51 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
52 .bytesperline = 640,
53 .sizeimage = 640 * 480 * 3 / 8 + 590,
54 .colorspace = V4L2_COLORSPACE_JPEG,
55 .priv = 1},
48}; 56};
49 57
50/* MI Register table //elvis */ 58/* MI Register table //elvis */
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index d92729ac41f0..70b4cac37a50 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 30MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("OV519 USB Camera Driver"); 31MODULE_DESCRIPTION("OV519 USB Camera Driver");
@@ -126,13 +126,29 @@ static struct ctrl sd_ctrls[] = {
126 }, 126 },
127}; 127};
128 128
129static struct cam_mode vga_mode[] = { 129static struct v4l2_pix_format vga_mode[] = {
130 {V4L2_PIX_FMT_JPEG, 320, 240}, 130 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
131 {V4L2_PIX_FMT_JPEG, 640, 480}, 131 .bytesperline = 320,
132 .sizeimage = 320 * 240 * 3 / 8 + 589,
133 .colorspace = V4L2_COLORSPACE_JPEG,
134 .priv = 1},
135 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
136 .bytesperline = 640,
137 .sizeimage = 640 * 480 * 3 / 8 + 590,
138 .colorspace = V4L2_COLORSPACE_JPEG,
139 .priv = 0},
132}; 140};
133static struct cam_mode sif_mode[] = { 141static struct v4l2_pix_format sif_mode[] = {
134 {V4L2_PIX_FMT_JPEG, 176, 144}, 142 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
135 {V4L2_PIX_FMT_JPEG, 352, 288}, 143 .bytesperline = 176,
144 .sizeimage = 176 * 144 * 3 / 8 + 589,
145 .colorspace = V4L2_COLORSPACE_JPEG,
146 .priv = 1},
147 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
148 .bytesperline = 352,
149 .sizeimage = 352 * 288 * 3 / 8 + 589,
150 .colorspace = V4L2_COLORSPACE_JPEG,
151 .priv = 0},
136}; 152};
137 153
138/* OV519 Camera interface register numbers */ 154/* OV519 Camera interface register numbers */
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index ab83d7b69348..b580af92d231 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -27,8 +27,8 @@
27 27
28#include "gspca.h" 28#include "gspca.h"
29 29
30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
31static const char version[] = "2.1.4"; 31static const char version[] = "2.1.5";
32 32
33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
34MODULE_DESCRIPTION("Pixart PAC207"); 34MODULE_DESCRIPTION("Pixart PAC207");
@@ -157,9 +157,18 @@ static struct ctrl sd_ctrls[] = {
157 }, 157 },
158}; 158};
159 159
160static struct cam_mode sif_mode[] = { 160static struct v4l2_pix_format sif_mode[] = {
161 {V4L2_PIX_FMT_PAC207, 176, 144, 1}, 161 {176, 144, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE,
162 {V4L2_PIX_FMT_PAC207, 352, 288, 0}, 162 .bytesperline = 176,
163 .sizeimage = (176 + 2) * 144,
164 /* uncompressed, add 2 bytes / line for line header */
165 .colorspace = V4L2_COLORSPACE_SRGB,
166 .priv = 1},
167 {352, 288, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE,
168 .bytesperline = 352,
169 .sizeimage = 352 * 288 / 2, /* compressed */
170 .colorspace = V4L2_COLORSPACE_SRGB,
171 .priv = 0},
163}; 172};
164 173
165static const __u8 pac207_sensor_init[][8] = { 174static const __u8 pac207_sensor_init[][8] = {
@@ -346,19 +355,6 @@ static void sd_close(struct gspca_dev *gspca_dev)
346{ 355{
347} 356}
348 357
349static int sd_get_buff_size_op(struct gspca_dev *gspca_dev, int mode)
350{
351 switch (gspca_dev->cam.cam_mode[mode].width) {
352 case 176: /* 176x144 */
353 /* uncompressed, add 2 bytes / line for line header */
354 return (176 + 2) * 144;
355 case 352: /* 352x288 */
356 /* compressed */
357 return 352 * 288 / 2;
358 }
359 return -EIO; /* should never happen */
360}
361
362/* auto gain and exposure algorithm based on the knee algorithm described here: 358/* auto gain and exposure algorithm based on the knee algorithm described here:
363 * <http://ytse.tricolour.net/docs/LowLightOptimization.html> */ 359 * <http://ytse.tricolour.net/docs/LowLightOptimization.html> */
364static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) 360static void pac207_do_auto_gain(struct gspca_dev *gspca_dev)
@@ -632,7 +628,6 @@ static const struct sd_desc sd_desc = {
632 .close = sd_close, 628 .close = sd_close,
633 .dq_callback = pac207_do_auto_gain, 629 .dq_callback = pac207_do_auto_gain,
634 .pkt_scan = sd_pkt_scan, 630 .pkt_scan = sd_pkt_scan,
635 .get_buff_size = sd_get_buff_size_op,
636}; 631};
637 632
638/* -- module initialisation -- */ 633/* -- module initialisation -- */
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index c2d4b6a4dcf4..1a2347aa7157 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -23,8 +23,8 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
27static const char version[] = "2.1.4"; 27static const char version[] = "2.1.5";
28 28
29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); 29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
30MODULE_DESCRIPTION("Pixart PAC7311"); 30MODULE_DESCRIPTION("Pixart PAC7311");
@@ -116,10 +116,22 @@ static struct ctrl sd_ctrls[] = {
116 }, 116 },
117}; 117};
118 118
119static struct cam_mode vga_mode[] = { 119static struct v4l2_pix_format vga_mode[] = {
120 {V4L2_PIX_FMT_JPEG, 160, 120, 2}, 120 {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
121 {V4L2_PIX_FMT_JPEG, 320, 240, 1}, 121 .bytesperline = 160,
122 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 122 .sizeimage = 160 * 120 * 3 / 8 + 590,
123 .colorspace = V4L2_COLORSPACE_JPEG,
124 .priv = 2},
125 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
126 .bytesperline = 320,
127 .sizeimage = 320 * 240 * 3 / 8 + 590,
128 .colorspace = V4L2_COLORSPACE_JPEG,
129 .priv = 1},
130 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
131 .bytesperline = 640,
132 .sizeimage = 640 * 480 * 3 / 8 + 590,
133 .colorspace = V4L2_COLORSPACE_JPEG,
134 .priv = 0},
123}; 135};
124 136
125#define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */ 137#define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */
@@ -393,7 +405,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
393 setcolors(gspca_dev); 405 setcolors(gspca_dev);
394 406
395 /* set correct resolution */ 407 /* set correct resolution */
396 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 408 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
397 case 2: /* 160x120 */ 409 case 2: /* 160x120 */
398 pac7311_reg_write(dev, 0xff, 0x04); 410 pac7311_reg_write(dev, 0xff, 0x04);
399 pac7311_reg_write(dev, 0x02, 0x03); 411 pac7311_reg_write(dev, 0x02, 0x03);
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 4baac51bf40a..574568736317 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.3"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver");
@@ -95,15 +95,34 @@ static struct ctrl sd_ctrls[] = {
95 }, 95 },
96}; 96};
97 97
98/* fixme: should have V4L2_PIX_FMT_SN9C10X */ 98static struct v4l2_pix_format vga_mode[] = {
99static struct cam_mode vga_mode[] = { 99 {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
100 {V4L2_PIX_FMT_SN9C10X, 160, 120, 2}, 100 .bytesperline = 160,
101 {V4L2_PIX_FMT_SN9C10X, 320, 240, 1}, 101 .sizeimage = 160 * 120,
102 {V4L2_PIX_FMT_SN9C10X, 640, 480, 0}, 102 .colorspace = V4L2_COLORSPACE_SRGB,
103 .priv = 2},
104 {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
105 .bytesperline = 320,
106 .sizeimage = 320 * 240,
107 .colorspace = V4L2_COLORSPACE_SRGB,
108 .priv = 1},
109 {640, 480, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
110 .bytesperline = 640,
111 .sizeimage = 640 * 480,
112 .colorspace = V4L2_COLORSPACE_SRGB,
113 .priv = 0},
103}; 114};
104static struct cam_mode sif_mode[] = { 115static struct v4l2_pix_format sif_mode[] = {
105 {V4L2_PIX_FMT_SN9C10X, 176, 144, 1}, 116 {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
106 {V4L2_PIX_FMT_SN9C10X, 352, 288, 0}, 117 .bytesperline = 176,
118 .sizeimage = 176 * 144,
119 .colorspace = V4L2_COLORSPACE_SRGB,
120 .priv = 1},
121 {352, 288, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
122 .bytesperline = 352,
123 .sizeimage = 352 * 288,
124 .colorspace = V4L2_COLORSPACE_SRGB,
125 .priv = 0},
107}; 126};
108 127
109static const __u8 probe_ov7630[] = {0x08, 0x44}; 128static const __u8 probe_ov7630[] = {0x08, 0x44};
@@ -592,7 +611,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
592 __u8 reg01, reg17; 611 __u8 reg01, reg17;
593 __u8 reg17_19[3]; 612 __u8 reg17_19[3];
594 613
595 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 614 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
596 switch (sd->sensor) { 615 switch (sd->sensor) {
597 case SENSOR_HV7131R: 616 case SENSOR_HV7131R:
598 sn9c10x = initHv7131; 617 sn9c10x = initHv7131;
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index eb5e1bfd7911..3db6487a705d 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -24,8 +24,8 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
@@ -132,10 +132,22 @@ static struct ctrl sd_ctrls[] = {
132 }, 132 },
133}; 133};
134 134
135static struct cam_mode vga_mode[] = { 135static struct v4l2_pix_format vga_mode[] = {
136 {V4L2_PIX_FMT_JPEG, 160, 120, 2}, 136 {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
137 {V4L2_PIX_FMT_JPEG, 320, 240, 1}, 137 .bytesperline = 160,
138 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 138 .sizeimage = 160 * 120 * 3 / 8 + 590,
139 .colorspace = V4L2_COLORSPACE_JPEG,
140 .priv = 2},
141 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
142 .bytesperline = 320,
143 .sizeimage = 320 * 240 * 3 / 8 + 590,
144 .colorspace = V4L2_COLORSPACE_JPEG,
145 .priv = 1},
146 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
147 .bytesperline = 640,
148 .sizeimage = 640 * 480 * 3 / 8 + 590,
149 .colorspace = V4L2_COLORSPACE_JPEG,
150 .priv = 0},
139}; 151};
140 152
141/*Data from sn9c102p+hv71331r */ 153/*Data from sn9c102p+hv71331r */
@@ -1232,7 +1244,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1232 reg_w(dev, 0x99, &data, 1); 1244 reg_w(dev, 0x99, &data, 1);
1233 } 1245 }
1234 1246
1235 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 1247 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1236 reg1 = 0x02; 1248 reg1 = 0x02;
1237 reg17 = 0x61; 1249 reg17 = 0x61;
1238 switch (sd->sensor) { 1250 switch (sd->sensor) {
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 3a42506830f8..d00f0f76e0e3 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -24,8 +24,8 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
@@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = {
114 }, 114 },
115}; 115};
116 116
117static struct cam_mode vga_mode[] = { 117static struct v4l2_pix_format vga_mode[] = {
118 {V4L2_PIX_FMT_JPEG, 320, 240, 1}, 118 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
119 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 119 .bytesperline = 320,
120 .sizeimage = 320 * 240 * 3 / 8 + 590,
121 .colorspace = V4L2_COLORSPACE_JPEG,
122 .priv = 1},
123 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
124 .bytesperline = 640,
125 .sizeimage = 640 * 480 * 3 / 8 + 590,
126 .colorspace = V4L2_COLORSPACE_JPEG,
127 .priv = 0},
120}; 128};
121 129
122static struct cam_mode sif_mode[] = { 130static struct v4l2_pix_format sif_mode[] = {
123 {V4L2_PIX_FMT_JPEG, 176, 144, 1}, 131 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
124 {V4L2_PIX_FMT_JPEG, 352, 288, 0}, 132 .bytesperline = 176,
133 .sizeimage = 176 * 144 * 3 / 8 + 590,
134 .colorspace = V4L2_COLORSPACE_JPEG,
135 .priv = 1},
136 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
137 .bytesperline = 352,
138 .sizeimage = 352 * 288 * 3 / 8 + 590,
139 .colorspace = V4L2_COLORSPACE_JPEG,
140 .priv = 0},
125}; 141};
126 142
127/* Frame packet header offsets for the spca500 */ 143/* Frame packet header offsets for the spca500 */
@@ -515,7 +531,7 @@ static void spca500_setmode(struct gspca_dev *gspca_dev,
515 reg_w(gspca_dev->dev, 0, 0x8002, ymult); 531 reg_w(gspca_dev->dev, 0, 0x8002, ymult);
516 532
517 /* use compressed mode, VGA, with mode specific subsample */ 533 /* use compressed mode, VGA, with mode specific subsample */
518 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 534 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
519 reg_w(gspca_dev->dev, 0, 0x8003, mode << 4); 535 reg_w(gspca_dev->dev, 0, 0x8003, mode << 4);
520} 536}
521 537
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 417fbe2214be..2064dc008af1 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -23,8 +23,8 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
27static const char version[] = "2.1.4"; 27static const char version[] = "2.1.5";
28 28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); 30MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
@@ -101,10 +101,22 @@ static struct ctrl sd_ctrls[] = {
101 }, 101 },
102}; 102};
103 103
104static struct cam_mode vga_mode[] = { 104static struct v4l2_pix_format vga_mode[] = {
105 {V4L2_PIX_FMT_SPCA501, 160, 120, 2}, 105 {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
106 {V4L2_PIX_FMT_SPCA501, 320, 240, 1}, 106 .bytesperline = 160,
107 {V4L2_PIX_FMT_SPCA501, 640, 480, 0}, 107 .sizeimage = 160 * 120 * 3 / 8,
108 .colorspace = V4L2_COLORSPACE_SRGB,
109 .priv = 2},
110 {320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
111 .bytesperline = 320,
112 .sizeimage = 320 * 240 * 3 / 8,
113 .colorspace = V4L2_COLORSPACE_SRGB,
114 .priv = 1},
115 {640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
116 .bytesperline = 640,
117 .sizeimage = 640 * 480 * 3 / 8,
118 .colorspace = V4L2_COLORSPACE_SRGB,
119 .priv = 0},
108}; 120};
109 121
110#define SPCA50X_REG_USB 0x2 /* spca505 501 */ 122#define SPCA50X_REG_USB 0x2 /* spca505 501 */
@@ -2029,7 +2041,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
2029 int mode; 2041 int mode;
2030 2042
2031 /* memorize the wanted pixel format */ 2043 /* memorize the wanted pixel format */
2032 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 2044 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
2033 2045
2034 /* Enable ISO packet machine CTRL reg=2, 2046 /* Enable ISO packet machine CTRL reg=2,
2035 * index=1 bitmask=0x2 (bit ordinal 1) */ 2047 * index=1 bitmask=0x2 (bit ordinal 1) */
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index 30d174fc4b9c..5d28d23b8375 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -23,8 +23,8 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
27static const char version[] = "2.1.4"; 27static const char version[] = "2.1.5";
28 28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); 30MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
@@ -66,12 +66,32 @@ static struct ctrl sd_ctrls[] = {
66 }, 66 },
67}; 67};
68 68
69static struct cam_mode vga_mode[] = { 69static struct v4l2_pix_format vga_mode[] = {
70 {V4L2_PIX_FMT_YUYV, 160, 120, 5}, 70 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
71 {V4L2_PIX_FMT_YUYV, 176, 144, 4}, 71 .bytesperline = 160 * 2,
72 {V4L2_PIX_FMT_YUYV, 320, 240, 2}, 72 .sizeimage = 160 * 120 * 2,
73 {V4L2_PIX_FMT_YUYV, 352, 288, 1}, 73 .colorspace = V4L2_COLORSPACE_SRGB,
74 {V4L2_PIX_FMT_YUYV, 640, 480, 0}, 74 .priv = 5},
75 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
76 .bytesperline = 176 * 2,
77 .sizeimage = 176 * 144 * 2,
78 .colorspace = V4L2_COLORSPACE_SRGB,
79 .priv = 4},
80 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
81 .bytesperline = 320 * 2,
82 .sizeimage = 320 * 240 * 2,
83 .colorspace = V4L2_COLORSPACE_SRGB,
84 .priv = 2},
85 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
86 .bytesperline = 352 * 2,
87 .sizeimage = 352 * 288 * 2,
88 .colorspace = V4L2_COLORSPACE_SRGB,
89 .priv = 1},
90 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
91 .bytesperline = 640 * 2,
92 .sizeimage = 640 * 480 * 2,
93 .colorspace = V4L2_COLORSPACE_SRGB,
94 .priv = 0},
75}; 95};
76 96
77#define SPCA50X_OFFSET_DATA 10 97#define SPCA50X_OFFSET_DATA 10
@@ -708,7 +728,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
708 * only once after loading module */ 728 * only once after loading module */
709 /* stopping usb registers Tomasz change */ 729 /* stopping usb registers Tomasz change */
710 reg_write(dev, 0x02, 0x0, 0x0); 730 reg_write(dev, 0x02, 0x0, 0x0);
711 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 731 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
712 case 0: 732 case 0:
713 reg_write(dev, 0x04, 0x00, 0x00); 733 reg_write(dev, 0x04, 0x00, 0x00);
714 reg_write(dev, 0x04, 0x06, 0x10); 734 reg_write(dev, 0x04, 0x06, 0x10);
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 614fb3ad7711..2d249b00bdcd 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -25,8 +25,8 @@
25 25
26#include "gspca.h" 26#include "gspca.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
29static const char version[] = "2.1.0"; 29static const char version[] = "2.1.5";
30 30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); 32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
@@ -34,11 +34,11 @@ MODULE_LICENSE("GPL");
34 34
35/* specific webcam descriptor */ 35/* specific webcam descriptor */
36struct sd { 36struct sd {
37 struct gspca_dev gspca_dev; /* !! must be the first item */ 37 struct gspca_dev gspca_dev; /* !! must be the first item */
38 38
39 int buflen; 39 int buflen;
40 unsigned char tmpbuf[640 * 480 * 3]; /* YYUV per line */ 40 __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
41 unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */ 41 __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
42 42
43 unsigned char brightness; 43 unsigned char brightness;
44 unsigned char contrast; 44 unsigned char contrast;
@@ -117,12 +117,32 @@ static struct ctrl sd_ctrls[] = {
117 }, 117 },
118}; 118};
119 119
120static struct cam_mode vga_mode[] = { 120static struct v4l2_pix_format vga_mode[] = {
121 {V4L2_PIX_FMT_YUYV, 160, 120, 5}, 121 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
122 {V4L2_PIX_FMT_YUYV, 176, 144, 4}, 122 .bytesperline = 160 * 2,
123 {V4L2_PIX_FMT_YUYV, 320, 240, 2}, 123 .sizeimage = 160 * 120 * 2,
124 {V4L2_PIX_FMT_YUYV, 352, 288, 1}, 124 .colorspace = V4L2_COLORSPACE_SRGB,
125 {V4L2_PIX_FMT_YUYV, 640, 480, 0}, 125 .priv = 5},
126 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
127 .bytesperline = 176 * 2,
128 .sizeimage = 176 * 144 * 2,
129 .colorspace = V4L2_COLORSPACE_SRGB,
130 .priv = 4},
131 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
132 .bytesperline = 320 * 2,
133 .sizeimage = 320 * 240 * 2,
134 .colorspace = V4L2_COLORSPACE_SRGB,
135 .priv = 2},
136 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
137 .bytesperline = 352 * 2,
138 .sizeimage = 352 * 288 * 2,
139 .colorspace = V4L2_COLORSPACE_SRGB,
140 .priv = 1},
141 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
142 .bytesperline = 640 * 2,
143 .sizeimage = 640 * 480 * 2,
144 .colorspace = V4L2_COLORSPACE_SRGB,
145 .priv = 0},
126}; 146};
127 147
128#define SPCA50X_OFFSET_DATA 10 148#define SPCA50X_OFFSET_DATA 10
@@ -169,7 +189,7 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
169 __u16 reg) 189 __u16 reg)
170{ 190{
171 int retry = 60; 191 int retry = 60;
172 unsigned char Data[2]; 192 __u8 Data[2];
173 193
174 reg_w(gspca_dev->dev, 0x07, reg, 0x0001); 194 reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
175 reg_w(gspca_dev->dev, 0x07, valeur, 0x0000); 195 reg_w(gspca_dev->dev, 0x07, valeur, 0x0000);
@@ -183,8 +203,8 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
183static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg) 203static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg)
184{ 204{
185 int retry = 60; 205 int retry = 60;
186 unsigned char Data[2]; 206 __u8 Data[2];
187 unsigned char value; 207 __u8 value;
188 208
189 reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004); 209 reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004);
190 reg_w(gspca_dev->dev, 0x07, reg, 0x0001); 210 reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
@@ -513,7 +533,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
513 reg_w(dev, 0x05, 0x00, 0x0004); 533 reg_w(dev, 0x05, 0x00, 0x0004);
514 reg_w(dev, 0x03, 0x10, 0x0001); 534 reg_w(dev, 0x03, 0x10, 0x0001);
515 reg_w(dev, 0x03, 0x78, 0x0000); 535 reg_w(dev, 0x03, 0x78, 0x0000);
516 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 536 switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
517 case 0: 537 case 0:
518 spca506_Setsize(gspca_dev, 0, 0x10, 0x10); 538 spca506_Setsize(gspca_dev, 0, 0x10, 0x10);
519 break; 539 break;
@@ -593,7 +613,7 @@ static void yyuv_decode(unsigned char *out,
593 613
594static void sd_pkt_scan(struct gspca_dev *gspca_dev, 614static void sd_pkt_scan(struct gspca_dev *gspca_dev,
595 struct gspca_frame *frame, /* target */ 615 struct gspca_frame *frame, /* target */
596 unsigned char *data, /* isoc packet */ 616 __u8 *data, /* isoc packet */
597 int len) /* iso packet length */ 617 int len) /* iso packet length */
598{ 618{
599 struct sd *sd = (struct sd *) gspca_dev; 619 struct sd *sd = (struct sd *) gspca_dev;
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 3b54f41d21c1..169238d40c97 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -22,8 +22,8 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
26static const char version[] = "2.1.4"; 26static const char version[] = "2.1.5";
27 27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
@@ -69,11 +69,27 @@ static struct ctrl sd_ctrls[] = {
69 }, 69 },
70}; 70};
71 71
72static struct cam_mode sif_mode[] = { 72static struct v4l2_pix_format sif_mode[] = {
73 {V4L2_PIX_FMT_YUYV, 160, 120, 3}, 73 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
74 {V4L2_PIX_FMT_YUYV, 176, 144, 2}, 74 .bytesperline = 160 * 2,
75 {V4L2_PIX_FMT_YUYV, 320, 240, 1}, 75 .sizeimage = 160 * 120 * 2,
76 {V4L2_PIX_FMT_YUYV, 352, 288, 0}, 76 .colorspace = V4L2_COLORSPACE_SRGB,
77 .priv = 3},
78 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
79 .bytesperline = 176 * 2,
80 .sizeimage = 176 * 144 * 2,
81 .colorspace = V4L2_COLORSPACE_SRGB,
82 .priv = 2},
83 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
84 .bytesperline = 320 * 2,
85 .sizeimage = 320 * 240 * 2,
86 .colorspace = V4L2_COLORSPACE_SRGB,
87 .priv = 1},
88 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
89 .bytesperline = 352 * 2,
90 .sizeimage = 352 * 288 * 2,
91 .colorspace = V4L2_COLORSPACE_SRGB,
92 .priv = 0},
77}; 93};
78 94
79/* Frame packet header offsets for the spca508 */ 95/* Frame packet header offsets for the spca508 */
@@ -1574,7 +1590,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1574{ 1590{
1575 int mode; 1591 int mode;
1576 1592
1577 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 1593 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1578 reg_write(gspca_dev->dev, 0x8500, mode); 1594 reg_write(gspca_dev->dev, 0x8500, mode);
1579 switch (mode) { 1595 switch (mode) {
1580 case 0: 1596 case 0:
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index 8e39cbdda2a5..f0770ee595d8 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
@@ -97,11 +97,27 @@ static struct ctrl sd_ctrls[] = {
97 }, 97 },
98}; 98};
99 99
100static struct cam_mode sif_mode[] = { 100static struct v4l2_pix_format sif_mode[] = {
101 {V4L2_PIX_FMT_SGBRG8, 160, 120, 3}, 101 {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
102 {V4L2_PIX_FMT_SGBRG8, 176, 144, 2}, 102 .bytesperline = 160,
103 {V4L2_PIX_FMT_SPCA561, 320, 240, 1}, 103 .sizeimage = 160 * 120,
104 {V4L2_PIX_FMT_SPCA561, 352, 288, 0}, 104 .colorspace = V4L2_COLORSPACE_SRGB,
105 .priv = 3},
106 {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
107 .bytesperline = 176,
108 .sizeimage = 176 * 144,
109 .colorspace = V4L2_COLORSPACE_SRGB,
110 .priv = 2},
111 {320, 240, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE,
112 .bytesperline = 320,
113 .sizeimage = 320 * 240 * 4 / 8,
114 .colorspace = V4L2_COLORSPACE_SRGB,
115 .priv = 1},
116 {352, 288, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE,
117 .bytesperline = 352,
118 .sizeimage = 352 * 288 * 4 / 8,
119 .colorspace = V4L2_COLORSPACE_SRGB,
120 .priv = 0},
105}; 121};
106 122
107/* 123/*
@@ -655,7 +671,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
655 __u8 Reg8307[] = { 0xaa, 0x00 }; 671 __u8 Reg8307[] = { 0xaa, 0x00 };
656 int mode; 672 int mode;
657 673
658 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 674 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
659 switch (sd->chip_revision) { 675 switch (sd->chip_revision) {
660 case Rev072A: 676 case Rev072A:
661 switch (mode) { 677 switch (mode) {
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index ad59c5ab5d90..d676cd16aa74 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -23,8 +23,8 @@
23#include "gspca.h" 23#include "gspca.h"
24#include "jpeg.h" 24#include "jpeg.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
27static const char version[] = "2.1.4"; 27static const char version[] = "2.1.5";
28 28
29MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 29MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
30MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); 30MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
@@ -112,9 +112,17 @@ static struct ctrl sd_ctrls[] = {
112 }, 112 },
113}; 113};
114 114
115static struct cam_mode vga_mode[] = { 115static struct v4l2_pix_format vga_mode[] = {
116 {V4L2_PIX_FMT_JPEG, 320, 240}, 116 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
117 {V4L2_PIX_FMT_JPEG, 640, 480}, 117 .bytesperline = 320,
118 .sizeimage = 320 * 240 * 3 / 8 + 590,
119 .colorspace = V4L2_COLORSPACE_JPEG,
120 .priv = 1},
121 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
122 .bytesperline = 640,
123 .sizeimage = 640 * 480 * 3 / 8 + 590,
124 .colorspace = V4L2_COLORSPACE_JPEG,
125 .priv = 0},
118}; 126};
119 127
120/* -- read a register -- */ 128/* -- read a register -- */
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index f2d033508581..f66594a113a7 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -24,8 +24,8 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
@@ -126,21 +126,53 @@ static struct ctrl sd_ctrls[] = {
126 }, 126 },
127}; 127};
128 128
129static struct cam_mode vga_mode[] = { 129static struct v4l2_pix_format vga_mode[] = {
130 {V4L2_PIX_FMT_JPEG, 320, 240, 2}, 130 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
131 {V4L2_PIX_FMT_JPEG, 640, 480, 1}, 131 .bytesperline = 320,
132 .sizeimage = 320 * 240 * 3 / 8 + 590,
133 .colorspace = V4L2_COLORSPACE_JPEG,
134 .priv = 2},
135 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
136 .bytesperline = 640,
137 .sizeimage = 640 * 480 * 3 / 8 + 590,
138 .colorspace = V4L2_COLORSPACE_JPEG,
139 .priv = 1},
132}; 140};
133 141
134static struct cam_mode custom_mode[] = { 142static struct v4l2_pix_format custom_mode[] = {
135 {V4L2_PIX_FMT_JPEG, 320, 240, 2}, 143 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
136 {V4L2_PIX_FMT_JPEG, 464, 480, 1}, 144 .bytesperline = 320,
145 .sizeimage = 320 * 240 * 3 / 8 + 590,
146 .colorspace = V4L2_COLORSPACE_JPEG,
147 .priv = 2},
148 {464, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
149 .bytesperline = 464,
150 .sizeimage = 464 * 480 * 3 / 8 + 590,
151 .colorspace = V4L2_COLORSPACE_JPEG,
152 .priv = 1},
137}; 153};
138 154
139static struct cam_mode vga_mode2[] = { 155static struct v4l2_pix_format vga_mode2[] = {
140 {V4L2_PIX_FMT_JPEG, 176, 144, 4}, 156 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
141 {V4L2_PIX_FMT_JPEG, 320, 240, 3}, 157 .bytesperline = 176,
142 {V4L2_PIX_FMT_JPEG, 352, 288, 2}, 158 .sizeimage = 176 * 144 * 3 / 8 + 590,
143 {V4L2_PIX_FMT_JPEG, 640, 480, 1}, 159 .colorspace = V4L2_COLORSPACE_JPEG,
160 .priv = 4},
161 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
162 .bytesperline = 320,
163 .sizeimage = 320 * 240 * 3 / 8 + 590,
164 .colorspace = V4L2_COLORSPACE_JPEG,
165 .priv = 3},
166 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
167 .bytesperline = 352,
168 .sizeimage = 352 * 288 * 3 / 8 + 590,
169 .colorspace = V4L2_COLORSPACE_JPEG,
170 .priv = 2},
171 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
172 .bytesperline = 640,
173 .sizeimage = 640 * 480 * 3 / 8 + 590,
174 .colorspace = V4L2_COLORSPACE_JPEG,
175 .priv = 1},
144}; 176};
145 177
146#define SPCA50X_OFFSET_DATA 10 178#define SPCA50X_OFFSET_DATA 10
@@ -655,7 +687,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
655 __u8 Type; 687 __u8 Type;
656 int rc; 688 int rc;
657 689
658 Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 690 Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
659 Type = 0; 691 Type = 0;
660 switch (sd->bridge) { 692 switch (sd->bridge) {
661 case BRIDGE_SPCA533: 693 case BRIDGE_SPCA533:
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 96f01d267475..299f84584e82 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -26,8 +26,8 @@
26 26
27#define MODULE_NAME "t613" 27#define MODULE_NAME "t613"
28#include "gspca.h" 28#include "gspca.h"
29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
30static const char version[] = "2.1.4"; 30static const char version[] = "2.1.5";
31 31
32#define MAX_GAMMA 0x10 /* 0 to 15 */ 32#define MAX_GAMMA 0x10 /* 0 to 15 */
33 33
@@ -232,12 +232,32 @@ static char *effects_control[] = {
232 "Negative", 232 "Negative",
233}; 233};
234 234
235static struct cam_mode vga_mode_t16[] = { 235static struct v4l2_pix_format vga_mode_t16[] = {
236 {V4L2_PIX_FMT_JPEG, 160, 120, 4}, 236 {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
237 {V4L2_PIX_FMT_JPEG, 176, 144, 3}, 237 .bytesperline = 160,
238 {V4L2_PIX_FMT_JPEG, 320, 240, 2}, 238 .sizeimage = 160 * 120 * 3 / 8 + 590,
239 {V4L2_PIX_FMT_JPEG, 352, 288, 1}, 239 .colorspace = V4L2_COLORSPACE_JPEG,
240 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 240 .priv = 4},
241 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
242 .bytesperline = 176,
243 .sizeimage = 176 * 144 * 3 / 8 + 590,
244 .colorspace = V4L2_COLORSPACE_JPEG,
245 .priv = 3},
246 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
247 .bytesperline = 320,
248 .sizeimage = 320 * 240 * 3 / 8 + 590,
249 .colorspace = V4L2_COLORSPACE_JPEG,
250 .priv = 2},
251 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
252 .bytesperline = 352,
253 .sizeimage = 352 * 288 * 3 / 8 + 590,
254 .colorspace = V4L2_COLORSPACE_JPEG,
255 .priv = 1},
256 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
257 .bytesperline = 640,
258 .sizeimage = 640 * 480 * 3 / 8 + 590,
259 .colorspace = V4L2_COLORSPACE_JPEG,
260 .priv = 0},
241}; 261};
242 262
243#define T16_OFFSET_DATA 631 263#define T16_OFFSET_DATA 631
@@ -848,7 +868,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
848 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; 868 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
849 static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; 869 static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
850 870
851 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode; 871 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv;
852 switch (mode) { 872 switch (mode) {
853 case 1: /* 352x288 */ 873 case 1: /* 352x288 */
854 t2[1] = 0x40; 874 t2[1] = 0x40;
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 8561234d65e2..f9bffd67991e 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -22,8 +22,8 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
26static const char version[] = "2.1.4"; 26static const char version[] = "2.1.5";
27 27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("TV8532 USB Camera Driver"); 29MODULE_DESCRIPTION("TV8532 USB Camera Driver");
@@ -81,9 +81,17 @@ static struct ctrl sd_ctrls[] = {
81 }, 81 },
82}; 82};
83 83
84static struct cam_mode sif_mode[] = { 84static struct v4l2_pix_format sif_mode[] = {
85 {V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, 85 {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
86 {V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, 86 .bytesperline = 176,
87 .sizeimage = 176 * 144,
88 .colorspace = V4L2_COLORSPACE_SRGB,
89 .priv = 1},
90 {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
91 .bytesperline = 352,
92 .sizeimage = 352 * 288,
93 .colorspace = V4L2_COLORSPACE_SRGB,
94 .priv = 0},
87}; 95};
88 96
89/* 97/*
@@ -440,7 +448,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
440 /************************************************/ 448 /************************************************/
441 data = TESTCOMP; /* 0x72 compressed mode */ 449 data = TESTCOMP; /* 0x72 compressed mode */
442 reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */ 450 reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */
443 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 451 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
444 /* 176x144 */ 452 /* 176x144 */
445 data = QCIFLINE; /* 0x84; // CIF | 4 packet */ 453 data = QCIFLINE; /* 0x84; // CIF | 4 packet */
446 reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */ 454 reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index 4144e11c60bb..afbbbd290560 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
@@ -88,13 +88,29 @@ static struct ctrl sd_ctrls[] = {
88 }, 88 },
89}; 89};
90 90
91static struct cam_mode vc0321_mode[] = { 91static struct v4l2_pix_format vc0321_mode[] = {
92 {V4L2_PIX_FMT_YUYV, 320, 240, 1}, 92 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
93 {V4L2_PIX_FMT_YUYV, 640, 480, 0}, 93 .bytesperline = 320 * 2,
94 .sizeimage = 320 * 240 * 2,
95 .colorspace = V4L2_COLORSPACE_SRGB,
96 .priv = 1},
97 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
98 .bytesperline = 640 * 2,
99 .sizeimage = 640 * 480 * 2,
100 .colorspace = V4L2_COLORSPACE_SRGB,
101 .priv = 0},
94}; 102};
95static struct cam_mode vc0323_mode[] = { 103static struct v4l2_pix_format vc0323_mode[] = {
96 {V4L2_PIX_FMT_JPEG, 320, 240, 1}, 104 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
97 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 105 .bytesperline = 320,
106 .sizeimage = 320 * 240 * 3 / 8 + 590,
107 .colorspace = V4L2_COLORSPACE_JPEG,
108 .priv = 1},
109 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
110 .bytesperline = 640,
111 .sizeimage = 640 * 480 * 3 / 8 + 590,
112 .colorspace = V4L2_COLORSPACE_JPEG,
113 .priv = 0},
98}; 114};
99 115
100static const __u8 mi1310_socinitVGA_JPG[][4] = { 116static const __u8 mi1310_socinitVGA_JPG[][4] = {
@@ -1535,7 +1551,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1535 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef); 1551 reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
1536 } 1552 }
1537 1553
1538 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 1554 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1539 switch (sd->sensor) { 1555 switch (sd->sensor) {
1540 case SENSOR_HV7131R: 1556 case SENSOR_HV7131R:
1541 GammaT = hv7131r_gamma; 1557 GammaT = hv7131r_gamma;
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index 63dd8916d6b6..eed9a8baf4ee 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
28static const char version[] = "2.1.4"; 28static const char version[] = "2.1.5";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
31 "Serge A. Suchkov <Serge.A.S@tochka.ru>"); 31 "Serge A. Suchkov <Serge.A.S@tochka.ru>");
@@ -173,14 +173,30 @@ static struct ctrl sd_ctrls[] = {
173 }, 173 },
174}; 174};
175 175
176static struct cam_mode vga_mode[] = { 176static struct v4l2_pix_format vga_mode[] = {
177 {V4L2_PIX_FMT_JPEG, 320, 240, 1}, 177 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
178 {V4L2_PIX_FMT_JPEG, 640, 480, 0}, 178 .bytesperline = 320,
179 .sizeimage = 320 * 240 * 3 / 8 + 590,
180 .colorspace = V4L2_COLORSPACE_JPEG,
181 .priv = 1},
182 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
183 .bytesperline = 640,
184 .sizeimage = 640 * 480 * 3 / 8 + 590,
185 .colorspace = V4L2_COLORSPACE_JPEG,
186 .priv = 0},
179}; 187};
180 188
181static struct cam_mode sif_mode[] = { 189static struct v4l2_pix_format sif_mode[] = {
182 {V4L2_PIX_FMT_JPEG, 176, 144, 1}, 190 {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
183 {V4L2_PIX_FMT_JPEG, 352, 288, 0}, 191 .bytesperline = 176,
192 .sizeimage = 176 * 144 * 3 / 8 + 590,
193 .colorspace = V4L2_COLORSPACE_JPEG,
194 .priv = 1},
195 {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
196 .bytesperline = 352,
197 .sizeimage = 352 * 288 * 3 / 8 + 590,
198 .colorspace = V4L2_COLORSPACE_JPEG,
199 .priv = 0},
184}; 200};
185 201
186/* usb exchanges */ 202/* usb exchanges */
@@ -6602,7 +6618,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
6602 }; 6618 };
6603 6619
6604 i = sd->lightfreq * 2; 6620 i = sd->lightfreq * 2;
6605 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 6621 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
6606 if (!mode) 6622 if (!mode)
6607 i++; /* 640x480 */ 6623 i++; /* 640x480 */
6608 zc3_freq = freq_tb[(int) sd->sensor][i]; 6624 zc3_freq = freq_tb[(int) sd->sensor][i];
@@ -7170,7 +7186,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
7170 /* 16 */ 7186 /* 16 */
7171 }; 7187 };
7172 7188
7173 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; 7189 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
7174 zc3_init = init_tb[(int) sd->sensor][mode]; 7190 zc3_init = init_tb[(int) sd->sensor][mode];
7175 switch (sd->sensor) { 7191 switch (sd->sensor) {
7176 case SENSOR_HV7131B: 7192 case SENSOR_HV7131B: