2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00

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>
This commit is contained in:
Jean-Francois Moine 2008-07-05 11:49:20 -03:00 committed by Mauro Carvalho Chehab
parent efab8211db
commit c2446b3eba
22 changed files with 519 additions and 320 deletions

View File

@ -25,8 +25,8 @@
#define CONEX_CAM 1 /* special JPEG header */ #define CONEX_CAM 1 /* special JPEG header */
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); 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 int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = { static struct ctrl sd_ctrls[] = {
#define SD_BRIGHTNESS 0
{ {
{ {
.id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS,
@ -61,12 +60,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0, .minimum = 0,
.maximum = 255, .maximum = 255,
.step = 1, .step = 1,
.default_value = 0xd4, #define BRIGHTNESS_DEF 0xd4
.default_value = BRIGHTNESS_DEF,
}, },
.set = sd_setbrightness, .set = sd_setbrightness,
.get = sd_getbrightness, .get = sd_getbrightness,
}, },
#define SD_CONTRAST 1
{ {
{ {
.id = V4L2_CID_CONTRAST, .id = V4L2_CID_CONTRAST,
@ -75,12 +74,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0x0a, .minimum = 0x0a,
.maximum = 0x1f, .maximum = 0x1f,
.step = 1, .step = 1,
.default_value = 0x0c, #define CONTRAST_DEF 0x0c
.default_value = CONTRAST_DEF,
}, },
.set = sd_setcontrast, .set = sd_setcontrast,
.get = sd_getcontrast, .get = sd_getcontrast,
}, },
#define SD_COLOR 2
{ {
{ {
.id = V4L2_CID_SATURATION, .id = V4L2_CID_SATURATION,
@ -89,18 +88,35 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0, .minimum = 0,
.maximum = 7, .maximum = 7,
.step = 1, .step = 1,
.default_value = 3, #define COLOR_DEF 3
.default_value = COLOR_DEF,
}, },
.set = sd_setcolors, .set = sd_setcolors,
.get = sd_getcolors, .get = sd_getcolors,
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 176, 144, 3}, {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 320, 240, 2}, .bytesperline = 176,
{V4L2_PIX_FMT_JPEG, 352, 288, 1}, .sizeimage = 176 * 144 * 3 / 8 + 590,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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, static void reg_r(struct usb_device *dev,
@ -269,7 +285,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
val = 0x03; val = 0x03;
reg_w(gspca_dev->dev, 0x0092, &val, 1); 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: case 0:
reg_w(gspca_dev->dev, 0x0071, reg71a, 4); reg_w(gspca_dev->dev, 0x0071, reg71a, 4);
break; break;
@ -350,7 +366,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev)
static const __u8 reg17[] = static const __u8 reg17[] =
{ 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 }; { 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: case 0:
cxinit = cx_inits_640; cxinit = cx_inits_640;
break; break;
@ -668,7 +684,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x00c0, &val, 1); reg_w(gspca_dev->dev, 0x00c0, &val, 1);
reg_r(gspca_dev->dev, 0x0001, &val, 1); reg_r(gspca_dev->dev, 0x0001, &val, 1);
length = 8; 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: case 0:
for (i = 0; i < 27; i++) { for (i = 0; i < 27; i++) {
if (i == 26) 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]; cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
sd->qindex = 0; /* set the quantization */ sd->qindex = 0; /* set the quantization */
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; sd->brightness = BRIGHTNESS_DEF;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; sd->contrast = CONTRAST_DEF;
sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; sd->colors = COLOR_DEF;
return 0; return 0;
} }

View File

@ -22,8 +22,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("Etoms USB Camera Driver"); MODULE_DESCRIPTION("Etoms USB Camera Driver");
@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_SBGGR8, 320, 240, 1}, {320, 240, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
/* {V4L2_PIX_FMT_SBGGR8, 640, 480, 0}, */ .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[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, .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 #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); reg_w_val(dev, ET_CTRL, 0x1b);
/* compression et subsampling */ /* 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 */ value = ET_COMP_VAL1; /* 320 */
else else
value = ET_COMP_VAL0; /* 640 */ 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); /* reg_r(dev, ET_I2C_BASE, &received, 1);
always 0x40 as the pas106 ??? */ always 0x40 as the pas106 ??? */
/* set the sensor */ /* 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 */ value = 0x04; /* 320 */
else /* 640 */ else /* 640 */
value = 0x1e; /* 0x17 * setting PixelClock 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_ClCK, 0x10);
reg_w_val(dev, ET_CTRL, 0x19); reg_w_val(dev, ET_CTRL, 0x19);
/* compression et subsampling */ /* 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; value = ET_COMP_VAL1;
else else
value = ET_COMP_VAL0; value = ET_COMP_VAL0;
PDEBUG(D_STREAM, "Open mode %d Compression %d", 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); value);
reg_w_val(dev, ET_COMP, value); reg_w_val(dev, ET_COMP, value);
reg_w_val(dev, ET_MAXQt, 0x1d); 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_I2C_CLK, 0x04);
reg_w_val(dev, ET_PXL_CLK, 0x01); reg_w_val(dev, ET_PXL_CLK, 0x01);
/* set the sensor */ /* 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; I2c0[0] = 0x06;
Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1);
Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1);

View File

@ -43,13 +43,11 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_DESCRIPTION("GSPCA USB Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
static int video_nr = -1; static int video_nr = -1;
static int comp_fac = 30; /* Buffer size ratio when compressed in % */
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
int gspca_debug = D_ERR | D_PROBE; int gspca_debug = D_ERR | D_PROBE;
EXPORT_SYMBOL(gspca_debug); EXPORT_SYMBOL(gspca_debug);
@ -361,58 +359,6 @@ static void rvfree(void *mem, unsigned long size)
vfree(mem); 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, static int frame_alloc(struct gspca_dev *gspca_dev,
unsigned int count) unsigned int count)
{ {
@ -420,15 +366,14 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
unsigned int frsz; unsigned int frsz;
int i; int i;
frsz = gspca_get_buff_size(gspca_dev, gspca_dev->curr_mode); i = gspca_dev->curr_mode;
if (frsz < 0) frsz = gspca_dev->cam.cam_mode[i].sizeimage;
return frsz;
PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
if (count > GSPCA_MAX_FRAMES)
count = GSPCA_MAX_FRAMES;
frsz = PAGE_ALIGN(frsz); frsz = PAGE_ALIGN(frsz);
PDEBUG(D_STREAM, "new fr_sz: %d", frsz); PDEBUG(D_STREAM, "new fr_sz: %d", frsz);
gspca_dev->frsz = frsz; gspca_dev->frsz = frsz;
if (count > GSPCA_MAX_FRAMES)
count = GSPCA_MAX_FRAMES;
if (gspca_dev->memory == V4L2_MEMORY_MMAP) { if (gspca_dev->memory == V4L2_MEMORY_MMAP) {
gspca_dev->frbuf = rvmalloc(frsz * count); gspca_dev->frbuf = rvmalloc(frsz * count);
if (!gspca_dev->frbuf) { 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->curr_mode = i;
gspca_dev->width = gspca_dev->cam.cam_mode[i].width; gspca_dev->width = gspca_dev->cam.cam_mode[i].width;
gspca_dev->height = gspca_dev->cam.cam_mode[i].height; 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, 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; modeU = modeD = mode;
while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) { while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) {
if (--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; return modeD;
} }
if (++modeU < gspca_dev->cam.nmodes) { 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; return modeU;
} }
} }
@ -761,7 +708,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
index = 0; index = 0;
j = 0; j = 0;
for (i = gspca_dev->cam.nmodes; --i >= 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; j = 0;
for (;;) { for (;;) {
if (fmt_tb[j] == fmt_tb[index]) 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 v4l2_format *fmt)
{ {
struct gspca_dev *gspca_dev = priv; struct gspca_dev *gspca_dev = priv;
int mode;
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
fmt->fmt.pix.width = gspca_dev->width; mode = gspca_dev->curr_mode;
fmt->fmt.pix.height = gspca_dev->height; memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; sizeof fmt->fmt.pix);
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;
return 0; 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); mode = wxh_to_mode(gspca_dev, w, h);
/* OK if right palette */ /* 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 */ /* else, search the closest mode with the same pixel format */
mode2 = gspca_get_mode(gspca_dev, mode, mode2 = gspca_get_mode(gspca_dev, mode,
fmt->fmt.pix.pixelformat); fmt->fmt.pix.pixelformat);
if (mode2 >= 0) { if (mode2 >= 0)
mode = mode2; mode = mode2;
} else { /* else
; * no chance, return this mode */
/* 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
}
} }
fmt->fmt.pix.width = gspca_dev->cam.cam_mode[mode].width; memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
fmt->fmt.pix.height = gspca_dev->cam.cam_mode[mode].height; sizeof fmt->fmt.pix);
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);
return mode; /* used when s_fmt */ 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; struct gspca_dev *gspca_dev = priv;
int ret; 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)) if (mutex_lock_interruptible(&gspca_dev->queue_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
@ -1994,6 +1909,3 @@ MODULE_PARM_DESC(debug,
" 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout" " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"
" 0x0100: v4l2"); " 0x0100: v4l2");
#endif #endif
module_param(comp_fac, int, 0644);
MODULE_PARM_DESC(comp_fac,
"Buffer size ratio when compressed in percent");

View File

@ -52,15 +52,9 @@ extern int gspca_debug;
#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */ #define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */
/* device information - set at probe time */ /* device information - set at probe time */
struct cam_mode {
__u32 pixfmt;
short width;
short height;
short mode; /* subdriver value */
};
struct cam { struct cam {
char *dev_name; char *dev_name;
struct cam_mode *cam_mode; /* size nmodes */ struct v4l2_pix_format *cam_mode; /* size nmodes */
char nmodes; char nmodes;
__u8 epaddr; __u8 epaddr;
}; };
@ -80,7 +74,6 @@ typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev,
struct gspca_frame *frame, struct gspca_frame *frame,
__u8 *data, __u8 *data,
int len); int len);
typedef int (*cam_get_buff_size_op) (struct gspca_dev *gspca_dev, int mode);
struct ctrl { struct ctrl {
struct v4l2_queryctrl qctrl; struct v4l2_queryctrl qctrl;
@ -102,12 +95,12 @@ struct sd_desc {
cam_v_op stopN; /* called on stream off - main alt */ cam_v_op stopN; /* called on stream off - main alt */
cam_v_op stop0; /* called on stream off - alt 0 */ cam_v_op stop0; /* called on stream off - alt 0 */
cam_v_op close; /* called on close */ cam_v_op close; /* called on close */
cam_v_op dq_callback; /* called when a frame has been dequeued */
cam_pkt_op pkt_scan; 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 get_jcomp;
cam_jpg_op set_jcomp; cam_jpg_op set_jcomp;
cam_qmnu_op querymenu; cam_qmnu_op querymenu;
cam_get_buff_size_op get_buff_size; /* optional */
}; };
/* packet types when moving from iso buf to frame buf */ /* packet types when moving from iso buf to frame buf */

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
@ -42,9 +42,17 @@ struct sd {
static struct ctrl sd_ctrls[] = { static struct ctrl sd_ctrls[] = {
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 2}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480, 1}, .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 */ /* MI Register table //elvis */

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("OV519 USB Camera Driver"); MODULE_DESCRIPTION("OV519 USB Camera Driver");
@ -126,13 +126,29 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480}, .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[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_JPEG, 176, 144}, {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 352, 288}, .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 */ /* OV519 Camera interface register numbers */

View File

@ -27,8 +27,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
MODULE_DESCRIPTION("Pixart PAC207"); MODULE_DESCRIPTION("Pixart PAC207");
@ -157,9 +157,18 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode sif_mode[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_PAC207, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_PAC207, 352, 288, 0}, .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] = { 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: /* auto gain and exposure algorithm based on the knee algorithm described here:
* <http://ytse.tricolour.net/docs/LowLightOptimization.html> */ * <http://ytse.tricolour.net/docs/LowLightOptimization.html> */
static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) 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, .close = sd_close,
.dq_callback = pac207_do_auto_gain, .dq_callback = pac207_do_auto_gain,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_buff_size = sd_get_buff_size_op,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */

View File

@ -23,8 +23,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
MODULE_DESCRIPTION("Pixart PAC7311"); MODULE_DESCRIPTION("Pixart PAC7311");
@ -116,10 +116,22 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 160, 120, 2}, {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 320, 240, 1}, .bytesperline = 160,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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) */ #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); setcolors(gspca_dev);
/* set correct resolution */ /* 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 */ case 2: /* 160x120 */
pac7311_reg_write(dev, 0xff, 0x04); pac7311_reg_write(dev, 0xff, 0x04);
pac7311_reg_write(dev, 0x02, 0x03); pac7311_reg_write(dev, 0x02, 0x03);

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.3"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); 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 v4l2_pix_format vga_mode[] = {
static struct cam_mode vga_mode[] = { {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SN9C10X, 160, 120, 2}, .bytesperline = 160,
{V4L2_PIX_FMT_SN9C10X, 320, 240, 1}, .sizeimage = 160 * 120,
{V4L2_PIX_FMT_SN9C10X, 640, 480, 0}, .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[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_SN9C10X, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SN9C10X, 352, 288, 0}, .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}; static const __u8 probe_ov7630[] = {0x08, 0x44};
@ -592,7 +611,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u8 reg01, reg17; __u8 reg01, reg17;
__u8 reg17_19[3]; __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) { switch (sd->sensor) {
case SENSOR_HV7131R: case SENSOR_HV7131R:
sn9c10x = initHv7131; sn9c10x = initHv7131;

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
@ -132,10 +132,22 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 160, 120, 2}, {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 320, 240, 1}, .bytesperline = 160,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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 */ /*Data from sn9c102p+hv71331r */
@ -1232,7 +1244,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, 0x99, &data, 1); 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; reg1 = 0x02;
reg17 = 0x61; reg17 = 0x61;
switch (sd->sensor) { switch (sd->sensor) {

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
@ -114,14 +114,30 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 1}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_JPEG, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 352, 288, 0}, .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 */ /* 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); reg_w(gspca_dev->dev, 0, 0x8002, ymult);
/* use compressed mode, VGA, with mode specific subsample */ /* 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); reg_w(gspca_dev->dev, 0, 0x8003, mode << 4);
} }

View File

@ -23,8 +23,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
@ -101,10 +101,22 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_SPCA501, 160, 120, 2}, {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SPCA501, 320, 240, 1}, .bytesperline = 160,
{V4L2_PIX_FMT_SPCA501, 640, 480, 0}, .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 */ #define SPCA50X_REG_USB 0x2 /* spca505 501 */
@ -2029,7 +2041,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
int mode; int mode;
/* memorize the wanted pixel format */ /* 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, /* Enable ISO packet machine CTRL reg=2,
* index=1 bitmask=0x2 (bit ordinal 1) */ * index=1 bitmask=0x2 (bit ordinal 1) */

View File

@ -23,8 +23,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
@ -66,12 +66,32 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_YUYV, 160, 120, 5}, {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_YUYV, 176, 144, 4}, .bytesperline = 160 * 2,
{V4L2_PIX_FMT_YUYV, 320, 240, 2}, .sizeimage = 160 * 120 * 2,
{V4L2_PIX_FMT_YUYV, 352, 288, 1}, .colorspace = V4L2_COLORSPACE_SRGB,
{V4L2_PIX_FMT_YUYV, 640, 480, 0}, .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 #define SPCA50X_OFFSET_DATA 10
@ -708,7 +728,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
* only once after loading module */ * only once after loading module */
/* stopping usb registers Tomasz change */ /* stopping usb registers Tomasz change */
reg_write(dev, 0x02, 0x0, 0x0); 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: case 0:
reg_write(dev, 0x04, 0x00, 0x00); reg_write(dev, 0x04, 0x00, 0x00);
reg_write(dev, 0x04, 0x06, 0x10); reg_write(dev, 0x04, 0x06, 0x10);

View File

@ -25,8 +25,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.0"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
@ -34,11 +34,11 @@ MODULE_LICENSE("GPL");
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
int buflen; int buflen;
unsigned char tmpbuf[640 * 480 * 3]; /* YYUV per line */ __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */ __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
unsigned char brightness; unsigned char brightness;
unsigned char contrast; unsigned char contrast;
@ -117,12 +117,32 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_YUYV, 160, 120, 5}, {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_YUYV, 176, 144, 4}, .bytesperline = 160 * 2,
{V4L2_PIX_FMT_YUYV, 320, 240, 2}, .sizeimage = 160 * 120 * 2,
{V4L2_PIX_FMT_YUYV, 352, 288, 1}, .colorspace = V4L2_COLORSPACE_SRGB,
{V4L2_PIX_FMT_YUYV, 640, 480, 0}, .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 #define SPCA50X_OFFSET_DATA 10
@ -169,7 +189,7 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
__u16 reg) __u16 reg)
{ {
int retry = 60; int retry = 60;
unsigned char Data[2]; __u8 Data[2];
reg_w(gspca_dev->dev, 0x07, reg, 0x0001); reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
reg_w(gspca_dev->dev, 0x07, valeur, 0x0000); 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) static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg)
{ {
int retry = 60; int retry = 60;
unsigned char Data[2]; __u8 Data[2];
unsigned char value; __u8 value;
reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004); reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004);
reg_w(gspca_dev->dev, 0x07, reg, 0x0001); 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, 0x05, 0x00, 0x0004);
reg_w(dev, 0x03, 0x10, 0x0001); reg_w(dev, 0x03, 0x10, 0x0001);
reg_w(dev, 0x03, 0x78, 0x0000); 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: case 0:
spca506_Setsize(gspca_dev, 0, 0x10, 0x10); spca506_Setsize(gspca_dev, 0, 0x10, 0x10);
break; break;
@ -593,7 +613,7 @@ static void yyuv_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev, static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */ struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */ __u8 *data, /* isoc packet */
int len) /* iso packet length */ int len) /* iso packet length */
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;

View File

@ -22,8 +22,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
@ -69,11 +69,27 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode sif_mode[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_YUYV, 160, 120, 3}, {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_YUYV, 176, 144, 2}, .bytesperline = 160 * 2,
{V4L2_PIX_FMT_YUYV, 320, 240, 1}, .sizeimage = 160 * 120 * 2,
{V4L2_PIX_FMT_YUYV, 352, 288, 0}, .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 */ /* Frame packet header offsets for the spca508 */
@ -1574,7 +1590,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
{ {
int mode; 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); reg_write(gspca_dev->dev, 0x8500, mode);
switch (mode) { switch (mode) {
case 0: case 0:

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
@ -97,11 +97,27 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode sif_mode[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_SGBRG8, 160, 120, 3}, {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SGBRG8, 176, 144, 2}, .bytesperline = 160,
{V4L2_PIX_FMT_SPCA561, 320, 240, 1}, .sizeimage = 160 * 120,
{V4L2_PIX_FMT_SPCA561, 352, 288, 0}, .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 }; __u8 Reg8307[] = { 0xaa, 0x00 };
int mode; 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) { switch (sd->chip_revision) {
case Rev072A: case Rev072A:
switch (mode) { switch (mode) {

View File

@ -23,8 +23,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
@ -112,9 +112,17 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480}, .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 -- */ /* -- read a register -- */

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
@ -126,21 +126,53 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 2}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480, 1}, .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[] = { static struct v4l2_pix_format custom_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 2}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 464, 480, 1}, .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[] = { static struct v4l2_pix_format vga_mode2[] = {
{V4L2_PIX_FMT_JPEG, 176, 144, 4}, {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 320, 240, 3}, .bytesperline = 176,
{V4L2_PIX_FMT_JPEG, 352, 288, 2}, .sizeimage = 176 * 144 * 3 / 8 + 590,
{V4L2_PIX_FMT_JPEG, 640, 480, 1}, .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 #define SPCA50X_OFFSET_DATA 10
@ -655,7 +687,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
__u8 Type; __u8 Type;
int rc; 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; Type = 0;
switch (sd->bridge) { switch (sd->bridge) {
case BRIDGE_SPCA533: case BRIDGE_SPCA533:

View File

@ -26,8 +26,8 @@
#define MODULE_NAME "t613" #define MODULE_NAME "t613"
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
#define MAX_GAMMA 0x10 /* 0 to 15 */ #define MAX_GAMMA 0x10 /* 0 to 15 */
@ -232,12 +232,32 @@ static char *effects_control[] = {
"Negative", "Negative",
}; };
static struct cam_mode vga_mode_t16[] = { static struct v4l2_pix_format vga_mode_t16[] = {
{V4L2_PIX_FMT_JPEG, 160, 120, 4}, {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 176, 144, 3}, .bytesperline = 160,
{V4L2_PIX_FMT_JPEG, 320, 240, 2}, .sizeimage = 160 * 120 * 3 / 8 + 590,
{V4L2_PIX_FMT_JPEG, 352, 288, 1}, .colorspace = V4L2_COLORSPACE_JPEG,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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 #define T16_OFFSET_DATA 631
@ -848,7 +868,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; 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) { switch (mode) {
case 1: /* 352x288 */ case 1: /* 352x288 */
t2[1] = 0x40; t2[1] = 0x40;

View File

@ -22,8 +22,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("TV8532 USB Camera Driver"); MODULE_DESCRIPTION("TV8532 USB Camera Driver");
@ -81,9 +81,17 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode sif_mode[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_SBGGR8, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_SBGGR8, 352, 288, 0}, .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 */ data = TESTCOMP; /* 0x72 compressed mode */
reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */ 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 */ /* 176x144 */
data = QCIFLINE; /* 0x84; // CIF | 4 packet */ data = QCIFLINE; /* 0x84; // CIF | 4 packet */
reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */ reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
@ -88,13 +88,29 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vc0321_mode[] = { static struct v4l2_pix_format vc0321_mode[] = {
{V4L2_PIX_FMT_YUYV, 320, 240, 1}, {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_YUYV, 640, 480, 0}, .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[] = { static struct v4l2_pix_format vc0323_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 1}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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] = { 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); 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) { switch (sd->sensor) {
case SENSOR_HV7131R: case SENSOR_HV7131R:
GammaT = hv7131r_gamma; GammaT = hv7131r_gamma;

View File

@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
static const char version[] = "2.1.4"; static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
"Serge A. Suchkov <Serge.A.S@tochka.ru>"); "Serge A. Suchkov <Serge.A.S@tochka.ru>");
@ -173,14 +173,30 @@ static struct ctrl sd_ctrls[] = {
}, },
}; };
static struct cam_mode vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{V4L2_PIX_FMT_JPEG, 320, 240, 1}, {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 640, 480, 0}, .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[] = { static struct v4l2_pix_format sif_mode[] = {
{V4L2_PIX_FMT_JPEG, 176, 144, 1}, {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
{V4L2_PIX_FMT_JPEG, 352, 288, 0}, .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 */ /* usb exchanges */
@ -6602,7 +6618,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
}; };
i = sd->lightfreq * 2; 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) if (!mode)
i++; /* 640x480 */ i++; /* 640x480 */
zc3_freq = freq_tb[(int) sd->sensor][i]; zc3_freq = freq_tb[(int) sd->sensor][i];
@ -7170,7 +7186,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* 16 */ /* 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]; zc3_init = init_tb[(int) sd->sensor][mode];
switch (sd->sensor) { switch (sd->sensor) {
case SENSOR_HV7131B: case SENSOR_HV7131B: