The patch number 8182 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: [EMAIL PROTECTED] ------ From: Mauro Carvalho Chehab <[EMAIL PROTECTED]> merge: http://linuxtv.org/hg/~jfrancois/gspca/ Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]> --- linux/drivers/media/video/gspca/etoms.c | 4 - linux/drivers/media/video/gspca/gspca.c | 77 ++++++++-------------- linux/drivers/media/video/gspca/mars.c | 6 + linux/drivers/media/video/gspca/pac207.c | 24 +++--- linux/drivers/media/video/gspca/pac7311.c | 3 linux/drivers/media/video/gspca/sonixb.c | 2 linux/drivers/media/video/gspca/sonixj.c | 2 linux/drivers/media/video/gspca/spca500.c | 9 +- linux/drivers/media/video/gspca/spca505.c | 2 linux/drivers/media/video/gspca/sunplus.c | 6 - 10 files changed, 62 insertions(+), 73 deletions(-) diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/etoms.c --- a/linux/drivers/media/video/gspca/etoms.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/etoms.c Wed Jul 02 08:59:38 2008 -0300 @@ -233,7 +233,7 @@ static void Et_RegWrite(struct usb_devic 0, index, buffer, len, 500); } -static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 * buffer, +static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer, __u16 length, __u8 mode) { /* buffer should be [D0..D7] */ @@ -256,7 +256,7 @@ static int Et_i2cwrite(struct usb_device return 0; } -static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 * buffer, +static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 *buffer, __u16 length, __u8 mode) { /* buffer should be [D0..D7] */ diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/gspca.c --- a/linux/drivers/media/video/gspca/gspca.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/gspca.c Wed Jul 02 08:59:38 2008 -0300 @@ -28,14 +28,12 @@ #include <linux/mm.h> #include <linux/string.h> #include <linux/pagemap.h> -#include <asm/io.h> +#include <linux/io.h> #include <asm/page.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/jiffies.h> #include "gspca.h" - -#undef CONFIG_VIDEO_V4L1_COMPAT /* global values */ #define DEF_NURBS 2 /* default number of URBs (mmap) */ @@ -45,8 +43,8 @@ MODULE_DESCRIPTION("GSPCA USB Camera Dri MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_LICENSE("GPL"); -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 2) +static const char version[] = "2.1.2"; static int video_nr = -1; @@ -287,10 +285,16 @@ struct gspca_frame *gspca_frame_add(stru frame->v4l2_buf.length); packet_type = DISCARD_PACKET; } else { - if (frame->v4l2_buf.memory != V4L2_MEMORY_USERPTR) + if (frame->v4l2_buf.memory != V4L2_MEMORY_USERPTR) { memcpy(frame->data_end, data, len); - else - copy_to_user(frame->data_end, data, len); + } else { + if (copy_to_user(frame->data_end, + data, len) != 0) { + PDEBUG(D_ERR|D_PACK, + "copy to user failed"); + packet_type = DISCARD_PACKET; + } + } frame->data_end += len; } } @@ -571,9 +575,8 @@ static int create_urbs(struct gspca_dev bsize = psize * npkt; PDEBUG(D_STREAM, "isoc %d pkts size %d (bsize:%d)", npkt, psize, bsize); -/*fixme:change for userptr*/ /*fixme:don't submit all URBs when userptr*/ - if (gspca_dev->memory == V4L2_MEMORY_MMAP) { + if (gspca_dev->memory != V4L2_MEMORY_USERPTR) { usb_complete = isoc_irq_mmap; nurbs = DEF_NURBS; } else { @@ -752,8 +755,6 @@ static int vidioc_enum_fmt_vid_cap(struc int i, j, index; __u32 fmt_tb[8]; - PDEBUG(D_CONF, "enum fmt cap"); - /* give an index to each format */ index = 0; j = 0; @@ -798,14 +799,6 @@ static int vidioc_g_fmt_vid_cap(struct f fmt->fmt.pix.width = gspca_dev->width; fmt->fmt.pix.height = gspca_dev->height; fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; -#ifdef VIDEO_ADV_DEBUG - if (gspca_debug & D_CONF) { - PDEBUG_MODE("get fmt cap", - fmt->fmt.pix.pixelformat, - fmt->fmt.pix.width, - fmt->fmt.pix.height); - } -#endif fmt->fmt.pix.field = V4L2_FIELD_NONE; fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat) * fmt->fmt.pix.width / 8; @@ -898,13 +891,6 @@ static int vidioc_s_fmt_vid_cap(struct f fmt->fmt.pix.height = gspca_dev->height; fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; return 0; - } -#endif -#ifdef VIDEO_ADV_DEBUG - if (gspca_debug & D_CONF) { - PDEBUG_MODE("set fmt cap", - fmt->fmt.pix.pixelformat, - fmt->fmt.pix.width, fmt->fmt.pix.height); } #endif if (mutex_lock_interruptible(&gspca_dev->queue_lock)) @@ -1019,7 +1005,6 @@ static int vidioc_querycap(struct file * { struct gspca_dev *gspca_dev = priv; - PDEBUG(D_CONF, "querycap"); memset(cap, 0, sizeof *cap); strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); @@ -1077,7 +1062,6 @@ static int vidioc_s_ctrl(struct file *fi struct ctrl *ctrls; int i, ret; - PDEBUG(D_CONF, "set ctrl"); for (i = 0, ctrls = gspca_dev->sd_desc->ctrls; i < gspca_dev->sd_desc->nctrls; i++, ctrls++) { @@ -1161,7 +1145,6 @@ static int vidioc_reqbufs(struct file *f struct gspca_dev *gspca_dev = priv; int i, ret = 0; - PDEBUG(D_STREAM, "reqbufs %d", rb->count); if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; switch (rb->memory) { @@ -1211,7 +1194,6 @@ static int vidioc_querybuf(struct file * struct gspca_dev *gspca_dev = priv; struct gspca_frame *frame; - PDEBUG(D_STREAM, "querybuf"); if (v4l2_buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || v4l2_buf->index < 0 || v4l2_buf->index >= gspca_dev->nframes) @@ -1228,7 +1210,6 @@ static int vidioc_streamon(struct file * struct gspca_dev *gspca_dev = priv; int ret; - PDEBUG(D_STREAM, "stream on"); if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (mutex_lock_interruptible(&gspca_dev->queue_lock)) @@ -1270,7 +1251,6 @@ static int vidioc_streamoff(struct file struct gspca_dev *gspca_dev = priv; int ret; - PDEBUG(D_STREAM, "stream off"); if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (!gspca_dev->streaming) @@ -1505,8 +1485,10 @@ static int frame_wait(struct gspca_dev * i = gspca_dev->fr_o; j = gspca_dev->fr_queue[i]; frame = &gspca_dev->frame[j]; - if (frame->v4l2_buf.flags & V4L2_BUF_FLAG_DONE) + if (frame->v4l2_buf.flags & V4L2_BUF_FLAG_DONE) { + atomic_dec(&gspca_dev->nevent); goto ok; + } if (nonblock_ing) /* no frame yet */ return -EAGAIN; @@ -1517,9 +1499,10 @@ static int frame_wait(struct gspca_dev * msecs_to_jiffies(3000)); if (ret <= 0) { if (ret < 0) - return ret; - return -EIO; - } + return ret; /* interrupt */ + return -EIO; /* timeout */ + } + atomic_dec(&gspca_dev->nevent); if (!gspca_dev->streaming || !gspca_dev->present) return -EIO; if (gspca_dev->memory == V4L2_MEMORY_USERPTR) @@ -1531,7 +1514,6 @@ static int frame_wait(struct gspca_dev * break; } ok: - atomic_dec(&gspca_dev->nevent); gspca_dev->fr_o = (i + 1) % gspca_dev->nframes; PDEBUG(D_FRAM, "frame wait q:%d i:%d o:%d", gspca_dev->fr_q, @@ -1731,7 +1713,7 @@ static unsigned int dev_poll(struct file goto out; } - /* if not mmap, treat the awaiting URBs */ + /* if userptr, treat the awaiting URBs */ if (gspca_dev->memory == V4L2_MEMORY_USERPTR && gspca_dev->capt_file == file) isoc_transfer(gspca_dev); @@ -1754,7 +1736,7 @@ static ssize_t dev_read(struct file *fil struct gspca_frame *frame; struct v4l2_buffer v4l2_buf; struct timeval timestamp; - int i, ret, ret2; + int n, ret, ret2; PDEBUG(D_FRAM, "read (%d)", count); if (!gspca_dev->present) @@ -1766,9 +1748,9 @@ static ssize_t dev_read(struct file *fil return ret; break; case GSPCA_MEMORY_READ: - if (gspca_dev->capt_file != file) - return -EINVAL; - break; + if (gspca_dev->capt_file == file) + break; + /* fall thru */ default: return -EINVAL; } @@ -1776,7 +1758,8 @@ static ssize_t dev_read(struct file *fil /* get a frame */ jiffies_to_timeval(get_jiffies_64(), ×tamp); timestamp.tv_sec--; - for (i = 0; i < 2; i++) { + n = 2; + for (;;) { memset(&v4l2_buf, 0, sizeof v4l2_buf); v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; v4l2_buf.memory = V4L2_MEMORY_MMAP; @@ -1787,8 +1770,10 @@ static ssize_t dev_read(struct file *fil } /* if the process slept for more than 1 second, - * get a brand new frame */ + * get anewer frame */ frame = &gspca_dev->frame[v4l2_buf.index]; + if (--n < 0) + break; /* avoid infinite loop */ if (frame->v4l2_buf.timestamp.tv_sec >= timestamp.tv_sec) break; ret = vidioc_qbuf(file, gspca_dev, &v4l2_buf); diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/mars.c --- a/linux/drivers/media/video/gspca/mars.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/mars.c Wed Jul 02 08:59:38 2008 -0300 @@ -220,13 +220,15 @@ static void sd_start(struct gspca_dev *g if (0) { /* fixed dark-gain */ data[1] = 0; /* reg 94, Y Gain (1.75) */ data[2] = 0; /* reg 95, UV Gain (1.75) */ - data[3] = 0x3f; /* reg 96, Y Gain/UV Gain/disable auto dark-gain */ + data[3] = 0x3f; /* reg 96, Y Gain/UV Gain/disable + * auto dark-gain */ data[4] = 0; /* reg 97, set fixed dark level */ data[5] = 0; /* reg 98, don't care */ } else { /* auto dark-gain */ data[1] = 0; /* reg 94, Y Gain (auto) */ data[2] = 0; /* reg 95, UV Gain (1.75) */ - data[3] = 0x78; /* reg 96, Y Gain/UV Gain/disable auto dark-gain */ + data[3] = 0x78; /* reg 96, Y Gain/UV Gain/disable + * auto dark-gain */ switch (gspca_dev->width) { /* case 1280: */ /* data[4] = 154; diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/pac207.c --- a/linux/drivers/media/video/gspca/pac207.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/pac207.c Wed Jul 02 08:59:38 2008 -0300 @@ -452,30 +452,30 @@ static void pac207_do_auto_gain(struct g for (i = 0; i < steps; i++) { if (avg_lum > desired_avg_lum) { - if (sd->gain > PAC207_GAIN_KNEE) { + if (sd->gain > PAC207_GAIN_KNEE) sd->gain--; - } else if (sd->exposure > PAC207_EXPOSURE_KNEE) { + else if (sd->exposure > PAC207_EXPOSURE_KNEE) sd->exposure--; - } else if (sd->gain > PAC207_GAIN_DEFAULT) { + else if (sd->gain > PAC207_GAIN_DEFAULT) sd->gain--; - } else if (sd->exposure > PAC207_EXPOSURE_MIN) { + else if (sd->exposure > PAC207_EXPOSURE_MIN) sd->exposure--; - } else if (sd->gain > PAC207_GAIN_MIN) { + else if (sd->gain > PAC207_GAIN_MIN) sd->gain--; - } else + else break; } else { - if (sd->gain < PAC207_GAIN_DEFAULT) { + if (sd->gain < PAC207_GAIN_DEFAULT) sd->gain++; - } else if (sd->exposure < PAC207_EXPOSURE_KNEE) { + else if (sd->exposure < PAC207_EXPOSURE_KNEE) sd->exposure++; - } else if (sd->gain < PAC207_GAIN_KNEE) { + else if (sd->gain < PAC207_GAIN_KNEE) sd->gain++; - } else if (sd->exposure < PAC207_EXPOSURE_MAX) { + else if (sd->exposure < PAC207_EXPOSURE_MAX) sd->exposure++; - } else if (sd->gain < PAC207_GAIN_MAX) { + else if (sd->gain < PAC207_GAIN_MAX) sd->gain++; - } else + else break; } } diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/pac7311.c --- a/linux/drivers/media/video/gspca/pac7311.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/pac7311.c Wed Jul 02 08:59:38 2008 -0300 @@ -730,7 +730,8 @@ static __devinitdata struct usb_device_i {USB_DEVICE(0x093a, 0x2601), DVNM("Philips SPC610NC")}, {USB_DEVICE(0x093a, 0x2603), DVNM("PAC7312")}, {USB_DEVICE(0x093a, 0x2608), DVNM("Trust WB-3300p")}, - {USB_DEVICE(0x093a, 0x260e), DVNM("Gigaware VGA PC Camera, Trust WB-3350p, SIGMA cam 2350")}, + {USB_DEVICE(0x093a, 0x260e), DVNM("Gigaware VGA PC Camera")}, + /* and also ', Trust WB-3350p, SIGMA cam 2350' */ {USB_DEVICE(0x093a, 0x260f), DVNM("SnakeCam")}, {USB_DEVICE(0x093a, 0x2621), DVNM("PAC731x")}, {} diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/sonixb.c --- a/linux/drivers/media/video/gspca/sonixb.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/sonixb.c Wed Jul 02 08:59:38 2008 -0300 @@ -839,7 +839,7 @@ static __devinitdata struct usb_device_i {USB_DEVICE(0x0c45, 0x6007), DVNM("Sonix sn9c101 + Tas5110D")}, {USB_DEVICE(0x0c45, 0x6009), DVNM("[EMAIL PROTECTED]")}, {USB_DEVICE(0x0c45, 0x600d), DVNM("[EMAIL PROTECTED]")}, - {USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia-OV6650-SN9C101G")}, + {USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia")}, {USB_DEVICE(0x0c45, 0x6019), DVNM("Generic Sonix OV7630")}, {USB_DEVICE(0x0c45, 0x6024), DVNM("Generic Sonix Tas5130c")}, {USB_DEVICE(0x0c45, 0x6025), DVNM("Xcam Shanga")}, diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/sonixj.c --- a/linux/drivers/media/video/gspca/sonixj.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/sonixj.c Wed Jul 02 08:59:38 2008 -0300 @@ -1092,7 +1092,7 @@ static unsigned int setexposure(struct g | ((expo & 0x0003) << 4); i2c_w8(gspca_dev->dev, expoMo10); i2c_w8(gspca_dev->dev, gainMo); - PDEBUG(D_CONF," set exposure %d", + PDEBUG(D_CONF, "set exposure %d", ((expoMo10[3] & 0x07) << 10) | (expoMof[3] << 2) | ((expoMo10[3] & 0x30) >> 4)); diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/spca500.c --- a/linux/drivers/media/video/gspca/spca500.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/spca500.c Wed Jul 02 08:59:38 2008 -0300 @@ -353,7 +353,7 @@ static unsigned char qtable_kodak_ez200[ }; static unsigned char qtable_pocketdv[2][64] = { - { /* Q-table Y-components start registers 0x8800 */ + { /* Q-table Y-components start registers 0x8800 */ 0x06, 0x04, 0x04, 0x06, 0x0a, 0x10, 0x14, 0x18, 0x05, 0x05, 0x06, 0x08, 0x0a, 0x17, 0x18, 0x16, 0x06, 0x05, 0x06, 0x0a, 0x10, 0x17, 0x1c, 0x16, @@ -363,7 +363,7 @@ static unsigned char qtable_pocketdv[2][ 0x14, 0x1a, 0x1f, 0x23, 0x29, 0x30, 0x30, 0x28, 0x1d, 0x25, 0x26, 0x27, 0x2d, 0x28, 0x29, 0x28, }, - { /* Q-table C-components start registers 0x8840 */ + { /* Q-table C-components start registers 0x8840 */ 0x07, 0x07, 0x0a, 0x13, 0x28, 0x28, 0x28, 0x28, 0x07, 0x08, 0x0a, 0x1a, 0x28, 0x28, 0x28, 0x28, 0x0a, 0x0a, 0x16, 0x28, 0x28, 0x28, 0x28, 0x28, @@ -850,7 +850,8 @@ static void sd_start(struct gspca_dev *g * - NWG (Sat 29th March 2003) */ /* do a full reset */ - if ((err = spca500_full_reset(gspca_dev)) < 0) + err = spca500_full_reset(gspca_dev); + if (err < 0) PDEBUG(D_ERR, "spca500_full_reset failed"); /* enable drop packet */ @@ -935,7 +936,7 @@ static void sd_start(struct gspca_dev *g /* Init SDRAM - needed for SDRAM access */ reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); - spca500_setmode(gspca_dev,xmult,ymult); + spca500_setmode(gspca_dev, xmult, ymult); /* switch to video camera mode */ reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/spca505.c --- a/linux/drivers/media/video/gspca/spca505.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/spca505.c Wed Jul 02 08:59:38 2008 -0300 @@ -973,7 +973,7 @@ static int sd_probe(struct usb_interface static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id) { - return gspca_dev_probe(intf, id, &sd_desc, sizeof (struct sd), + return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), THIS_MODULE); } diff -r 2bdb21297302 -r 87aa6048e718 linux/drivers/media/video/gspca/sunplus.c --- a/linux/drivers/media/video/gspca/sunplus.c Wed Jul 02 08:37:48 2008 -0300 +++ b/linux/drivers/media/video/gspca/sunplus.c Wed Jul 02 08:59:38 2008 -0300 @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.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, 1) +static const char version[] = "2.1.1"; MODULE_AUTHOR("Michel Xhaard <[EMAIL PROTECTED]>"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); @@ -490,7 +490,7 @@ static int reg_write(struct usb_device * USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x", - reg, index, value, ret); + req, index, value, ret); if (ret < 0) PDEBUG(D_ERR, "reg write: error %d", ret); return ret; --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/87aa6048e718684748325c8e5290837e8f5593d9 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits