From: Jean-Francois Moine Date: Sat, 5 Jul 2008 14:49:20 +0000 (-0300) Subject: V4L/DVB (8201): gspca: v4l2_pix_format in each subdriver. X-Git-Tag: v2.6.27-rc1~966^2~138 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2446b3eba97243acbe2ad0939a28b5edb97eae7;p=linux-2.6 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index 6d50247b7a..b5481017dd 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c @@ -25,8 +25,8 @@ #define CONEX_CAM 1 /* special JPEG header */ #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); @@ -52,7 +52,6 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -61,12 +60,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 0xd4, +#define BRIGHTNESS_DEF 0xd4 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, @@ -75,12 +74,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0x0a, .maximum = 0x1f, .step = 1, - .default_value = 0x0c, +#define CONTRAST_DEF 0x0c + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, @@ -89,18 +88,35 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 7, .step = 1, - .default_value = 3, +#define COLOR_DEF 3 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 176, 144, 3}, - {V4L2_PIX_FMT_JPEG, 320, 240, 2}, - {V4L2_PIX_FMT_JPEG, 352, 288, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 3}, + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; static void reg_r(struct usb_device *dev, @@ -269,7 +285,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev) val = 0x03; reg_w(gspca_dev->dev, 0x0092, &val, 1); - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: reg_w(gspca_dev->dev, 0x0071, reg71a, 4); break; @@ -350,7 +366,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev) static const __u8 reg17[] = { 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 }; - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: cxinit = cx_inits_640; break; @@ -668,7 +684,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) reg_w(gspca_dev->dev, 0x00c0, &val, 1); reg_r(gspca_dev->dev, 0x0001, &val, 1); length = 8; - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: for (i = 0; i < 27; i++) { if (i == 26) @@ -832,9 +848,9 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; sd->qindex = 0; /* set the quantization */ - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; return 0; } diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index bbbe65923c..4db33618af 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("Etoms USB Camera Driver"); @@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_SBGGR8, 320, 240, 1}, -/* {V4L2_PIX_FMT_SBGGR8, 640, 480, 0}, */ +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, +/* {640, 480, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, */ }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, - {V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; #define ETOMS_ALT_SIZE_1000 12 @@ -334,7 +350,7 @@ static void Et_init2(struct gspca_dev *gspca_dev) reg_w_val(dev, ET_CTRL, 0x1b); /* compression et subsampling */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) value = ET_COMP_VAL1; /* 320 */ else value = ET_COMP_VAL0; /* 640 */ @@ -410,7 +426,7 @@ static void Et_init2(struct gspca_dev *gspca_dev) /* reg_r(dev, ET_I2C_BASE, &received, 1); always 0x40 as the pas106 ??? */ /* set the sensor */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) value = 0x04; /* 320 */ else /* 640 */ value = 0x1e; /* 0x17 * setting PixelClock @@ -487,12 +503,12 @@ static void Et_init1(struct gspca_dev *gspca_dev) reg_w_val(dev, ET_ClCK, 0x10); reg_w_val(dev, ET_CTRL, 0x19); /* compression et subsampling */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) value = ET_COMP_VAL1; else value = ET_COMP_VAL0; PDEBUG(D_STREAM, "Open mode %d Compression %d", - gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode, + gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv, value); reg_w_val(dev, ET_COMP, value); reg_w_val(dev, ET_MAXQt, 0x1d); @@ -533,7 +549,7 @@ static void Et_init1(struct gspca_dev *gspca_dev) reg_w_val(dev, ET_I2C_CLK, 0x04); reg_w_val(dev, ET_PXL_CLK, 0x01); /* set the sensor */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { I2c0[0] = 0x06; Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); 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 1225c0fe26..cb0aeb0c0a 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -43,13 +43,11 @@ MODULE_AUTHOR("Jean-Francois Moine "); MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_LICENSE("GPL"); -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; static int video_nr = -1; -static int comp_fac = 30; /* Buffer size ratio when compressed in % */ - #ifdef CONFIG_VIDEO_ADV_DEBUG int gspca_debug = D_ERR | D_PROBE; EXPORT_SYMBOL(gspca_debug); @@ -361,58 +359,6 @@ static void rvfree(void *mem, unsigned long size) vfree(mem); } -static __u32 get_v4l2_depth(__u32 pixfmt) -{ - switch (pixfmt) { -/* case V4L2_PIX_FMT_BGR32: - case V4L2_PIX_FMT_RGB32: - return 32; */ - case V4L2_PIX_FMT_RGB24: /* 'RGB3' */ - case V4L2_PIX_FMT_BGR24: - return 24; -/* case V4L2_PIX_FMT_RGB565: * 'RGBP' */ - case V4L2_PIX_FMT_YUYV: /* 'YUYV' packed 4.2.2 */ - case V4L2_PIX_FMT_YYUV: /* 'YYUV' */ - return 16; - case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */ - case V4L2_PIX_FMT_SPCA501: /* 'S501' YUYV per line */ - return 12; - case V4L2_PIX_FMT_MJPEG: - case V4L2_PIX_FMT_JPEG: - case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */ - case V4L2_PIX_FMT_SN9C10X: /* 'S910' SN9C10x compression */ - case V4L2_PIX_FMT_SPCA561: /* 'S561' compressed GBRG bayer */ - case V4L2_PIX_FMT_PAC207: /* 'P207' compressed BGGR bayer */ - return 8; - } - PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c", - pixfmt & 0xff, - (pixfmt >> 8) & 0xff, - (pixfmt >> 16) & 0xff, - pixfmt >> 24); - return 24; -} - -static int gspca_get_buff_size(struct gspca_dev *gspca_dev, int mode) -{ - unsigned int size; - - if (gspca_dev->sd_desc->get_buff_size) - return gspca_dev->sd_desc->get_buff_size(gspca_dev, mode); - - size = gspca_dev->cam.cam_mode[mode].width * - gspca_dev->cam.cam_mode[mode].height * - get_v4l2_depth(gspca_dev->cam.cam_mode[mode].pixfmt) / 8; - if (!size) - return -ENOMEM; - - /* if compressed (JPEG), reduce the buffer size */ - if (gspca_is_compressed(gspca_dev->cam.cam_mode[mode].pixfmt)) - size = (size * comp_fac) / 100 + 600; /* (+ JPEG header sz) */ - - return size; -} - static int frame_alloc(struct gspca_dev *gspca_dev, unsigned int count) { @@ -420,15 +366,14 @@ static int frame_alloc(struct gspca_dev *gspca_dev, unsigned int frsz; int i; - frsz = gspca_get_buff_size(gspca_dev, gspca_dev->curr_mode); - if (frsz < 0) - return frsz; + i = gspca_dev->curr_mode; + frsz = gspca_dev->cam.cam_mode[i].sizeimage; PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); - if (count > GSPCA_MAX_FRAMES) - count = GSPCA_MAX_FRAMES; frsz = PAGE_ALIGN(frsz); PDEBUG(D_STREAM, "new fr_sz: %d", frsz); gspca_dev->frsz = frsz; + if (count > GSPCA_MAX_FRAMES) + count = GSPCA_MAX_FRAMES; if (gspca_dev->memory == V4L2_MEMORY_MMAP) { gspca_dev->frbuf = rvmalloc(frsz * count); if (!gspca_dev->frbuf) { @@ -711,7 +656,7 @@ static void gspca_set_default_mode(struct gspca_dev *gspca_dev) gspca_dev->curr_mode = i; gspca_dev->width = gspca_dev->cam.cam_mode[i].width; gspca_dev->height = gspca_dev->cam.cam_mode[i].height; - gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt; + gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixelformat; } static int wxh_to_mode(struct gspca_dev *gspca_dev, @@ -739,11 +684,13 @@ static int gspca_get_mode(struct gspca_dev *gspca_dev, modeU = modeD = mode; while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) { if (--modeD >= 0) { - if (gspca_dev->cam.cam_mode[modeD].pixfmt == pixfmt) + if (gspca_dev->cam.cam_mode[modeD].pixelformat + == pixfmt) return modeD; } if (++modeU < gspca_dev->cam.nmodes) { - if (gspca_dev->cam.cam_mode[modeU].pixfmt == pixfmt) + if (gspca_dev->cam.cam_mode[modeU].pixelformat + == pixfmt) return modeU; } } @@ -761,7 +708,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, index = 0; j = 0; for (i = gspca_dev->cam.nmodes; --i >= 0; ) { - fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixfmt; + fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixelformat; j = 0; for (;;) { if (fmt_tb[j] == fmt_tb[index]) @@ -795,20 +742,13 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *fmt) { struct gspca_dev *gspca_dev = priv; + int mode; if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - fmt->fmt.pix.width = gspca_dev->width; - fmt->fmt.pix.height = gspca_dev->height; - fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; - fmt->fmt.pix.field = V4L2_FIELD_NONE; - fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat) - * fmt->fmt.pix.width / 8; - fmt->fmt.pix.sizeimage = gspca_get_buff_size(gspca_dev, - gspca_dev->curr_mode); -/* (should be in the subdriver) */ - fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; - fmt->fmt.pix.priv = 0; + mode = gspca_dev->curr_mode; + memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode], + sizeof fmt->fmt.pix); return 0; } @@ -833,34 +773,19 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev, mode = wxh_to_mode(gspca_dev, w, h); /* OK if right palette */ - if (gspca_dev->cam.cam_mode[mode].pixfmt != fmt->fmt.pix.pixelformat) { + if (gspca_dev->cam.cam_mode[mode].pixelformat + != fmt->fmt.pix.pixelformat) { /* else, search the closest mode with the same pixel format */ mode2 = gspca_get_mode(gspca_dev, mode, fmt->fmt.pix.pixelformat); - if (mode2 >= 0) { + if (mode2 >= 0) mode = mode2; - } else { - - /* no chance, return this mode */ - fmt->fmt.pix.pixelformat = - gspca_dev->cam.cam_mode[mode].pixfmt; -#ifdef CONFIG_VIDEO_ADV_DEBUG - if (gspca_debug & D_CONF) { - PDEBUG_MODE("new format", - fmt->fmt.pix.pixelformat, - gspca_dev->cam.cam_mode[mode].width, - gspca_dev->cam.cam_mode[mode].height); - } -#endif - } +/* else + ; * no chance, return this mode */ } - fmt->fmt.pix.width = gspca_dev->cam.cam_mode[mode].width; - fmt->fmt.pix.height = gspca_dev->cam.cam_mode[mode].height; - fmt->fmt.pix.field = V4L2_FIELD_NONE; - fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat) - * fmt->fmt.pix.width / 8; - fmt->fmt.pix.sizeimage = gspca_get_buff_size(gspca_dev, mode); + memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode], + sizeof fmt->fmt.pix); return mode; /* used when s_fmt */ } @@ -883,16 +808,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct gspca_dev *gspca_dev = priv; int ret; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* if v4l1 got JPEG */ - if (fmt->fmt.pix.pixelformat == 0 - && gspca_dev->streaming) { - fmt->fmt.pix.width = gspca_dev->width; - fmt->fmt.pix.height = gspca_dev->height; - fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; - return 0; - } -#endif if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; @@ -1994,6 +1909,3 @@ MODULE_PARM_DESC(debug, " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout" " 0x0100: v4l2"); #endif -module_param(comp_fac, int, 0644); -MODULE_PARM_DESC(comp_fac, - "Buffer size ratio when compressed in percent"); diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 05e8ee0607..945f1ab4c9 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h @@ -52,15 +52,9 @@ extern int gspca_debug; #define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */ /* device information - set at probe time */ -struct cam_mode { - __u32 pixfmt; - short width; - short height; - short mode; /* subdriver value */ -}; struct cam { char *dev_name; - struct cam_mode *cam_mode; /* size nmodes */ + struct v4l2_pix_format *cam_mode; /* size nmodes */ char nmodes; __u8 epaddr; }; @@ -80,7 +74,6 @@ typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev, struct gspca_frame *frame, __u8 *data, int len); -typedef int (*cam_get_buff_size_op) (struct gspca_dev *gspca_dev, int mode); struct ctrl { struct v4l2_queryctrl qctrl; @@ -102,12 +95,12 @@ struct sd_desc { cam_v_op stopN; /* called on stream off - main alt */ cam_v_op stop0; /* called on stream off - alt 0 */ cam_v_op close; /* called on close */ - cam_v_op dq_callback; /* called when a frame has been dequeued */ cam_pkt_op pkt_scan; +/* optional operations */ + cam_v_op dq_callback; /* called when a frame has been dequeued */ cam_jpg_op get_jcomp; cam_jpg_op set_jcomp; cam_qmnu_op querymenu; - cam_get_buff_size_op get_buff_size; /* optional */ }; /* 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 c70ccc8fe6..23f3dba801 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); @@ -42,9 +42,17 @@ struct sd { static struct ctrl sd_ctrls[] = { }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 2}, - {V4L2_PIX_FMT_JPEG, 640, 480, 1}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 589, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, }; /* MI Register table //elvis */ diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index d92729ac41..70b4cac37a 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Jean-Francois Moine "); MODULE_DESCRIPTION("OV519 USB Camera Driver"); @@ -126,13 +126,29 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240}, - {V4L2_PIX_FMT_JPEG, 640, 480}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 589, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_JPEG, 176, 144}, - {V4L2_PIX_FMT_JPEG, 352, 288}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 589, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 589, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; /* OV519 Camera interface register numbers */ diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index ab83d7b693..b580af92d2 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c @@ -27,8 +27,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Hans de Goede "); MODULE_DESCRIPTION("Pixart PAC207"); @@ -157,9 +157,18 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_PAC207, 176, 144, 1}, - {V4L2_PIX_FMT_PAC207, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = (176 + 2) * 144, + /* uncompressed, add 2 bytes / line for line header */ + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 / 2, /* compressed */ + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; static const __u8 pac207_sensor_init[][8] = { @@ -346,19 +355,6 @@ static void sd_close(struct gspca_dev *gspca_dev) { } -static int sd_get_buff_size_op(struct gspca_dev *gspca_dev, int mode) -{ - switch (gspca_dev->cam.cam_mode[mode].width) { - case 176: /* 176x144 */ - /* uncompressed, add 2 bytes / line for line header */ - return (176 + 2) * 144; - case 352: /* 352x288 */ - /* compressed */ - return 352 * 288 / 2; - } - return -EIO; /* should never happen */ -} - /* auto gain and exposure algorithm based on the knee algorithm described here: * */ static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) @@ -632,7 +628,6 @@ static const struct sd_desc sd_desc = { .close = sd_close, .dq_callback = pac207_do_auto_gain, .pkt_scan = sd_pkt_scan, - .get_buff_size = sd_get_buff_size_op, }; /* -- module initialisation -- */ diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index c2d4b6a4dc..1a2347aa71 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_DESCRIPTION("Pixart PAC7311"); @@ -116,10 +116,22 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 160, 120, 2}, - {V4L2_PIX_FMT_JPEG, 320, 240, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; #define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */ @@ -393,7 +405,7 @@ static void sd_start(struct gspca_dev *gspca_dev) setcolors(gspca_dev); /* set correct resolution */ - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 2: /* 160x120 */ pac7311_reg_write(dev, 0xff, 0x04); pac7311_reg_write(dev, 0x02, 0x03); diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 4baac51bf4..5745687363 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); @@ -95,15 +95,34 @@ static struct ctrl sd_ctrls[] = { }, }; -/* fixme: should have V4L2_PIX_FMT_SN9C10X */ -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_SN9C10X, 160, 120, 2}, - {V4L2_PIX_FMT_SN9C10X, 320, 240, 1}, - {V4L2_PIX_FMT_SN9C10X, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_SN9C10X, 176, 144, 1}, - {V4L2_PIX_FMT_SN9C10X, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; static const __u8 probe_ov7630[] = {0x08, 0x44}; @@ -592,7 +611,7 @@ static void sd_start(struct gspca_dev *gspca_dev) __u8 reg01, reg17; __u8 reg17_19[3]; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; switch (sd->sensor) { case SENSOR_HV7131R: sn9c10x = initHv7131; diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index eb5e1bfd79..3db6487a70 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); @@ -132,10 +132,22 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 160, 120, 2}, - {V4L2_PIX_FMT_JPEG, 320, 240, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; /*Data from sn9c102p+hv71331r */ @@ -1232,7 +1244,7 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_w(dev, 0x99, &data, 1); } - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; reg1 = 0x02; reg17 = 0x61; switch (sd->sensor) { diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 3a42506830..d00f0f76e0 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); @@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_JPEG, 176, 144, 1}, - {V4L2_PIX_FMT_JPEG, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; /* Frame packet header offsets for the spca500 */ @@ -515,7 +531,7 @@ static void spca500_setmode(struct gspca_dev *gspca_dev, reg_w(gspca_dev->dev, 0, 0x8002, ymult); /* use compressed mode, VGA, with mode specific subsample */ - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; reg_w(gspca_dev->dev, 0, 0x8003, mode << 4); } diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 417fbe2214..2064dc008a 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); @@ -101,10 +101,22 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_SPCA501, 160, 120, 2}, - {V4L2_PIX_FMT_SPCA501, 320, 240, 1}, - {V4L2_PIX_FMT_SPCA501, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120 * 3 / 8, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; #define SPCA50X_REG_USB 0x2 /* spca505 501 */ @@ -2029,7 +2041,7 @@ static void sd_start(struct gspca_dev *gspca_dev) int mode; /* memorize the wanted pixel format */ - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; /* Enable ISO packet machine CTRL reg=2, * index=1 bitmask=0x2 (bit ordinal 1) */ diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index 30d174fc4b..5d28d23b83 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); @@ -66,12 +66,32 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_YUYV, 160, 120, 5}, - {V4L2_PIX_FMT_YUYV, 176, 144, 4}, - {V4L2_PIX_FMT_YUYV, 320, 240, 2}, - {V4L2_PIX_FMT_YUYV, 352, 288, 1}, - {V4L2_PIX_FMT_YUYV, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 160 * 2, + .sizeimage = 160 * 120 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 5}, + {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 176 * 2, + .sizeimage = 176 * 144 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 4}, + {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 320 * 2, + .sizeimage = 320 * 240 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 352 * 2, + .sizeimage = 352 * 288 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 640 * 2, + .sizeimage = 640 * 480 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; #define SPCA50X_OFFSET_DATA 10 @@ -708,7 +728,7 @@ static void sd_start(struct gspca_dev *gspca_dev) * only once after loading module */ /* stopping usb registers Tomasz change */ reg_write(dev, 0x02, 0x0, 0x0); - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: reg_write(dev, 0x04, 0x00, 0x00); reg_write(dev, 0x04, 0x06, 0x10); diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c index 614fb3ad77..2d249b00bd 100644 --- a/drivers/media/video/gspca/spca506.c +++ b/drivers/media/video/gspca/spca506.c @@ -25,8 +25,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); @@ -34,11 +34,11 @@ MODULE_LICENSE("GPL"); /* specific webcam descriptor */ struct sd { - struct gspca_dev gspca_dev; /* !! must be the first item */ + struct gspca_dev gspca_dev; /* !! must be the first item */ int buflen; - unsigned char tmpbuf[640 * 480 * 3]; /* YYUV per line */ - unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */ + __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */ + __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */ unsigned char brightness; unsigned char contrast; @@ -117,12 +117,32 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_YUYV, 160, 120, 5}, - {V4L2_PIX_FMT_YUYV, 176, 144, 4}, - {V4L2_PIX_FMT_YUYV, 320, 240, 2}, - {V4L2_PIX_FMT_YUYV, 352, 288, 1}, - {V4L2_PIX_FMT_YUYV, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 160 * 2, + .sizeimage = 160 * 120 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 5}, + {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 176 * 2, + .sizeimage = 176 * 144 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 4}, + {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 320 * 2, + .sizeimage = 320 * 240 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 352 * 2, + .sizeimage = 352 * 288 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 640 * 2, + .sizeimage = 640 * 480 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; #define SPCA50X_OFFSET_DATA 10 @@ -169,7 +189,7 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) { int retry = 60; - unsigned char Data[2]; + __u8 Data[2]; reg_w(gspca_dev->dev, 0x07, reg, 0x0001); reg_w(gspca_dev->dev, 0x07, valeur, 0x0000); @@ -183,8 +203,8 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur, static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg) { int retry = 60; - unsigned char Data[2]; - unsigned char value; + __u8 Data[2]; + __u8 value; reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004); reg_w(gspca_dev->dev, 0x07, reg, 0x0001); @@ -513,7 +533,7 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_w(dev, 0x05, 0x00, 0x0004); reg_w(dev, 0x03, 0x10, 0x0001); reg_w(dev, 0x03, 0x78, 0x0000); - switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: spca506_Setsize(gspca_dev, 0, 0x10, 0x10); break; @@ -593,7 +613,7 @@ static void yyuv_decode(unsigned char *out, static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index 3b54f41d21..169238d40c 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); @@ -69,11 +69,27 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_YUYV, 160, 120, 3}, - {V4L2_PIX_FMT_YUYV, 176, 144, 2}, - {V4L2_PIX_FMT_YUYV, 320, 240, 1}, - {V4L2_PIX_FMT_YUYV, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 160 * 2, + .sizeimage = 160 * 120 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 3}, + {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 176 * 2, + .sizeimage = 176 * 144 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 320 * 2, + .sizeimage = 320 * 240 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 352 * 2, + .sizeimage = 352 * 288 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; /* Frame packet header offsets for the spca508 */ @@ -1574,7 +1590,7 @@ static void sd_start(struct gspca_dev *gspca_dev) { int mode; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; reg_write(gspca_dev->dev, 0x8500, mode); switch (mode) { case 0: diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 8e39cbdda2..f0770ee595 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); @@ -97,11 +97,27 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_SGBRG8, 160, 120, 3}, - {V4L2_PIX_FMT_SGBRG8, 176, 144, 2}, - {V4L2_PIX_FMT_SPCA561, 320, 240, 1}, - {V4L2_PIX_FMT_SPCA561, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 3}, + {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 4 / 8, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 4 / 8, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; /* @@ -655,7 +671,7 @@ static void sd_start(struct gspca_dev *gspca_dev) __u8 Reg8307[] = { 0xaa, 0x00 }; int mode; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; switch (sd->chip_revision) { case Rev072A: switch (mode) { diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index ad59c5ab5d..d676cd16aa 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c @@ -23,8 +23,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Jean-Francois Moine "); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); @@ -112,9 +112,17 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240}, - {V4L2_PIX_FMT_JPEG, 640, 480}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; /* -- read a register -- */ diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index f2d0335085..f66594a113 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); @@ -126,21 +126,53 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 2}, - {V4L2_PIX_FMT_JPEG, 640, 480, 1}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, }; -static struct cam_mode custom_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 2}, - {V4L2_PIX_FMT_JPEG, 464, 480, 1}, +static struct v4l2_pix_format custom_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {464, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 464, + .sizeimage = 464 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, }; -static struct cam_mode vga_mode2[] = { - {V4L2_PIX_FMT_JPEG, 176, 144, 4}, - {V4L2_PIX_FMT_JPEG, 320, 240, 3}, - {V4L2_PIX_FMT_JPEG, 352, 288, 2}, - {V4L2_PIX_FMT_JPEG, 640, 480, 1}, +static struct v4l2_pix_format vga_mode2[] = { + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 4}, + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 3}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, }; #define SPCA50X_OFFSET_DATA 10 @@ -655,7 +687,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) __u8 Type; int rc; - Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; Type = 0; switch (sd->bridge) { case BRIDGE_SPCA533: diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 96f01d2674..299f84584e 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -26,8 +26,8 @@ #define MODULE_NAME "t613" #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; #define MAX_GAMMA 0x10 /* 0 to 15 */ @@ -232,12 +232,32 @@ static char *effects_control[] = { "Negative", }; -static struct cam_mode vga_mode_t16[] = { - {V4L2_PIX_FMT_JPEG, 160, 120, 4}, - {V4L2_PIX_FMT_JPEG, 176, 144, 3}, - {V4L2_PIX_FMT_JPEG, 320, 240, 2}, - {V4L2_PIX_FMT_JPEG, 352, 288, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode_t16[] = { + {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 4}, + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 3}, + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; #define T16_OFFSET_DATA 631 @@ -848,7 +868,7 @@ static void sd_start(struct gspca_dev *gspca_dev) 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; switch (mode) { case 1: /* 352x288 */ t2[1] = 0x40; diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 8561234d65..f9bffd6799 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("TV8532 USB Camera Driver"); @@ -81,9 +81,17 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, - {V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; /* @@ -440,7 +448,7 @@ static void sd_start(struct gspca_dev *gspca_dev) /************************************************/ data = TESTCOMP; /* 0x72 compressed mode */ reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { /* 176x144 */ data = QCIFLINE; /* 0x84; // CIF | 4 packet */ 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 4144e11c60..afbbbd2905 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard "); MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); @@ -88,13 +88,29 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vc0321_mode[] = { - {V4L2_PIX_FMT_YUYV, 320, 240, 1}, - {V4L2_PIX_FMT_YUYV, 640, 480, 0}, +static struct v4l2_pix_format vc0321_mode[] = { + {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 320 * 2, + .sizeimage = 320 * 240 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 640 * 2, + .sizeimage = 640 * 480 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; -static struct cam_mode vc0323_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vc0323_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; static const __u8 mi1310_socinitVGA_JPG[][4] = { @@ -1535,7 +1551,7 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef); } - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; switch (sd->sensor) { case SENSOR_HV7131R: GammaT = hv7131r_gamma; diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 63dd8916d6..eed9a8baf4 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) -static const char version[] = "2.1.4"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard , " "Serge A. Suchkov "); @@ -173,14 +173,30 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct cam_mode vga_mode[] = { - {V4L2_PIX_FMT_JPEG, 320, 240, 1}, - {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +static struct v4l2_pix_format vga_mode[] = { + {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_JPEG, 176, 144, 1}, - {V4L2_PIX_FMT_JPEG, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 176, + .sizeimage = 176 * 144 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, + .bytesperline = 352, + .sizeimage = 352 * 288 * 3 / 8 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 0}, }; /* usb exchanges */ @@ -6602,7 +6618,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev) }; i = sd->lightfreq * 2; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; if (!mode) i++; /* 640x480 */ zc3_freq = freq_tb[(int) sd->sensor][i]; @@ -7170,7 +7186,7 @@ static void sd_start(struct gspca_dev *gspca_dev) /* 16 */ }; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; zc3_init = init_tb[(int) sd->sensor][mode]; switch (sd->sensor) { case SENSOR_HV7131B: