Commit bf7f0b98 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (8193): gspca: Input buffer may be changed on reg write.

Done for conex, etoms, pac7311, sonixj, t613 and tv8532.
Code cleanup for some other subdrivers.
Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 0d2a722d
...@@ -25,8 +25,8 @@ ...@@ -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, 0) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
static const char version[] = "2.1.0"; static const char version[] = "2.1.3";
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");
...@@ -114,21 +114,29 @@ static void reg_r(struct usb_device *dev, ...@@ -114,21 +114,29 @@ static void reg_r(struct usb_device *dev,
0, 0,
index, buffer, length, index, buffer, length,
500); 500);
PDEBUG(D_USBI, "reg read i:%02x -> %02x", index, *buffer); PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", index, *buffer);
} }
static void reg_w(struct usb_device *dev, static void reg_w(struct usb_device *dev,
__u16 index, __u16 index,
const __u8 *buffer, __u16 length) const __u8 *buffer, __u16 len)
{ {
PDEBUG(D_USBO, "reg write i:%02x = %02x", index, *buffer); __u8 tmpbuf[8];
#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof tmpbuf) {
PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
return;
}
PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
#endif
memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
0, 0,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, 0,
index, (__u8 *) buffer, length, index, tmpbuf, len, 500);
500);
} }
static const __u8 cx_sensor_init[][4] = { static const __u8 cx_sensor_init[][4] = {
...@@ -269,7 +277,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev) ...@@ -269,7 +277,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x0071, reg71b, 4); reg_w(gspca_dev->dev, 0x0071, reg71b, 4);
break; break;
default: default:
/* case 2: */ /* case 2: */
reg_w(gspca_dev->dev, 0x0071, reg71c, 4); reg_w(gspca_dev->dev, 0x0071, reg71c, 4);
break; break;
case 3: case 3:
...@@ -662,8 +670,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) ...@@ -662,8 +670,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) { for (i = 0; i < 27; i++) {
if (i == 26) if (i == 26)
length = 2; length = 2;
reg_w(gspca_dev->dev, 0x0008, reg_w(gspca_dev->dev, 0x0008, cxjpeg_640[i], length);
cxjpeg_640[i], length);
} }
Reg55 = 0x28; Reg55 = 0x28;
break; break;
...@@ -671,8 +678,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) ...@@ -671,8 +678,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) { for (i = 0; i < 27; i++) {
if (i == 26) if (i == 26)
length = 2; length = 2;
reg_w(gspca_dev->dev, 0x0008, reg_w(gspca_dev->dev, 0x0008, cxjpeg_352[i], length);
cxjpeg_352[i], length);
} }
Reg55 = 0x16; Reg55 = 0x16;
break; break;
...@@ -681,8 +687,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) ...@@ -681,8 +687,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) { for (i = 0; i < 27; i++) {
if (i == 26) if (i == 26)
length = 2; length = 2;
reg_w(gspca_dev->dev, 0x0008, reg_w(gspca_dev->dev, 0x0008, cxjpeg_320[i], length);
cxjpeg_320[i], length);
} }
Reg55 = 0x14; Reg55 = 0x14;
break; break;
...@@ -690,8 +695,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) ...@@ -690,8 +695,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) { for (i = 0; i < 27; i++) {
if (i == 26) if (i == 26)
length = 2; length = 2;
reg_w(gspca_dev->dev, 0x0008, reg_w(gspca_dev->dev, 0x0008, cxjpeg_176[i], length);
cxjpeg_176[i], length);
} }
Reg55 = 0x0B; Reg55 = 0x0B;
break; break;
...@@ -731,8 +735,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) ...@@ -731,8 +735,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 18; i++) { for (i = 0; i < 18; i++) {
if (i == 17) if (i == 17)
length = 2; length = 2;
reg_w(gspca_dev->dev, 0x0008, reg_w(gspca_dev->dev, 0x0008, cxjpeg_qtable[i], length);
cxjpeg_qtable[i], length);
} }
reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */ reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */
...@@ -866,7 +869,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) ...@@ -866,7 +869,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w(gspca_dev->dev, 0x0053, &val, 1); reg_w(gspca_dev->dev, 0x0053, &val, 1);
while (retry--) { while (retry--) {
/* reg_r (gspca_dev->dev,0x00,0x00,0x0002,&val,1);*/ /* reg_r(gspca_dev->dev, 0x0002, &val, 1);*/
reg_r(gspca_dev->dev, 0x0053, &val, 1); reg_r(gspca_dev->dev, 0x0053, &val, 1);
if (val == 0) if (val == 0)
break; break;
......
This diff is collapsed.
...@@ -79,49 +79,35 @@ enum { ...@@ -79,49 +79,35 @@ enum {
}; };
static int pcam_reg_write(struct usb_device *dev, static int pcam_reg_write(struct usb_device *dev,
__u16 index, unsigned char *value, int length) __u16 index, __u8 *value, int len)
{ {
int rc; int rc;
rc = usb_control_msg(dev, rc = usb_control_msg(dev,
usb_sndbulkpipe(dev, 4), usb_sndbulkpipe(dev, 4),
0x12, 0x12,
/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */ /* ?? 0xc8 = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_??? !? */
0xc8, 0xc8,
0, /* value */ 0, /* value */
index, value, length, 500); index, value, len, 500);
PDEBUG(D_USBO, "reg write: 0x%02X , result = 0x%x", index, rc);
if (rc < 0) if (rc < 0)
PDEBUG(D_ERR, "reg write: error %d", rc); PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc);
return rc; return rc;
} }
static void MISensor_BulkWrite(struct usb_device *dev, unsigned short *pch, static void MISensor_BulkWrite(struct usb_device *dev,
char Address) unsigned short *pch,
char Address)
{ {
int result; __u8 data[6];
unsigned char data[6];
data[0] = 0x1f; data[0] = 0x1f;
data[1] = 0; data[1] = 0; /* control byte */
data[2] = Address; data[2] = Address;
data[3] = *pch >> 8; /* high byte */ data[3] = *pch >> 8; /* high byte */
data[4] = *pch; /* low byte */ data[4] = *pch; /* low byte */
data[5] = 0;
result = usb_control_msg(dev,
usb_sndbulkpipe(dev, 4),
0x12,
/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */
0xc8,
0, /* value */
Address, /* index */
data, 5, 500);
PDEBUG(D_USBO, "bulk write 0x%02x = 0x%04x", Address, *pch);
if (result < 0) pcam_reg_write(dev, Address, data, 5);
PDEBUG(D_ERR, "reg write: error %d", result);
} }
/* this function is called at probe time */ /* this function is called at probe time */
...@@ -167,7 +153,7 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -167,7 +153,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x01; /* address */ data[0] = 0x01; /* address */
data[1] = 0x01; data[1] = 0x01;
err_code = pcam_reg_write(dev, data[0], data, 0x02); err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0) if (err_code < 0)
return; return;
...@@ -193,14 +179,14 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -193,14 +179,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[10] = 0x5d; /* reg 9, I2C device address data[10] = 0x5d; /* reg 9, I2C device address
* [for PAS5101 (0x40)] [for MI (0x5d)] */ * [for PAS5101 (0x40)] [for MI (0x5d)] */
err_code = pcam_reg_write(dev, data[0], data, 0x0b); err_code = pcam_reg_write(dev, data[0], data, 11);
if (err_code < 0) if (err_code < 0)
return; return;
data[0] = 0x23; /* address */ data[0] = 0x23; /* address */
data[1] = 0x09; /* reg 35, append frame header */ data[1] = 0x09; /* reg 35, append frame header */
err_code = pcam_reg_write(dev, data[0], data, 0x02); err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0) { if (err_code < 0) {
PDEBUG(D_ERR, "Register write failed"); PDEBUG(D_ERR, "Register write failed");
return; return;
...@@ -213,7 +199,7 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -213,7 +199,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* else */ /* else */
data[1] = 50; /* 50 reg 60, pc-cam frame size data[1] = 50; /* 50 reg 60, pc-cam frame size
* (unit: 4KB) 200KB */ * (unit: 4KB) 200KB */
err_code = pcam_reg_write(dev, data[0], data, 0x02); err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0) if (err_code < 0)
return; return;
...@@ -255,13 +241,13 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -255,13 +241,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* auto dark-gain */ /* auto dark-gain */
data[0] = 0x5e; /* address */ data[0] = 0x5e; /* address */
err_code = pcam_reg_write(dev, data[0], data, 0x06); err_code = pcam_reg_write(dev, data[0], data, 6);
if (err_code < 0) if (err_code < 0)
return; return;
data[0] = 0x67; data[0] = 0x67;
data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */ data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */
err_code = pcam_reg_write(dev, data[0], data, 0x02); err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0) if (err_code < 0)
return; return;
...@@ -340,7 +326,7 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -340,7 +326,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x00; data[0] = 0x00;
data[1] = 0x4d; /* ISOC transfering enable... */ data[1] = 0x4d; /* ISOC transfering enable... */
pcam_reg_write(dev, data[0], data, 0x02); pcam_reg_write(dev, data[0], data, 2);
} }
static void sd_stopN(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev)
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "gspca.h" #include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
static const char version[] = "2.1.0"; static const char version[] = "2.1.3";
MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
MODULE_DESCRIPTION("Pixart PAC7311"); MODULE_DESCRIPTION("Pixart PAC7311");
...@@ -195,16 +195,18 @@ const unsigned char pac7311_jpeg_header[] = { ...@@ -195,16 +195,18 @@ const unsigned char pac7311_jpeg_header[] = {
}; };
static void reg_w(struct usb_device *dev, static void reg_w(struct usb_device *dev,
__u16 req,
__u16 value,
__u16 index, __u16 index,
__u8 *buffer, __u16 length) char *buffer, __u16 len)
{ {
__u8 tmpbuf[8];
memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
req, 1, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, buffer, length, 0, /* value */
index, tmpbuf, len,
500); 500);
} }
...@@ -227,7 +229,12 @@ static void pac7311_reg_write(struct usb_device *dev, ...@@ -227,7 +229,12 @@ static void pac7311_reg_write(struct usb_device *dev,
__u8 buf; __u8 buf;
buf = value; buf = value;
reg_w(dev, 0x00, value, index, &buf, 1); usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
0, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, &buf, 1,
500);
} }
/* this function is called at probe time */ /* this function is called at probe time */
...@@ -313,26 +320,26 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -313,26 +320,26 @@ static void sd_start(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
pac7311_reg_write(dev, 0xff, 0x01); pac7311_reg_write(dev, 0xff, 0x01);
reg_w(dev, 0x01, 0, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); reg_w(dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
reg_w(dev, 0x01, 0, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
reg_w(dev, 0x01, 0, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
reg_w(dev, 0x01, 0, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
reg_w(dev, 0x01, 0, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
reg_w(dev, 0x01, 0, 0x002a, "\x00\x00\x00", 3); reg_w(dev, 0x002a, "\x00\x00\x00", 3);
reg_w(dev, 0x01, 0, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
reg_w(dev, 0x01, 0, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
reg_w(dev, 0x01, 0, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
reg_w(dev, 0x01, 0, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
reg_w(dev, 0x01, 0, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
reg_w(dev, 0x01, 0, 0x0066, "\xd0\xff", 2); reg_w(dev, 0x0066, "\xd0\xff", 2);
reg_w(dev, 0x01, 0, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
reg_w(dev, 0x01, 0, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
reg_w(dev, 0x01, 0, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
reg_w(dev, 0x01, 0, 0x008f, "\x18\x20", 2); reg_w(dev, 0x008f, "\x18\x20", 2);
reg_w(dev, 0x01, 0, 0x0096, "\x01\x08\x04", 3); reg_w(dev, 0x0096, "\x01\x08\x04", 3);
reg_w(dev, 0x01, 0, 0x00a0, "\x44\x44\x44\x04", 4); reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4);
reg_w(dev, 0x01, 0, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
reg_w(dev, 0x01, 0, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
pac7311_reg_write(dev, 0xff, 0x04); pac7311_reg_write(dev, 0xff, 0x04);
pac7311_reg_write(dev, 0x02, 0x04); pac7311_reg_write(dev, 0x02, 0x04);
......
...@@ -334,7 +334,7 @@ static void reg_r(struct usb_device *dev, ...@@ -334,7 +334,7 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev, static void reg_w(struct usb_device *dev,
__u16 value, __u16 value,
const __u8 *buffer, const __u8 *buffer,
__u16 len) int len)
{ {
__u8 tmpbuf[32]; __u8 tmpbuf[32];
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include "gspca.h" #include "gspca.h"
#include "jpeg.h" #include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
static const char version[] = "2.1.0"; static const char version[] = "2.1.3";
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");
...@@ -515,15 +515,24 @@ static void reg_r(struct usb_device *dev, ...@@ -515,15 +515,24 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev, static void reg_w(struct usb_device *dev,
__u16 value, __u16 value,
__u8 *buffer, const __u8 *buffer,
int len) int len)
{ {
__u8 tmpbuf[64];
#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof tmpbuf) {
PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
return;
}
#endif
memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
0x08, 0x08,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
value, 0, value, 0,
buffer, len, tmpbuf, len,
500); 500);
} }
......
...@@ -377,7 +377,7 @@ static int reg_write(struct usb_device *dev, ...@@ -377,7 +377,7 @@ static int reg_write(struct usb_device *dev,
ret = usb_control_msg(dev, ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
req, req,
USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500); value, index, NULL, 0, 500);
PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x", PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x",
index, value, ret); index, value, ret);
......
...@@ -456,7 +456,7 @@ static int reg_write(struct usb_device *dev, ...@@ -456,7 +456,7 @@ static int reg_write(struct usb_device *dev,
ret = usb_control_msg(dev, ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
req, req,
USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500); value, index, NULL, 0, 500);
PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x", PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x",
req, index, value, ret); req, index, value, ret);
......
...@@ -26,8 +26,8 @@ ...@@ -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, 0) #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
static const char version[] = "2.1.0"; static const char version[] = "2.1.3";
struct control_menu_info { struct control_menu_info {
int value; int value;
...@@ -366,13 +366,22 @@ static void t16RegRead(struct usb_device *dev, ...@@ -366,13 +366,22 @@ static void t16RegRead(struct usb_device *dev,
static void t16RegWrite(struct usb_device *dev, static void t16RegWrite(struct usb_device *dev,
__u16 value, __u16 value,
__u16 index, __u8 *buffer, __u16 length) __u16 index, __u8 *buffer, __u16 len)
{ {
__u8 tmpbuf[70];
#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof tmpbuf) {
PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
return;
}
#endif
memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_control_msg(dev,
usb_sndctrlpipe(dev, 0), usb_sndctrlpipe(dev, 0),
0, /* request */ 0, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, buffer, length, 500); value, index, tmpbuf, len, 500);
} }
/* this function is called at probe time */ /* this function is called at probe time */
...@@ -491,24 +500,24 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) ...@@ -491,24 +500,24 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0);
t16RegWrite(dev, 0x01, 00, nset5, 0x04); t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0);
t16RegWrite(dev, 0x01, 00, nset6, 0x22); t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0);
t16RegWrite(dev, 0x01, 00, missing, 0x08); t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
t16RegWrite(dev, 0x01, 00, nset7, 0x4); t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
t16RegWrite(dev, 0x01, 00, nset10, 0x06); t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
t16RegWrite(dev, 0x01, 00, nset8, 0x06); t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
t16RegWrite(dev, 0x01, 00, nset9, 0x04); t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x0); t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x00);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
......
...@@ -192,8 +192,7 @@ static void tv_8532WriteEEprom(struct gspca_dev *gspca_dev) ...@@ -192,8 +192,7 @@ static void tv_8532WriteEEprom(struct gspca_dev *gspca_dev)
datacmd = 0xb0;; datacmd = 0xb0;;
reg_w(dev, TV8532_GPIO, &datacmd, 1); reg_w(dev, TV8532_GPIO, &datacmd, 1);
datacmd = TV8532_CMD_EEprom_Open; datacmd = TV8532_CMD_EEprom_Open;
reg_w(dev, TV8532_CTRL, &datacmd, reg_w(dev, TV8532_CTRL, &datacmd, 1);
1);
/* msleep(1); */ /* msleep(1); */
while (tv_8532_eeprom_data[i]) { while (tv_8532_eeprom_data[i]) {
reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24; reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24;
...@@ -390,8 +389,7 @@ static int sd_open(struct gspca_dev *gspca_dev) ...@@ -390,8 +389,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
tv_8532_setReg(gspca_dev); tv_8532_setReg(gspca_dev);
/*************************************************/ /*************************************************/
data = 0x0b; data = 0x0b;
reg_w(dev, TV8532_GPIO_OE, &data, reg_w(dev, TV8532_GPIO_OE, &data, 1);
1);
/*************************************************/ /*************************************************/
tv_8532_setReg(gspca_dev); tv_8532_setReg(gspca_dev);
/*************************************************/ /*************************************************/
...@@ -417,8 +415,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) ...@@ -417,8 +415,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
static void sd_start(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev)
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
__u8 data = 0; __u8 data;
__u8 dataStart = 0;
__u8 value[2]; __u8 value[2];
data = 0x32; data = 0x32;
...@@ -459,8 +456,8 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -459,8 +456,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */ reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */
data = TESTPTH; /* 0x04; */ data = TESTPTH; /* 0x04; */
reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */ reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */
dataStart = TESTPTBL; /* 0x04; */ data = TESTPTBL; /* 0x04; */
reg_w(dev, TV8532_POINTB_L, &dataStart, 1); /* 0x2f */ reg_w(dev, TV8532_POINTB_L, &data, 1); /* 0x2f */
data = TESTPTBH; /* 0x04; */ data = TESTPTBH; /* 0x04; */
reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */ reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */
data = TV8532_CMD_UPDATE; data = TV8532_CMD_UPDATE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment