summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-03 11:09:12 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 07:16:41 -0300
commitbf7f0b98426b54c29ec8100a3f1963114c2f2ef0 (patch)
treec3d43d2240020fded85674066fd2cb7a5a503f86 /drivers/media
parent0d2a722ddae5e736a5c36a1b99ee4ca59a8373bc (diff)
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: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/conex.c41
-rw-r--r--drivers/media/video/gspca/etoms.c279
-rw-r--r--drivers/media/video/gspca/mars.c48
-rw-r--r--drivers/media/video/gspca/pac7311.c63
-rw-r--r--drivers/media/video/gspca/sonixb.c2
-rw-r--r--drivers/media/video/gspca/sonixj.c17
-rw-r--r--drivers/media/video/gspca/spca500.c2
-rw-r--r--drivers/media/video/gspca/sunplus.c2
-rw-r--r--drivers/media/video/gspca/t613.c33
-rw-r--r--drivers/media/video/gspca/tv8532.c13
10 files changed, 257 insertions, 243 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index b0294c9274e..473bea750b5 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -25,8 +25,8 @@
#define CONEX_CAM 1 /* special JPEG header */
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
+static const char version[] = "2.1.3";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
@@ -114,21 +114,29 @@ static void reg_r(struct usb_device *dev,
0,
index, buffer, length,
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,
__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_sndctrlpipe(dev, 0),
0,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0,
- index, (__u8 *) buffer, length,
- 500);
+ index, tmpbuf, len, 500);
}
static const __u8 cx_sensor_init[][4] = {
@@ -269,7 +277,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x0071, reg71b, 4);
break;
default:
-/* case 2: */
+/* case 2: */
reg_w(gspca_dev->dev, 0x0071, reg71c, 4);
break;
case 3:
@@ -662,8 +670,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_640[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_640[i], length);
}
Reg55 = 0x28;
break;
@@ -671,8 +678,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_352[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_352[i], length);
}
Reg55 = 0x16;
break;
@@ -681,8 +687,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_320[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_320[i], length);
}
Reg55 = 0x14;
break;
@@ -690,8 +695,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_176[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_176[i], length);
}
Reg55 = 0x0B;
break;
@@ -731,8 +735,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 18; i++) {
if (i == 17)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_qtable[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_qtable[i], length);
}
reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */
@@ -866,7 +869,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w(gspca_dev->dev, 0x0053, &val, 1);
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);
if (val == 0)
break;
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index 195b8123ba7..ed7a8f9c0d7 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -22,8 +22,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
+static const char version[] = "2.1.3";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("Etoms USB Camera Driver");
@@ -213,7 +213,7 @@ static __u8 I2c3[] = { 0x12, 0x05 };
static __u8 I2c4[] = { 0x41, 0x08 };
-static void Et_RegRead(struct usb_device *dev,
+static void reg_r(struct usb_device *dev,
__u16 index, __u8 *buffer, int len)
{
usb_control_msg(dev,
@@ -223,14 +223,17 @@ static void Et_RegRead(struct usb_device *dev,
0, index, buffer, len, 500);
}
-static void Et_RegWrite(struct usb_device *dev,
+static void reg_w(struct usb_device *dev,
__u16 index, __u8 *buffer, __u16 len)
{
+ __u8 tmpbuf[8];
+
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
0,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
- 0, index, buffer, len, 500);
+ 0, index, tmpbuf, len, 500);
}
static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer,
@@ -243,14 +246,14 @@ static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer,
ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
/* set the base address */
- Et_RegWrite(dev, ET_I2C_BASE, &base, 1);
+ reg_w(dev, ET_I2C_BASE, &base, 1);
/* set count and prefetch */
- Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1);
+ reg_w(dev, ET_I2C_COUNT, &ptchcount, 1);
/* set the register base */
- Et_RegWrite(dev, ET_I2C_REG, &reg, 1);
+ reg_w(dev, ET_I2C_REG, &reg, 1);
j = length - 1;
for (i = 0; i < length; i++) {
- Et_RegWrite(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
+ reg_w(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
j--;
}
return 0;
@@ -267,17 +270,17 @@ static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 *buffer,
ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
/* set the base address */
- Et_RegWrite(dev, ET_I2C_BASE, &base, 1);
+ reg_w(dev, ET_I2C_BASE, &base, 1);
/* set count and prefetch */
- Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1);
+ reg_w(dev, ET_I2C_COUNT, &ptchcount, 1);
/* set the register base */
- Et_RegWrite(dev, ET_I2C_REG, &reg, 1);
- Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1);
+ reg_w(dev, ET_I2C_REG, &reg, 1);
+ reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1);
prefetch = 0x00;
- Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1);
+ reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1);
j = length - 1;
for (i = 0; i < length; i++) {
- Et_RegRead(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
+ reg_r(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
j--;
}
return 0;
@@ -289,7 +292,7 @@ static int Et_WaitStatus(struct usb_device *dev)
int retry = 10;
while (retry--) {
- Et_RegRead(dev, ET_ClCK, &bytereceived, 1);
+ reg_r(dev, ET_ClCK, &bytereceived, 1);
if (bytereceived != 0)
return 1;
}
@@ -301,7 +304,7 @@ static int Et_videoOff(struct usb_device *dev)
int err;
__u8 stopvideo = 0;
- Et_RegWrite(dev, ET_GPIO_OUT, &stopvideo, 1);
+ reg_w(dev, ET_GPIO_OUT, &stopvideo, 1);
err = Et_WaitStatus(dev);
if (!err)
PDEBUG(D_ERR, "timeout Et_waitStatus VideoON");
@@ -313,7 +316,7 @@ static int Et_videoOn(struct usb_device *dev)
int err;
__u8 startvideo = 0x10; /* set Bit5 */
- Et_RegWrite(dev, ET_GPIO_OUT, &startvideo, 1);
+ reg_w(dev, ET_GPIO_OUT, &startvideo, 1);
err = Et_WaitStatus(dev);
if (!err)
PDEBUG(D_ERR, "timeout Et_waitStatus VideoOFF");
@@ -329,156 +332,156 @@ static void Et_init2(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "Open Init2 ET");
value = 0x2f;
- Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1);
+ reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1);
value = 0x10;
- Et_RegWrite(dev, ET_GPIO_OUT, &value, 1);
- Et_RegRead(dev, ET_GPIO_IN, &received, 1);
+ reg_w(dev, ET_GPIO_OUT, &value, 1);
+ reg_r(dev, ET_GPIO_IN, &received, 1);
value = 0x14; /* 0x14 // 0x16 enabled pattern */
- Et_RegWrite(dev, ET_ClCK, &value, 1);
+ reg_w(dev, ET_ClCK, &value, 1);
value = 0x1b;
- Et_RegWrite(dev, ET_CTRL, &value, 1);
+ reg_w(dev, ET_CTRL, &value, 1);
/* compression et subsampling */
if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
value = ET_COMP_VAL1; /* 320 */
else
value = ET_COMP_VAL0; /* 640 */
- Et_RegWrite(dev, ET_COMP, &value, 1);
+ reg_w(dev, ET_COMP, &value, 1);
value = 0x1f;
- Et_RegWrite(dev, ET_MAXQt, &value, 1);
+ reg_w(dev, ET_MAXQt, &value, 1);
value = 0x04;
- Et_RegWrite(dev, ET_MINQt, &value, 1);
+ reg_w(dev, ET_MINQt, &value, 1);
/* undocumented registers */
value = 0xff;
- Et_RegWrite(dev, ET_REG1d, &value, 1);
+ reg_w(dev, ET_REG1d, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG1e, &value, 1);
+ reg_w(dev, ET_REG1e, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG1f, &value, 1);
+ reg_w(dev, ET_REG1f, &value, 1);
value = 0x35;
- Et_RegWrite(dev, ET_REG20, &value, 1);
+ reg_w(dev, ET_REG20, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_REG21, &value, 1);
+ reg_w(dev, ET_REG21, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_REG22, &value, 1);
+ reg_w(dev, ET_REG22, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG23, &value, 1);
+ reg_w(dev, ET_REG23, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG24, &value, 1);
+ reg_w(dev, ET_REG24, &value, 1);
value = 0x0f;
- Et_RegWrite(dev, ET_REG25, &value, 1);
+ reg_w(dev, ET_REG25, &value, 1);
/* colors setting */
value = 0x11;
- Et_RegWrite(dev, 0x30, &value, 1); /* 0x30 */
+ reg_w(dev, 0x30, &value, 1); /* 0x30 */
value = 0x40;
- Et_RegWrite(dev, 0x31, &value, 1);
+ reg_w(dev, 0x31, &value, 1);
value = 0x00;
- Et_RegWrite(dev, 0x32, &value, 1);
+ reg_w(dev, 0x32, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_O_RED, &value, 1); /* 0x34 */
+ reg_w(dev, ET_O_RED, &value, 1); /* 0x34 */
value = 0x00;
- Et_RegWrite(dev, ET_O_GREEN1, &value, 1);
+ reg_w(dev, ET_O_GREEN1, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_O_BLUE, &value, 1);
+ reg_w(dev, ET_O_BLUE, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_O_GREEN2, &value, 1);
+ reg_w(dev, ET_O_GREEN2, &value, 1);
/*************/
value = 0x80;
- Et_RegWrite(dev, ET_G_RED, &value, 1); /* 0x4d */
+ reg_w(dev, ET_G_RED, &value, 1); /* 0x4d */
value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN1, &value, 1);
+ reg_w(dev, ET_G_GREEN1, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_G_BLUE, &value, 1);
+ reg_w(dev, ET_G_BLUE, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN2, &value, 1);
+ reg_w(dev, ET_G_GREEN2, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_G_GR_H, &value, 1);
+ reg_w(dev, ET_G_GR_H, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_G_GB_H, &value, 1); /* 0x52 */
+ reg_w(dev, ET_G_GB_H, &value, 1); /* 0x52 */
/* Window control registers */
value = 0x80; /* use cmc_out */
- Et_RegWrite(dev, 0x61, &value, 1);
+ reg_w(dev, 0x61, &value, 1);
value = 0x02;
- Et_RegWrite(dev, 0x62, &value, 1);
+ reg_w(dev, 0x62, &value, 1);
value = 0x03;
- Et_RegWrite(dev, 0x63, &value, 1);
+ reg_w(dev, 0x63, &value, 1);
value = 0x14;
- Et_RegWrite(dev, 0x64, &value, 1);
+ reg_w(dev, 0x64, &value, 1);
value = 0x0e;
- Et_RegWrite(dev, 0x65, &value, 1);
+ reg_w(dev, 0x65, &value, 1);
value = 0x02;
- Et_RegWrite(dev, 0x66, &value, 1);
+ reg_w(dev, 0x66, &value, 1);
value = 0x02;
- Et_RegWrite(dev, 0x67, &value, 1);
+ reg_w(dev, 0x67, &value, 1);
/**************************************/
value = 0x8f;
- Et_RegWrite(dev, ET_SYNCHRO, &value, 1); /* 0x68 */
+ reg_w(dev, ET_SYNCHRO, &value, 1); /* 0x68 */
value = 0x69; /* 0x6a //0x69 */
- Et_RegWrite(dev, ET_STARTX, &value, 1);
+ reg_w(dev, ET_STARTX, &value, 1);
value = 0x0d; /* 0x0d //0x0c */
- Et_RegWrite(dev, ET_STARTY, &value, 1);
+ reg_w(dev, ET_STARTY, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1);
+ reg_w(dev, ET_WIDTH_LOW, &value, 1);
value = 0xe0;
- Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1);
+ reg_w(dev, ET_HEIGTH_LOW, &value, 1);
value = 0x60;
- Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */
+ reg_w(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */
value = 0x86;
- Et_RegWrite(dev, ET_REG6e, &value, 1);
+ reg_w(dev, ET_REG6e, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_REG6f, &value, 1);
+ reg_w(dev, ET_REG6f, &value, 1);
value = 0x26;
- Et_RegWrite(dev, ET_REG70, &value, 1);
+ reg_w(dev, ET_REG70, &value, 1);
value = 0x7a;
- Et_RegWrite(dev, ET_REG71, &value, 1);
+ reg_w(dev, ET_REG71, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_REG72, &value, 1);
+ reg_w(dev, ET_REG72, &value, 1);
/* Clock Pattern registers ***************** */
value = 0x00;
- Et_RegWrite(dev, ET_REG73, &value, 1);
+ reg_w(dev, ET_REG73, &value, 1);
value = 0x18; /* 0x28 */
- Et_RegWrite(dev, ET_REG74, &value, 1);
+ reg_w(dev, ET_REG74, &value, 1);
value = 0x0f; /* 0x01 */
- Et_RegWrite(dev, ET_REG75, &value, 1);
+ reg_w(dev, ET_REG75, &value, 1);
/**********************************************/
value = 0x20;
- Et_RegWrite(dev, 0x8a, &value, 1);
+ reg_w(dev, 0x8a, &value, 1);
value = 0x0f;
- Et_RegWrite(dev, 0x8d, &value, 1);
+ reg_w(dev, 0x8d, &value, 1);
value = 0x08;
- Et_RegWrite(dev, 0x8e, &value, 1);
+ reg_w(dev, 0x8e, &value, 1);
/**************************************/
value = 0x08;
- Et_RegWrite(dev, 0x03, &value, 1);
+ reg_w(dev, 0x03, &value, 1);
value = 0x03;
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
+ reg_w(dev, ET_PXL_CLK, &value, 1);
value = 0xff;
- Et_RegWrite(dev, 0x81, &value, 1);
+ reg_w(dev, 0x81, &value, 1);
value = 0x00;
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w(dev, 0x80, &value, 1);
value = 0xff;
- Et_RegWrite(dev, 0x81, &value, 1);
+ reg_w(dev, 0x81, &value, 1);
value = 0x20;
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w(dev, 0x80, &value, 1);
value = 0x01;
- Et_RegWrite(dev, 0x03, &value, 1);
+ reg_w(dev, 0x03, &value, 1);
value = 0x00;
- Et_RegWrite(dev, 0x03, &value, 1);
+ reg_w(dev, 0x03, &value, 1);
value = 0x08;
- Et_RegWrite(dev, 0x03, &value, 1);
+ reg_w(dev, 0x03, &value, 1);
/********************************************/
- /* Et_RegRead(dev,0x0,ET_I2C_BASE,&received,1);
+ /* reg_r(dev,0x0,ET_I2C_BASE,&received,1);
always 0x40 as the pas106 ??? */
/* set the sensor */
if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
value = 0x04; /* 320 */
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
+ reg_w(dev, ET_PXL_CLK, &value, 1);
/* now set by fifo the FormatLine setting */
- Et_RegWrite(dev, 0x62, FormLine, 6);
+ reg_w(dev, 0x62, FormLine, 6);
} else { /* 640 */
/* setting PixelClock
0x03 mean 24/(3+1) = 6 Mhz
@@ -487,24 +490,24 @@ static void Et_init2(struct gspca_dev *gspca_dev)
0x17 -> 24/(23+1) = 1 Mhz
*/
value = 0x1e; /* 0x17 */
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
+ reg_w(dev, ET_PXL_CLK, &value, 1);
/* now set by fifo the FormatLine setting */
- Et_RegWrite(dev, 0x62, FormLine, 6);
+ reg_w(dev, 0x62, FormLine, 6);
}
/* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */
value = 0x47; /* 0x47; */
- Et_RegWrite(dev, 0x81, &value, 1);
+ reg_w(dev, 0x81, &value, 1);
value = 0x40; /* 0x40; */
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w(dev, 0x80, &value, 1);
/* Pedro change */
/* Brightness change Brith+ decrease value */
/* Brigth- increase value */
/* original value = 0x70; */
value = 0x30; /* 0x20; */
- Et_RegWrite(dev, 0x81, &value, 1); /* set brightness */
+ reg_w(dev, 0x81, &value, 1); /* set brightness */
value = 0x20; /* 0x20; */
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w(dev, 0x80, &value, 1);
}
static void setcolors(struct gspca_dev *gspca_dev)
@@ -554,16 +557,16 @@ static void Et_init1(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "Open Init1 ET");
value = 7;
- Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1);
- Et_RegRead(dev, ET_GPIO_IN, &received, 1);
+ reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1);
+ reg_r(dev, ET_GPIO_IN, &received, 1);
value = 1;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
+ reg_w(dev, ET_RESET_ALL, &value, 1);
value = 0;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
+ reg_w(dev, ET_RESET_ALL, &value, 1);
value = 0x10;
- Et_RegWrite(dev, ET_ClCK, &value, 1);
+ reg_w(dev, ET_ClCK, &value, 1);
value = 0x19;
- Et_RegWrite(dev, ET_CTRL, &value, 1);
+ reg_w(dev, ET_CTRL, &value, 1);
/* compression et subsampling */
if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
value = ET_COMP_VAL1;
@@ -573,77 +576,77 @@ static void Et_init1(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "Open mode %d Compression %d",
gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode,
value);
- Et_RegWrite(dev, ET_COMP, &value, 1);
+ reg_w(dev, ET_COMP, &value, 1);
value = 0x1d;
- Et_RegWrite(dev, ET_MAXQt, &value, 1);
+ reg_w(dev, ET_MAXQt, &value, 1);
value = 0x02;
- Et_RegWrite(dev, ET_MINQt, &value, 1);
+ reg_w(dev, ET_MINQt, &value, 1);
/* undocumented registers */
value = 0xff;
- Et_RegWrite(dev, ET_REG1d, &value, 1);
+ reg_w(dev, ET_REG1d, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG1e, &value, 1);
+ reg_w(dev, ET_REG1e, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG1f, &value, 1);
+ reg_w(dev, ET_REG1f, &value, 1);
value = 0x35;
- Et_RegWrite(dev, ET_REG20, &value, 1);
+ reg_w(dev, ET_REG20, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_REG21, &value, 1);
+ reg_w(dev, ET_REG21, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_REG22, &value, 1);
+ reg_w(dev, ET_REG22, &value, 1);
value = 0xf7;
- Et_RegWrite(dev, ET_REG23, &value, 1);
+ reg_w(dev, ET_REG23, &value, 1);
value = 0xff;
- Et_RegWrite(dev, ET_REG24, &value, 1);
+ reg_w(dev, ET_REG24, &value, 1);
value = 0x07;
- Et_RegWrite(dev, ET_REG25, &value, 1);
+ reg_w(dev, ET_REG25, &value, 1);
/* colors setting */
value = 0x80;
- Et_RegWrite(dev, ET_G_RED, &value, 1);
+ reg_w(dev, ET_G_RED, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN1, &value, 1);
+ reg_w(dev, ET_G_GREEN1, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_G_BLUE, &value, 1);
+ reg_w(dev, ET_G_BLUE, &value, 1);
value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN2, &value, 1);
+ reg_w(dev, ET_G_GREEN2, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_G_GR_H, &value, 1);
+ reg_w(dev, ET_G_GR_H, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_G_GB_H, &value, 1);
+ reg_w(dev, ET_G_GB_H, &value, 1);
/* Window control registers */
value = 0xf0;
- Et_RegWrite(dev, ET_SYNCHRO, &value, 1);
+ reg_w(dev, ET_SYNCHRO, &value, 1);
value = 0x56; /* 0x56 */
- Et_RegWrite(dev, ET_STARTX, &value, 1);
+ reg_w(dev, ET_STARTX, &value, 1);
value = 0x05; /* 0x04 */
- Et_RegWrite(dev, ET_STARTY, &value, 1);
+ reg_w(dev, ET_STARTY, &value, 1);
value = 0x60;
- Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1);
+ reg_w(dev, ET_WIDTH_LOW, &value, 1);
value = 0x20;
- Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1);
+ reg_w(dev, ET_HEIGTH_LOW, &value, 1);
value = 0x50;
- Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1);
+ reg_w(dev, ET_W_H_HEIGTH, &value, 1);
value = 0x86;
- Et_RegWrite(dev, ET_REG6e, &value, 1);
+ reg_w(dev, ET_REG6e, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_REG6f, &value, 1);
+ reg_w(dev, ET_REG6f, &value, 1);
value = 0x86;
- Et_RegWrite(dev, ET_REG70, &value, 1);
+ reg_w(dev, ET_REG70, &value, 1);
value = 0x14;
- Et_RegWrite(dev, ET_REG71, &value, 1);
+ reg_w(dev, ET_REG71, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_REG72, &value, 1);
+ reg_w(dev, ET_REG72, &value, 1);
/* Clock Pattern registers */
value = 0x00;
- Et_RegWrite(dev, ET_REG73, &value, 1);
+ reg_w(dev, ET_REG73, &value, 1);
value = 0x00;
- Et_RegWrite(dev, ET_REG74, &value, 1);
+ reg_w(dev, ET_REG74, &value, 1);
value = 0x0a;
- Et_RegWrite(dev, ET_REG75, &value, 1);
+ reg_w(dev, ET_REG75, &value, 1);
value = 0x04;
- Et_RegWrite(dev, ET_I2C_CLK, &value, 1);
+ reg_w(dev, ET_I2C_CLK, &value, 1);
value = 0x01;
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
+ reg_w(dev, ET_PXL_CLK, &value, 1);
/* set the sensor */
if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
I2c0[0] = 0x06;
@@ -679,7 +682,7 @@ static void Et_init1(struct gspca_dev *gspca_dev)
/* magnetude and sign bit for DAC */
Et_i2cwrite(dev, PAS106_REG7, I2c4, sizeof I2c4, 1);
/* now set by fifo the whole colors setting */
- Et_RegWrite(dev, ET_G_RED, GainRGBG, 6);
+ reg_w(dev, ET_G_RED, GainRGBG, 6);
getcolors(gspca_dev);
setcolors(gspca_dev);
}
@@ -738,7 +741,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
else
Et_init2(gspca_dev);
value = 0x08;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
+ reg_w(dev, ET_RESET_ALL, &value, 1);
err = Et_videoOff(dev);
PDEBUG(D_STREAM, "Et_Init_VideoOff %d", err);
return 0;
@@ -758,7 +761,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
Et_init2(gspca_dev);
value = 0x08;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
+ reg_w(dev, ET_RESET_ALL, &value, 1);
err = Et_videoOn(dev);
PDEBUG(D_STREAM, "Et_VideoOn %d", err);
}
@@ -787,7 +790,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
__u8 brightness = sd->brightness;
for (i = 0; i < 4; i++)
- Et_RegWrite(gspca_dev->dev, (ET_O_RED + i), &brightness, 1);
+ reg_w(gspca_dev->dev, (ET_O_RED + i), &brightness, 1);
}
static void getbrightness(struct gspca_dev *gspca_dev)
@@ -798,7 +801,7 @@ static void getbrightness(struct gspca_dev *gspca_dev)
__u8 value = 0;
for (i = 0; i < 4; i++) {
- Et_RegRead(gspca_dev->dev, (ET_O_RED + i), &value, 1);
+ reg_r(gspca_dev->dev, (ET_O_RED + i), &value, 1);
brightness += value;
}
sd->brightness = brightness >> 3;
@@ -811,7 +814,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
__u8 contrast = sd->contrast;
memset(RGBG, contrast, sizeof RGBG - 2);
- Et_RegWrite(gspca_dev->dev, ET_G_RED, RGBG, 6);
+ reg_w(gspca_dev->dev, ET_G_RED, RGBG, 6);
}
static void getcontrast(struct gspca_dev *gspca_dev)
@@ -822,7 +825,7 @@ static void getcontrast(struct gspca_dev *gspca_dev)
__u8 value = 0;
for (i = 0; i < 4; i++) {
- Et_RegRead(gspca_dev->dev, (ET_G_RED + i), &value, 1);
+ reg_r(gspca_dev->dev, (ET_G_RED + i), &value, 1);
contrast += value;
}
sd->contrast = contrast >> 2;
@@ -870,7 +873,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
__u8 r, g, b;
Gbright = Et_getgainG(gspca_dev);
- Et_RegRead(dev, ET_LUMA_CENTER, GRBG, 4);
+ reg_r(dev, ET_LUMA_CENTER, GRBG, 4);
g = (GRBG[0] + GRBG[3]) >> 1;
r = GRBG[1];
b = GRBG[2];
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index d8cd2148f30..6556e0a330f 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -79,49 +79,35 @@ enum {
};
static int pcam_reg_write(struct usb_device *dev,
- __u16 index, unsigned char *value, int length)
+ __u16 index, __u8 *value, int len)
{
int rc;
rc = usb_control_msg(dev,
usb_sndbulkpipe(dev, 4),
0x12,
-/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */
+/* ?? 0xc8 = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_??? !? */
0xc8,
0, /* value */
- index, value, length, 500);
- PDEBUG(D_USBO, "reg write: 0x%02X , result = 0x%x", index, rc);
-
+ index, value, len, 500);
if (rc < 0)
- PDEBUG(D_ERR, "reg write: error %d", rc);
+ PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc);
return rc;
}
-static void MISensor_BulkWrite(struct usb_device *dev, unsigned short *pch,
- char Address)
+static void MISensor_BulkWrite(struct usb_device *dev,
+ unsigned short *pch,
+ char Address)
{
- int result;
- unsigned char data[6];
+ __u8 data[6];
data[0] = 0x1f;
- data[1] = 0;
+ data[1] = 0; /* control byte */
data[2] = Address;
data[3] = *pch >> 8; /* high 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)
- PDEBUG(D_ERR, "reg write: error %d", result);
+ pcam_reg_write(dev, Address, data, 5);
}
/* this function is called at probe time */
@@ -167,7 +153,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x01; /* address */
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)
return;
@@ -193,14 +179,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[10] = 0x5d; /* reg 9, I2C device address
* [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)
return;
data[0] = 0x23; /* address */
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) {
PDEBUG(D_ERR, "Register write failed");
return;
@@ -213,7 +199,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* else */
data[1] = 50; /* 50 reg 60, pc-cam frame size
* (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)
return;
@@ -255,13 +241,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* auto dark-gain */
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)
return;
data[0] = 0x67;
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)
return;
@@ -340,7 +326,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x00;
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)
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 14eb25d8184..14cc49a4c2c 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -23,8 +23,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
+static const char version[] = "2.1.3";
MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
MODULE_DESCRIPTION("Pixart PAC7311");
@@ -195,16 +195,18 @@ const unsigned char pac7311_jpeg_header[] = {
};
static void reg_w(struct usb_device *dev,
- __u16 req,
- __u16 value,
__u16 index,
- __u8 *buffer, __u16 length)
+ char *buffer, __u16 len)
{
+ __u8 tmpbuf[8];
+
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
- req,
+ 1, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value, index, buffer, length,
+ 0, /* value */
+ index, tmpbuf, len,
500);
}
@@ -227,7 +229,12 @@ static void pac7311_reg_write(struct usb_device *dev,
__u8 buf;
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 */
@@ -313,26 +320,26 @@ static void sd_start(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
pac7311_reg_write(dev, 0xff, 0x01);
- reg_w(dev, 0x01, 0, 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, 0x01, 0, 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, 0x01, 0, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
- reg_w(dev, 0x01, 0, 0x002a, "\x00\x00\x00", 3);
- reg_w(dev, 0x01, 0, 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, 0x01, 0, 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, 0x01, 0, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
- reg_w(dev, 0x01, 0, 0x0066, "\xd0\xff", 2);
- reg_w(dev, 0x01, 0, 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, 0x01, 0, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
- reg_w(dev, 0x01, 0, 0x008f, "\x18\x20", 2);
- reg_w(dev, 0x01, 0, 0x0096, "\x01\x08\x04", 3);
- reg_w(dev, 0x01, 0, 0x00a0, "\x44\x44\x44\x04", 4);
- reg_w(dev, 0x01, 0, 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, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
+ reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
+ reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
+ reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
+ reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
+ reg_w(dev, 0x002a, "\x00\x00\x00", 3);
+ reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
+ reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
+ reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
+ reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
+ reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
+ reg_w(dev, 0x0066, "\xd0\xff", 2);
+ reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
+ reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
+ reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
+ reg_w(dev, 0x008f, "\x18\x20", 2);
+ reg_w(dev, 0x0096, "\x01\x08\x04", 3);
+ reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4);
+ reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
+ reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
pac7311_reg_write(dev, 0xff, 0x04);
pac7311_reg_write(dev, 0x02, 0x04);
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 7850efa4109..4baac51bf40 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -334,7 +334,7 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev,
__u16 value,
const __u8 *buffer,
- __u16 len)
+ int len)
{
__u8 tmpbuf[32];
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index e6a49fe2c4e..4f23b16c89a 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
+static const char version[] = "2.1.3";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
@@ -515,15 +515,24 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev,
__u16 value,
- __u8 *buffer,
+ const __u8 *buffer,
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_sndctrlpipe(dev, 0),
0x08,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
value, 0,
- buffer, len,
+ tmpbuf, len,
500);
}
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index e72fca5744a..1db5b33ad85 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -377,7 +377,7 @@ static int reg_write(struct usb_device *dev,
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
req,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500);
PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x",
index, value, ret);
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index 25c5245725d..113c0710692 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -456,7 +456,7 @@ static int reg_write(struct usb_device *dev,
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
req,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500);
PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x",
req, index, value, ret);
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index c22b301ebae..de43118dec7 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -26,8 +26,8 @@
#define MODULE_NAME "t613"
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
+static const char version[] = "2.1.3";
struct control_menu_info {
int value;
@@ -366,13 +366,22 @@ static void t16RegRead(struct usb_device *dev,
static void t16RegWrite(struct usb_device *dev,
__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_sndctrlpipe(dev, 0),
0, /* request */
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 */
@@ -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, 0x338e, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset5, 0x04);
+ t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
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, 0x4aa6, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, missing, 0x08);
+ t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset7, 0x4);
- t16RegWrite(dev, 0x01, 00, nset10, 0x06);
- t16RegWrite(dev, 0x01, 00, nset8, 0x06);
- t16RegWrite(dev, 0x01, 00, nset9, 0x04);
+ t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
+ t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
+ t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
+ 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, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 6218441ba1f..6da5280b543 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -192,8 +192,7 @@ static void tv_8532WriteEEprom(struct gspca_dev *gspca_dev)
datacmd = 0xb0;;
reg_w(dev, TV8532_GPIO, &datacmd, 1);
datacmd = TV8532_CMD_EEprom_Open;
- reg_w(dev, TV8532_CTRL, &datacmd,
- 1);
+ reg_w(dev, TV8532_CTRL, &datacmd, 1);
/* msleep(1); */
while (tv_8532_eeprom_data[i]) {
reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24;
@@ -390,8 +389,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
tv_8532_setReg(gspca_dev);
/*************************************************/
data = 0x0b;
- reg_w(dev, TV8532_GPIO_OE, &data,
- 1);
+ reg_w(dev, TV8532_GPIO_OE, &data, 1);
/*************************************************/
tv_8532_setReg(gspca_dev);
/*************************************************/
@@ -417,8 +415,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
static void sd_start(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
- __u8 dataStart = 0;
+ __u8 data;
__u8 value[2];
data = 0x32;
@@ -459,8 +456,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */
data = TESTPTH; /* 0x04; */
reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */
- dataStart = TESTPTBL; /* 0x04; */
- reg_w(dev, TV8532_POINTB_L, &dataStart, 1); /* 0x2f */
+ data = TESTPTBL; /* 0x04; */
+ reg_w(dev, TV8532_POINTB_L, &data, 1); /* 0x2f */
data = TESTPTBH; /* 0x04; */
reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */
data = TV8532_CMD_UPDATE;