aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-03 10:09:12 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:16:41 -0400
commitbf7f0b98426b54c29ec8100a3f1963114c2f2ef0 (patch)
treec3d43d2240020fded85674066fd2cb7a5a503f86
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>
-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 @@
25#define CONEX_CAM 1 /* special JPEG header */ 25#define CONEX_CAM 1 /* special JPEG header */
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
29static const char version[] = "2.1.0"; 29static const char version[] = "2.1.3";
30 30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); 32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
@@ -114,21 +114,29 @@ static void reg_r(struct usb_device *dev,
114 0, 114 0,
115 index, buffer, length, 115 index, buffer, length,
116 500); 116 500);
117 PDEBUG(D_USBI, "reg read i:%02x -> %02x", index, *buffer); 117 PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", index, *buffer);
118} 118}
119 119
120static void reg_w(struct usb_device *dev, 120static void reg_w(struct usb_device *dev,
121 __u16 index, 121 __u16 index,
122 const __u8 *buffer, __u16 length) 122 const __u8 *buffer, __u16 len)
123{ 123{
124 PDEBUG(D_USBO, "reg write i:%02x = %02x", index, *buffer); 124 __u8 tmpbuf[8];
125
126#ifdef CONFIG_VIDEO_ADV_DEBUG
127 if (len > sizeof tmpbuf) {
128 PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
129 return;
130 }
131 PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
132#endif
133 memcpy(tmpbuf, buffer, len);
125 usb_control_msg(dev, 134 usb_control_msg(dev,
126 usb_sndctrlpipe(dev, 0), 135 usb_sndctrlpipe(dev, 0),
127 0, 136 0,
128 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 137 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
129 0, 138 0,
130 index, (__u8 *) buffer, length, 139 index, tmpbuf, len, 500);
131 500);
132} 140}
133 141
134static const __u8 cx_sensor_init[][4] = { 142static const __u8 cx_sensor_init[][4] = {
@@ -269,7 +277,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
269 reg_w(gspca_dev->dev, 0x0071, reg71b, 4); 277 reg_w(gspca_dev->dev, 0x0071, reg71b, 4);
270 break; 278 break;
271 default: 279 default:
272/* case 2: */ 280/* case 2: */
273 reg_w(gspca_dev->dev, 0x0071, reg71c, 4); 281 reg_w(gspca_dev->dev, 0x0071, reg71c, 4);
274 break; 282 break;
275 case 3: 283 case 3:
@@ -662,8 +670,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
662 for (i = 0; i < 27; i++) { 670 for (i = 0; i < 27; i++) {
663 if (i == 26) 671 if (i == 26)
664 length = 2; 672 length = 2;
665 reg_w(gspca_dev->dev, 0x0008, 673 reg_w(gspca_dev->dev, 0x0008, cxjpeg_640[i], length);
666 cxjpeg_640[i], length);
667 } 674 }
668 Reg55 = 0x28; 675 Reg55 = 0x28;
669 break; 676 break;
@@ -671,8 +678,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
671 for (i = 0; i < 27; i++) { 678 for (i = 0; i < 27; i++) {
672 if (i == 26) 679 if (i == 26)
673 length = 2; 680 length = 2;
674 reg_w(gspca_dev->dev, 0x0008, 681 reg_w(gspca_dev->dev, 0x0008, cxjpeg_352[i], length);
675 cxjpeg_352[i], length);
676 } 682 }
677 Reg55 = 0x16; 683 Reg55 = 0x16;
678 break; 684 break;
@@ -681,8 +687,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
681 for (i = 0; i < 27; i++) { 687 for (i = 0; i < 27; i++) {
682 if (i == 26) 688 if (i == 26)
683 length = 2; 689 length = 2;
684 reg_w(gspca_dev->dev, 0x0008, 690 reg_w(gspca_dev->dev, 0x0008, cxjpeg_320[i], length);
685 cxjpeg_320[i], length);
686 } 691 }
687 Reg55 = 0x14; 692 Reg55 = 0x14;
688 break; 693 break;
@@ -690,8 +695,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
690 for (i = 0; i < 27; i++) { 695 for (i = 0; i < 27; i++) {
691 if (i == 26) 696 if (i == 26)
692 length = 2; 697 length = 2;
693 reg_w(gspca_dev->dev, 0x0008, 698 reg_w(gspca_dev->dev, 0x0008, cxjpeg_176[i], length);
694 cxjpeg_176[i], length);
695 } 699 }
696 Reg55 = 0x0B; 700 Reg55 = 0x0B;
697 break; 701 break;
@@ -731,8 +735,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
731 for (i = 0; i < 18; i++) { 735 for (i = 0; i < 18; i++) {
732 if (i == 17) 736 if (i == 17)
733 length = 2; 737 length = 2;
734 reg_w(gspca_dev->dev, 0x0008, 738 reg_w(gspca_dev->dev, 0x0008, cxjpeg_qtable[i], length);
735 cxjpeg_qtable[i], length);
736 739
737 } 740 }
738 reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */ 741 reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */
@@ -866,7 +869,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
866 reg_w(gspca_dev->dev, 0x0053, &val, 1); 869 reg_w(gspca_dev->dev, 0x0053, &val, 1);
867 870
868 while (retry--) { 871 while (retry--) {
869/* reg_r (gspca_dev->dev,0x00,0x00,0x0002,&val,1);*/ 872/* reg_r(gspca_dev->dev, 0x0002, &val, 1);*/
870 reg_r(gspca_dev->dev, 0x0053, &val, 1); 873 reg_r(gspca_dev->dev, 0x0053, &val, 1);
871 if (val == 0) 874 if (val == 0)
872 break; 875 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 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
26static const char version[] = "2.1.0"; 26static const char version[] = "2.1.3";
27 27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("Etoms USB Camera Driver"); 29MODULE_DESCRIPTION("Etoms USB Camera Driver");
@@ -213,7 +213,7 @@ static __u8 I2c3[] = { 0x12, 0x05 };
213 213
214static __u8 I2c4[] = { 0x41, 0x08 }; 214static __u8 I2c4[] = { 0x41, 0x08 };
215 215
216static void Et_RegRead(struct usb_device *dev, 216static void reg_r(struct usb_device *dev,
217 __u16 index, __u8 *buffer, int len) 217 __u16 index, __u8 *buffer, int len)
218{ 218{
219 usb_control_msg(dev, 219 usb_control_msg(dev,
@@ -223,14 +223,17 @@ static void Et_RegRead(struct usb_device *dev,
223 0, index, buffer, len, 500); 223 0, index, buffer, len, 500);
224} 224}
225 225
226static void Et_RegWrite(struct usb_device *dev, 226static void reg_w(struct usb_device *dev,
227 __u16 index, __u8 *buffer, __u16 len) 227 __u16 index, __u8 *buffer, __u16 len)
228{ 228{
229 __u8 tmpbuf[8];
230
231 memcpy(tmpbuf, buffer, len);
229 usb_control_msg(dev, 232 usb_control_msg(dev,
230 usb_sndctrlpipe(dev, 0), 233 usb_sndctrlpipe(dev, 0),
231 0, 234 0,
232 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 235 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
233 0, index, buffer, len, 500); 236 0, index, tmpbuf, len, 500);
234} 237}
235 238
236static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer, 239static 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,
243 246
244 ptchcount = (((length & 0x07) << 4) | (mode & 0x03)); 247 ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
245/* set the base address */ 248/* set the base address */
246 Et_RegWrite(dev, ET_I2C_BASE, &base, 1); 249 reg_w(dev, ET_I2C_BASE, &base, 1);
247/* set count and prefetch */ 250/* set count and prefetch */
248 Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1); 251 reg_w(dev, ET_I2C_COUNT, &ptchcount, 1);
249/* set the register base */ 252/* set the register base */
250 Et_RegWrite(dev, ET_I2C_REG, &reg, 1); 253 reg_w(dev, ET_I2C_REG, &reg, 1);
251 j = length - 1; 254 j = length - 1;
252 for (i = 0; i < length; i++) { 255 for (i = 0; i < length; i++) {
253 Et_RegWrite(dev, (ET_I2C_DATA0 + j), &buffer[j], 1); 256 reg_w(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
254 j--; 257 j--;
255 } 258 }
256 return 0; 259 return 0;
@@ -267,17 +270,17 @@ static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 *buffer,
267 270
268 ptchcount = (((length & 0x07) << 4) | (mode & 0x03)); 271 ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
269/* set the base address */ 272/* set the base address */
270 Et_RegWrite(dev, ET_I2C_BASE, &base, 1); 273 reg_w(dev, ET_I2C_BASE, &base, 1);
271/* set count and prefetch */ 274/* set count and prefetch */
272 Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1); 275 reg_w(dev, ET_I2C_COUNT, &ptchcount, 1);
273/* set the register base */ 276/* set the register base */
274 Et_RegWrite(dev, ET_I2C_REG, &reg, 1); 277 reg_w(dev, ET_I2C_REG, &reg, 1);
275 Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1); 278 reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1);
276 prefetch = 0x00; 279 prefetch = 0x00;
277 Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1); 280 reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1);
278 j = length - 1; 281 j = length - 1;
279 for (i = 0; i < length; i++) { 282 for (i = 0; i < length; i++) {
280 Et_RegRead(dev, (ET_I2C_DATA0 + j), &buffer[j], 1); 283 reg_r(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
281 j--; 284 j--;
282 } 285 }
283 return 0; 286 return 0;
@@ -289,7 +292,7 @@ static int Et_WaitStatus(struct usb_device *dev)
289 int retry = 10; 292 int retry = 10;
290 293
291 while (retry--) { 294 while (retry--) {
292 Et_RegRead(dev, ET_ClCK, &bytereceived, 1); 295 reg_r(dev, ET_ClCK, &bytereceived, 1);
293 if (bytereceived != 0) 296 if (bytereceived != 0)
294 return 1; 297 return 1;
295 } 298 }
@@ -301,7 +304,7 @@ static int Et_videoOff(struct usb_device *dev)
301 int err; 304 int err;
302 __u8 stopvideo = 0; 305 __u8 stopvideo = 0;
303 306
304 Et_RegWrite(dev, ET_GPIO_OUT, &stopvideo, 1); 307 reg_w(dev, ET_GPIO_OUT, &stopvideo, 1);
305 err = Et_WaitStatus(dev); 308 err = Et_WaitStatus(dev);
306 if (!err) 309 if (!err)
307 PDEBUG(D_ERR, "timeout Et_waitStatus VideoON"); 310 PDEBUG(D_ERR, "timeout Et_waitStatus VideoON");
@@ -313,7 +316,7 @@ static int Et_videoOn(struct usb_device *dev)
313 int err; 316 int err;
314 __u8 startvideo = 0x10; /* set Bit5 */ 317 __u8 startvideo = 0x10; /* set Bit5 */
315 318
316 Et_RegWrite(dev, ET_GPIO_OUT, &startvideo, 1); 319 reg_w(dev, ET_GPIO_OUT, &startvideo, 1);
317 err = Et_WaitStatus(dev); 320 err = Et_WaitStatus(dev);
318 if (!err) 321 if (!err)
319 PDEBUG(D_ERR, "timeout Et_waitStatus VideoOFF"); 322 PDEBUG(D_ERR, "timeout Et_waitStatus VideoOFF");
@@ -329,156 +332,156 @@ static void Et_init2(struct gspca_dev *gspca_dev)
329 332
330 PDEBUG(D_STREAM, "Open Init2 ET"); 333 PDEBUG(D_STREAM, "Open Init2 ET");
331 value = 0x2f; 334 value = 0x2f;
332 Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1); 335 reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1);
333 value = 0x10; 336 value = 0x10;
334 Et_RegWrite(dev, ET_GPIO_OUT, &value, 1); 337 reg_w(dev, ET_GPIO_OUT, &value, 1);
335 Et_RegRead(dev, ET_GPIO_IN, &received, 1); 338 reg_r(dev, ET_GPIO_IN, &received, 1);
336 value = 0x14; /* 0x14 // 0x16 enabled pattern */ 339 value = 0x14; /* 0x14 // 0x16 enabled pattern */
337 Et_RegWrite(dev, ET_ClCK, &value, 1); 340 reg_w(dev, ET_ClCK, &value, 1);
338 value = 0x1b; 341 value = 0x1b;
339 Et_RegWrite(dev, ET_CTRL, &value, 1); 342 reg_w(dev, ET_CTRL, &value, 1);
340 343
341 /* compression et subsampling */ 344 /* compression et subsampling */
342 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) 345 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
343 value = ET_COMP_VAL1; /* 320 */ 346 value = ET_COMP_VAL1; /* 320 */
344 else 347 else
345 value = ET_COMP_VAL0; /* 640 */ 348 value = ET_COMP_VAL0; /* 640 */
346 Et_RegWrite(dev, ET_COMP, &value, 1); 349 reg_w(dev, ET_COMP, &value, 1);
347 value = 0x1f; 350 value = 0x1f;
348 Et_RegWrite(dev, ET_MAXQt, &value, 1); 351 reg_w(dev, ET_MAXQt, &value, 1);
349 value = 0x04; 352 value = 0x04;
350 Et_RegWrite(dev, ET_MINQt, &value, 1); 353 reg_w(dev, ET_MINQt, &value, 1);
351 /* undocumented registers */ 354 /* undocumented registers */
352 value = 0xff; 355 value = 0xff;
353 Et_RegWrite(dev, ET_REG1d, &value, 1); 356 reg_w(dev, ET_REG1d, &value, 1);
354 value = 0xff; 357 value = 0xff;
355 Et_RegWrite(dev, ET_REG1e, &value, 1); 358 reg_w(dev, ET_REG1e, &value, 1);
356 value = 0xff; 359 value = 0xff;
357 Et_RegWrite(dev, ET_REG1f, &value, 1); 360 reg_w(dev, ET_REG1f, &value, 1);
358 value = 0x35; 361 value = 0x35;
359 Et_RegWrite(dev, ET_REG20, &value, 1); 362 reg_w(dev, ET_REG20, &value, 1);
360 value = 0x01; 363 value = 0x01;
361 Et_RegWrite(dev, ET_REG21, &value, 1); 364 reg_w(dev, ET_REG21, &value, 1);
362 value = 0x00; 365 value = 0x00;
363 Et_RegWrite(dev, ET_REG22, &value, 1); 366 reg_w(dev, ET_REG22, &value, 1);
364 value = 0xff; 367 value = 0xff;
365 Et_RegWrite(dev, ET_REG23, &value, 1); 368 reg_w(dev, ET_REG23, &value, 1);
366 value = 0xff; 369 value = 0xff;
367 Et_RegWrite(dev, ET_REG24, &value, 1); 370 reg_w(dev, ET_REG24, &value, 1);
368 value = 0x0f; 371 value = 0x0f;
369 Et_RegWrite(dev, ET_REG25, &value, 1); 372 reg_w(dev, ET_REG25, &value, 1);
370 /* colors setting */ 373 /* colors setting */
371 value = 0x11; 374 value = 0x11;
372 Et_RegWrite(dev, 0x30, &value, 1); /* 0x30 */ 375 reg_w(dev, 0x30, &value, 1); /* 0x30 */
373 value = 0x40; 376 value = 0x40;
374 Et_RegWrite(dev, 0x31, &value, 1); 377 reg_w(dev, 0x31, &value, 1);
375 value = 0x00; 378 value = 0x00;
376 Et_RegWrite(dev, 0x32, &value, 1); 379 reg_w(dev, 0x32, &value, 1);
377 value = 0x00; 380 value = 0x00;
378 Et_RegWrite(dev, ET_O_RED, &value, 1); /* 0x34 */ 381 reg_w(dev, ET_O_RED, &value, 1); /* 0x34 */
379 value = 0x00; 382 value = 0x00;
380 Et_RegWrite(dev, ET_O_GREEN1, &value, 1); 383 reg_w(dev, ET_O_GREEN1, &value, 1);
381 value = 0x00; 384 value = 0x00;
382 Et_RegWrite(dev, ET_O_BLUE, &value, 1); 385 reg_w(dev, ET_O_BLUE, &value, 1);
383 value = 0x00; 386 value = 0x00;
384 Et_RegWrite(dev, ET_O_GREEN2, &value, 1); 387 reg_w(dev, ET_O_GREEN2, &value, 1);
385 /*************/ 388 /*************/
386 value = 0x80; 389 value = 0x80;
387 Et_RegWrite(dev, ET_G_RED, &value, 1); /* 0x4d */ 390 reg_w(dev, ET_G_RED, &value, 1); /* 0x4d */
388 value = 0x80; 391 value = 0x80;
389 Et_RegWrite(dev, ET_G_GREEN1, &value, 1); 392 reg_w(dev, ET_G_GREEN1, &value, 1);
390 value = 0x80; 393 value = 0x80;
391 Et_RegWrite(dev, ET_G_BLUE, &value, 1); 394 reg_w(dev, ET_G_BLUE, &value, 1);
392 value = 0x80; 395 value = 0x80;
393 Et_RegWrite(dev, ET_G_GREEN2, &value, 1); 396 reg_w(dev, ET_G_GREEN2, &value, 1);
394 value = 0x00; 397 value = 0x00;
395 Et_RegWrite(dev, ET_G_GR_H, &value, 1); 398 reg_w(dev, ET_G_GR_H, &value, 1);
396 value = 0x00; 399 value = 0x00;
397 Et_RegWrite(dev, ET_G_GB_H, &value, 1); /* 0x52 */ 400 reg_w(dev, ET_G_GB_H, &value, 1); /* 0x52 */
398 /* Window control registers */ 401 /* Window control registers */
399 402
400 value = 0x80; /* use cmc_out */ 403 value = 0x80; /* use cmc_out */
401 Et_RegWrite(dev, 0x61, &value, 1); 404 reg_w(dev, 0x61, &value, 1);
402 405
403 value = 0x02; 406 value = 0x02;
404 Et_RegWrite(dev, 0x62, &value, 1); 407 reg_w(dev, 0x62, &value, 1);
405 value = 0x03; 408 value = 0x03;
406 Et_RegWrite(dev, 0x63, &value, 1); 409 reg_w(dev, 0x63, &value, 1);
407 value = 0x14; 410 value = 0x14;
408 Et_RegWrite(dev, 0x64, &value, 1); 411 reg_w(dev, 0x64, &value, 1);
409 value = 0x0e; 412 value = 0x0e;
410 Et_RegWrite(dev, 0x65, &value, 1); 413 reg_w(dev, 0x65, &value, 1);
411 value = 0x02; 414 value = 0x02;
412 Et_RegWrite(dev, 0x66, &value, 1); 415 reg_w(dev, 0x66, &value, 1);
413 value = 0x02; 416 value = 0x02;
414 Et_RegWrite(dev, 0x67, &value, 1); 417 reg_w(dev, 0x67, &value, 1);
415 418
416 /**************************************/ 419 /**************************************/
417 value = 0x8f; 420 value = 0x8f;
418 Et_RegWrite(dev, ET_SYNCHRO, &value, 1); /* 0x68 */ 421 reg_w(dev, ET_SYNCHRO, &value, 1); /* 0x68 */
419 value = 0x69; /* 0x6a //0x69 */ 422 value = 0x69; /* 0x6a //0x69 */
420 Et_RegWrite(dev, ET_STARTX, &value, 1); 423 reg_w(dev, ET_STARTX, &value, 1);
421 value = 0x0d; /* 0x0d //0x0c */ 424 value = 0x0d; /* 0x0d //0x0c */
422 Et_RegWrite(dev, ET_STARTY, &value, 1); 425 reg_w(dev, ET_STARTY, &value, 1);
423 value = 0x80; 426 value = 0x80;
424 Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1); 427 reg_w(dev, ET_WIDTH_LOW, &value, 1);
425 value = 0xe0; 428 value = 0xe0;
426 Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1); 429 reg_w(dev, ET_HEIGTH_LOW, &value, 1);
427 value = 0x60; 430 value = 0x60;
428 Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */ 431 reg_w(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */
429 value = 0x86; 432 value = 0x86;
430 Et_RegWrite(dev, ET_REG6e, &value, 1); 433 reg_w(dev, ET_REG6e, &value, 1);
431 value = 0x01; 434 value = 0x01;
432 Et_RegWrite(dev, ET_REG6f, &value, 1); 435 reg_w(dev, ET_REG6f, &value, 1);
433 value = 0x26; 436 value = 0x26;
434 Et_RegWrite(dev, ET_REG70, &value, 1); 437 reg_w(dev, ET_REG70, &value, 1);
435 value = 0x7a; 438 value = 0x7a;
436 Et_RegWrite(dev, ET_REG71, &value, 1); 439 reg_w(dev, ET_REG71, &value, 1);
437 value = 0x01; 440 value = 0x01;
438 Et_RegWrite(dev, ET_REG72, &value, 1); 441 reg_w(dev, ET_REG72, &value, 1);
439 /* Clock Pattern registers ***************** */ 442 /* Clock Pattern registers ***************** */
440 value = 0x00; 443 value = 0x00;
441 Et_RegWrite(dev, ET_REG73, &value, 1); 444 reg_w(dev, ET_REG73, &value, 1);
442 value = 0x18; /* 0x28 */ 445 value = 0x18; /* 0x28 */
443 Et_RegWrite(dev, ET_REG74, &value, 1); 446 reg_w(dev, ET_REG74, &value, 1);
444 value = 0x0f; /* 0x01 */ 447 value = 0x0f; /* 0x01 */
445 Et_RegWrite(dev, ET_REG75, &value, 1); 448 reg_w(dev, ET_REG75, &value, 1);
446 /**********************************************/ 449 /**********************************************/
447 value = 0x20; 450 value = 0x20;
448 Et_RegWrite(dev, 0x8a, &value, 1); 451 reg_w(dev, 0x8a, &value, 1);
449 value = 0x0f; 452 value = 0x0f;
450 Et_RegWrite(dev, 0x8d, &value, 1); 453 reg_w(dev, 0x8d, &value, 1);
451 value = 0x08; 454 value = 0x08;
452 Et_RegWrite(dev, 0x8e, &value, 1); 455 reg_w(dev, 0x8e, &value, 1);
453 /**************************************/ 456 /**************************************/
454 value = 0x08; 457 value = 0x08;
455 Et_RegWrite(dev, 0x03, &value, 1); 458 reg_w(dev, 0x03, &value, 1);
456 value = 0x03; 459 value = 0x03;
457 Et_RegWrite(dev, ET_PXL_CLK, &value, 1); 460 reg_w(dev, ET_PXL_CLK, &value, 1);
458 value = 0xff; 461 value = 0xff;
459 Et_RegWrite(dev, 0x81, &value, 1); 462 reg_w(dev, 0x81, &value, 1);
460 value = 0x00; 463 value = 0x00;
461 Et_RegWrite(dev, 0x80, &value, 1); 464 reg_w(dev, 0x80, &value, 1);
462 value = 0xff; 465 value = 0xff;
463 Et_RegWrite(dev, 0x81, &value, 1); 466 reg_w(dev, 0x81, &value, 1);
464 value = 0x20; 467 value = 0x20;
465 Et_RegWrite(dev, 0x80, &value, 1); 468 reg_w(dev, 0x80, &value, 1);
466 value = 0x01; 469 value = 0x01;
467 Et_RegWrite(dev, 0x03, &value, 1); 470 reg_w(dev, 0x03, &value, 1);
468 value = 0x00; 471 value = 0x00;
469 Et_RegWrite(dev, 0x03, &value, 1); 472 reg_w(dev, 0x03, &value, 1);
470 value = 0x08; 473 value = 0x08;
471 Et_RegWrite(dev, 0x03, &value, 1); 474 reg_w(dev, 0x03, &value, 1);
472 /********************************************/ 475 /********************************************/
473 476
474 /* Et_RegRead(dev,0x0,ET_I2C_BASE,&received,1); 477 /* reg_r(dev,0x0,ET_I2C_BASE,&received,1);
475 always 0x40 as the pas106 ??? */ 478 always 0x40 as the pas106 ??? */
476 /* set the sensor */ 479 /* set the sensor */
477 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 480 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
478 value = 0x04; /* 320 */ 481 value = 0x04; /* 320 */
479 Et_RegWrite(dev, ET_PXL_CLK, &value, 1); 482 reg_w(dev, ET_PXL_CLK, &value, 1);
480 /* now set by fifo the FormatLine setting */ 483 /* now set by fifo the FormatLine setting */
481 Et_RegWrite(dev, 0x62, FormLine, 6); 484 reg_w(dev, 0x62, FormLine, 6);
482 } else { /* 640 */ 485 } else { /* 640 */
483 /* setting PixelClock 486 /* setting PixelClock
484 0x03 mean 24/(3+1) = 6 Mhz 487 0x03 mean 24/(3+1) = 6 Mhz
@@ -487,24 +490,24 @@ static void Et_init2(struct gspca_dev *gspca_dev)
487 0x17 -> 24/(23+1) = 1 Mhz 490 0x17 -> 24/(23+1) = 1 Mhz
488 */ 491 */
489 value = 0x1e; /* 0x17 */ 492 value = 0x1e; /* 0x17 */
490 Et_RegWrite(dev, ET_PXL_CLK, &value, 1); 493 reg_w(dev, ET_PXL_CLK, &value, 1);
491 /* now set by fifo the FormatLine setting */ 494 /* now set by fifo the FormatLine setting */
492 Et_RegWrite(dev, 0x62, FormLine, 6); 495 reg_w(dev, 0x62, FormLine, 6);
493 } 496 }
494 497
495 /* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */ 498 /* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */
496 value = 0x47; /* 0x47; */ 499 value = 0x47; /* 0x47; */
497 Et_RegWrite(dev, 0x81, &value, 1); 500 reg_w(dev, 0x81, &value, 1);
498 value = 0x40; /* 0x40; */ 501 value = 0x40; /* 0x40; */
499 Et_RegWrite(dev, 0x80, &value, 1); 502 reg_w(dev, 0x80, &value, 1);
500 /* Pedro change */ 503 /* Pedro change */
501 /* Brightness change Brith+ decrease value */ 504 /* Brightness change Brith+ decrease value */
502 /* Brigth- increase value */ 505 /* Brigth- increase value */
503 /* original value = 0x70; */ 506 /* original value = 0x70; */
504 value = 0x30; /* 0x20; */ 507 value = 0x30; /* 0x20; */
505 Et_RegWrite(dev, 0x81, &value, 1); /* set brightness */ 508 reg_w(dev, 0x81, &value, 1); /* set brightness */
506 value = 0x20; /* 0x20; */ 509 value = 0x20; /* 0x20; */
507 Et_RegWrite(dev, 0x80, &value, 1); 510 reg_w(dev, 0x80, &value, 1);
508} 511}
509 512
510static void setcolors(struct gspca_dev *gspca_dev) 513static void setcolors(struct gspca_dev *gspca_dev)
@@ -554,16 +557,16 @@ static void Et_init1(struct gspca_dev *gspca_dev)
554 557
555 PDEBUG(D_STREAM, "Open Init1 ET"); 558 PDEBUG(D_STREAM, "Open Init1 ET");
556 value = 7; 559 value = 7;
557 Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1); 560 reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1);
558 Et_RegRead(dev, ET_GPIO_IN, &received, 1); 561 reg_r(dev, ET_GPIO_IN, &received, 1);
559 value = 1; 562 value = 1;
560 Et_RegWrite(dev, ET_RESET_ALL, &value, 1); 563 reg_w(dev, ET_RESET_ALL, &value, 1);
561 value = 0; 564 value = 0;
562 Et_RegWrite(dev, ET_RESET_ALL, &value, 1); 565 reg_w(dev, ET_RESET_ALL, &value, 1);
563 value = 0x10; 566 value = 0x10;
564 Et_RegWrite(dev, ET_ClCK, &value, 1); 567 reg_w(dev, ET_ClCK, &value, 1);
565 value = 0x19; 568 value = 0x19;
566 Et_RegWrite(dev, ET_CTRL, &value, 1); 569 reg_w(dev, ET_CTRL, &value, 1);
567 /* compression et subsampling */ 570 /* compression et subsampling */
568 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) 571 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
569 value = ET_COMP_VAL1; 572 value = ET_COMP_VAL1;
@@ -573,77 +576,77 @@ static void Et_init1(struct gspca_dev *gspca_dev)
573 PDEBUG(D_STREAM, "Open mode %d Compression %d", 576 PDEBUG(D_STREAM, "Open mode %d Compression %d",
574 gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode, 577 gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode,
575 value); 578 value);
576 Et_RegWrite(dev, ET_COMP, &value, 1); 579 reg_w(dev, ET_COMP, &value, 1);
577 value = 0x1d; 580 value = 0x1d;
578 Et_RegWrite(dev, ET_MAXQt, &value, 1); 581 reg_w(dev, ET_MAXQt, &value, 1);
579 value = 0x02; 582 value = 0x02;
580 Et_RegWrite(dev, ET_MINQt, &value, 1); 583 reg_w(dev, ET_MINQt, &value, 1);
581 /* undocumented registers */ 584 /* undocumented registers */
582 value = 0xff; 585 value = 0xff;
583 Et_RegWrite(dev, ET_REG1d, &value, 1); 586 reg_w(dev, ET_REG1d, &value, 1);
584 value = 0xff; 587 value = 0xff;
585 Et_RegWrite(dev, ET_REG1e, &value, 1); 588 reg_w(dev, ET_REG1e, &value, 1);
586 value = 0xff; 589 value = 0xff;
587 Et_RegWrite(dev, ET_REG1f, &value, 1); 590 reg_w(dev, ET_REG1f, &value, 1);
588 value = 0x35; 591 value = 0x35;
589 Et_RegWrite(dev, ET_REG20, &value, 1); 592 reg_w(dev, ET_REG20, &value, 1);
590 value = 0x01; 593 value = 0x01;
591 Et_RegWrite(dev, ET_REG21, &value, 1); 594 reg_w(dev, ET_REG21, &value, 1);
592 value = 0x00; 595 value = 0x00;
593 Et_RegWrite(dev, ET_REG22, &value, 1); 596 reg_w(dev, ET_REG22, &value, 1);
594 value = 0xf7; 597 value = 0xf7;
595 Et_RegWrite(dev, ET_REG23, &value, 1); 598 reg_w(dev, ET_REG23, &value, 1);
596 value = 0xff; 599 value = 0xff;
597 Et_RegWrite(dev, ET_REG24, &value, 1); 600 reg_w(dev, ET_REG24, &value, 1);
598 value = 0x07; 601 value = 0x07;
599 Et_RegWrite(dev, ET_REG25, &value, 1); 602 reg_w(dev, ET_REG25, &value, 1);
600 /* colors setting */ 603 /* colors setting */
601 value = 0x80; 604 value = 0x80;
602 Et_RegWrite(dev, ET_G_RED, &value, 1); 605 reg_w(dev, ET_G_RED, &value, 1);
603 value = 0x80; 606 value = 0x80;
604 Et_RegWrite(dev, ET_G_GREEN1, &value, 1); 607 reg_w(dev, ET_G_GREEN1, &value, 1);
605 value = 0x80; 608 value = 0x80;
606 Et_RegWrite(dev, ET_G_BLUE, &value, 1); 609 reg_w(dev, ET_G_BLUE, &value, 1);
607 value = 0x80; 610 value = 0x80;
608 Et_RegWrite(dev, ET_G_GREEN2, &value, 1); 611 reg_w(dev, ET_G_GREEN2, &value, 1);
609 value = 0x00; 612 value = 0x00;
610 Et_RegWrite(dev, ET_G_GR_H, &value, 1); 613 reg_w(dev, ET_G_GR_H, &value, 1);
611 value = 0x00; 614 value = 0x00;
612 Et_RegWrite(dev, ET_G_GB_H, &value, 1); 615 reg_w(dev, ET_G_GB_H, &value, 1);
613 /* Window control registers */ 616 /* Window control registers */
614 value = 0xf0; 617 value = 0xf0;
615 Et_RegWrite(dev, ET_SYNCHRO, &value, 1); 618 reg_w(dev, ET_SYNCHRO, &value, 1);
616 value = 0x56; /* 0x56 */ 619 value = 0x56; /* 0x56 */
617 Et_RegWrite(dev, ET_STARTX, &value, 1); 620 reg_w(dev, ET_STARTX, &value, 1);
618 value = 0x05; /* 0x04 */ 621 value = 0x05; /* 0x04 */
619 Et_RegWrite(dev, ET_STARTY, &value, 1); 622 reg_w(dev, ET_STARTY, &value, 1);
620 value = 0x60; 623 value = 0x60;
621 Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1); 624 reg_w(dev, ET_WIDTH_LOW, &value, 1);
622 value = 0x20; 625 value = 0x20;
623 Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1); 626 reg_w(dev, ET_HEIGTH_LOW, &value, 1);
624 value = 0x50; 627 value = 0x50;
625 Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1); 628 reg_w(dev, ET_W_H_HEIGTH, &value, 1);
626 value = 0x86; 629 value = 0x86;
627 Et_RegWrite(dev, ET_REG6e, &value, 1); 630 reg_w(dev, ET_REG6e, &value, 1);
628 value = 0x01; 631 value = 0x01;
629 Et_RegWrite(dev, ET_REG6f, &value, 1); 632 reg_w(dev, ET_REG6f, &value, 1);
630 value = 0x86; 633 value = 0x86;
631 Et_RegWrite(dev, ET_REG70, &value, 1); 634 reg_w(dev, ET_REG70, &value, 1);
632 value = 0x14; 635 value = 0x14;
633 Et_RegWrite(dev, ET_REG71, &value, 1); 636 reg_w(dev, ET_REG71, &value, 1);
634 value = 0x00; 637 value = 0x00;
635 Et_RegWrite(dev, ET_REG72, &value, 1); 638 reg_w(dev, ET_REG72, &value, 1);
636 /* Clock Pattern registers */ 639 /* Clock Pattern registers */
637 value = 0x00; 640 value = 0x00;
638 Et_RegWrite(dev, ET_REG73, &value, 1); 641 reg_w(dev, ET_REG73, &value, 1);
639 value = 0x00; 642 value = 0x00;
640 Et_RegWrite(dev, ET_REG74, &value, 1); 643 reg_w(dev, ET_REG74, &value, 1);
641 value = 0x0a; 644 value = 0x0a;
642 Et_RegWrite(dev, ET_REG75, &value, 1); 645 reg_w(dev, ET_REG75, &value, 1);
643 value = 0x04; 646 value = 0x04;
644 Et_RegWrite(dev, ET_I2C_CLK, &value, 1); 647 reg_w(dev, ET_I2C_CLK, &value, 1);
645 value = 0x01; 648 value = 0x01;
646 Et_RegWrite(dev, ET_PXL_CLK, &value, 1); 649 reg_w(dev, ET_PXL_CLK, &value, 1);
647 /* set the sensor */ 650 /* set the sensor */
648 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { 651 if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
649 I2c0[0] = 0x06; 652 I2c0[0] = 0x06;
@@ -679,7 +682,7 @@ static void Et_init1(struct gspca_dev *gspca_dev)
679 /* magnetude and sign bit for DAC */ 682 /* magnetude and sign bit for DAC */
680 Et_i2cwrite(dev, PAS106_REG7, I2c4, sizeof I2c4, 1); 683 Et_i2cwrite(dev, PAS106_REG7, I2c4, sizeof I2c4, 1);
681 /* now set by fifo the whole colors setting */ 684 /* now set by fifo the whole colors setting */
682 Et_RegWrite(dev, ET_G_RED, GainRGBG, 6); 685 reg_w(dev, ET_G_RED, GainRGBG, 6);
683 getcolors(gspca_dev); 686 getcolors(gspca_dev);
684 setcolors(gspca_dev); 687 setcolors(gspca_dev);
685} 688}
@@ -738,7 +741,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
738 else 741 else
739 Et_init2(gspca_dev); 742 Et_init2(gspca_dev);
740 value = 0x08; 743 value = 0x08;
741 Et_RegWrite(dev, ET_RESET_ALL, &value, 1); 744 reg_w(dev, ET_RESET_ALL, &value, 1);
742 err = Et_videoOff(dev); 745 err = Et_videoOff(dev);
743 PDEBUG(D_STREAM, "Et_Init_VideoOff %d", err); 746 PDEBUG(D_STREAM, "Et_Init_VideoOff %d", err);
744 return 0; 747 return 0;
@@ -758,7 +761,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
758 Et_init2(gspca_dev); 761 Et_init2(gspca_dev);
759 762
760 value = 0x08; 763 value = 0x08;
761 Et_RegWrite(dev, ET_RESET_ALL, &value, 1); 764 reg_w(dev, ET_RESET_ALL, &value, 1);
762 err = Et_videoOn(dev); 765 err = Et_videoOn(dev);
763 PDEBUG(D_STREAM, "Et_VideoOn %d", err); 766 PDEBUG(D_STREAM, "Et_VideoOn %d", err);
764} 767}
@@ -787,7 +790,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
787 __u8 brightness = sd->brightness; 790 __u8 brightness = sd->brightness;
788 791
789 for (i = 0; i < 4; i++) 792 for (i = 0; i < 4; i++)
790 Et_RegWrite(gspca_dev->dev, (ET_O_RED + i), &brightness, 1); 793 reg_w(gspca_dev->dev, (ET_O_RED + i), &brightness, 1);
791} 794}
792 795
793static void getbrightness(struct gspca_dev *gspca_dev) 796static void getbrightness(struct gspca_dev *gspca_dev)
@@ -798,7 +801,7 @@ static void getbrightness(struct gspca_dev *gspca_dev)
798 __u8 value = 0; 801 __u8 value = 0;
799 802
800 for (i = 0; i < 4; i++) { 803 for (i = 0; i < 4; i++) {
801 Et_RegRead(gspca_dev->dev, (ET_O_RED + i), &value, 1); 804 reg_r(gspca_dev->dev, (ET_O_RED + i), &value, 1);
802 brightness += value; 805 brightness += value;
803 } 806 }
804 sd->brightness = brightness >> 3; 807 sd->brightness = brightness >> 3;
@@ -811,7 +814,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
811 __u8 contrast = sd->contrast; 814 __u8 contrast = sd->contrast;
812 815
813 memset(RGBG, contrast, sizeof RGBG - 2); 816 memset(RGBG, contrast, sizeof RGBG - 2);
814 Et_RegWrite(gspca_dev->dev, ET_G_RED, RGBG, 6); 817 reg_w(gspca_dev->dev, ET_G_RED, RGBG, 6);
815} 818}
816 819
817static void getcontrast(struct gspca_dev *gspca_dev) 820static void getcontrast(struct gspca_dev *gspca_dev)
@@ -822,7 +825,7 @@ static void getcontrast(struct gspca_dev *gspca_dev)
822 __u8 value = 0; 825 __u8 value = 0;
823 826
824 for (i = 0; i < 4; i++) { 827 for (i = 0; i < 4; i++) {
825 Et_RegRead(gspca_dev->dev, (ET_G_RED + i), &value, 1); 828 reg_r(gspca_dev->dev, (ET_G_RED + i), &value, 1);
826 contrast += value; 829 contrast += value;
827 } 830 }
828 sd->contrast = contrast >> 2; 831 sd->contrast = contrast >> 2;
@@ -870,7 +873,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
870 __u8 r, g, b; 873 __u8 r, g, b;
871 874
872 Gbright = Et_getgainG(gspca_dev); 875 Gbright = Et_getgainG(gspca_dev);
873 Et_RegRead(dev, ET_LUMA_CENTER, GRBG, 4); 876 reg_r(dev, ET_LUMA_CENTER, GRBG, 4);
874 g = (GRBG[0] + GRBG[3]) >> 1; 877 g = (GRBG[0] + GRBG[3]) >> 1;
875 r = GRBG[1]; 878 r = GRBG[1];
876 b = GRBG[2]; 879 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 {
79}; 79};
80 80
81static int pcam_reg_write(struct usb_device *dev, 81static int pcam_reg_write(struct usb_device *dev,
82 __u16 index, unsigned char *value, int length) 82 __u16 index, __u8 *value, int len)
83{ 83{
84 int rc; 84 int rc;
85 85
86 rc = usb_control_msg(dev, 86 rc = usb_control_msg(dev,
87 usb_sndbulkpipe(dev, 4), 87 usb_sndbulkpipe(dev, 4),
88 0x12, 88 0x12,
89/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */ 89/* ?? 0xc8 = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_??? !? */
90 0xc8, 90 0xc8,
91 0, /* value */ 91 0, /* value */
92 index, value, length, 500); 92 index, value, len, 500);
93 PDEBUG(D_USBO, "reg write: 0x%02X , result = 0x%x", index, rc);
94
95 if (rc < 0) 93 if (rc < 0)
96 PDEBUG(D_ERR, "reg write: error %d", rc); 94 PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc);
97 return rc; 95 return rc;
98} 96}
99 97
100static void MISensor_BulkWrite(struct usb_device *dev, unsigned short *pch, 98static void MISensor_BulkWrite(struct usb_device *dev,
101 char Address) 99 unsigned short *pch,
100 char Address)
102{ 101{
103 int result; 102 __u8 data[6];
104 unsigned char data[6];
105 103
106 data[0] = 0x1f; 104 data[0] = 0x1f;
107 data[1] = 0; 105 data[1] = 0; /* control byte */
108 data[2] = Address; 106 data[2] = Address;
109 data[3] = *pch >> 8; /* high byte */ 107 data[3] = *pch >> 8; /* high byte */
110 data[4] = *pch; /* low byte */ 108 data[4] = *pch; /* low byte */
111 data[5] = 0;
112
113 result = usb_control_msg(dev,
114 usb_sndbulkpipe(dev, 4),
115 0x12,
116/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */
117 0xc8,
118 0, /* value */
119 Address, /* index */
120 data, 5, 500);
121 PDEBUG(D_USBO, "bulk write 0x%02x = 0x%04x", Address, *pch);
122 109
123 if (result < 0) 110 pcam_reg_write(dev, Address, data, 5);
124 PDEBUG(D_ERR, "reg write: error %d", result);
125} 111}
126 112
127/* this function is called at probe time */ 113/* this function is called at probe time */
@@ -167,7 +153,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
167 data[0] = 0x01; /* address */ 153 data[0] = 0x01; /* address */
168 data[1] = 0x01; 154 data[1] = 0x01;
169 155
170 err_code = pcam_reg_write(dev, data[0], data, 0x02); 156 err_code = pcam_reg_write(dev, data[0], data, 2);
171 if (err_code < 0) 157 if (err_code < 0)
172 return; 158 return;
173 159
@@ -193,14 +179,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
193 data[10] = 0x5d; /* reg 9, I2C device address 179 data[10] = 0x5d; /* reg 9, I2C device address
194 * [for PAS5101 (0x40)] [for MI (0x5d)] */ 180 * [for PAS5101 (0x40)] [for MI (0x5d)] */
195 181
196 err_code = pcam_reg_write(dev, data[0], data, 0x0b); 182 err_code = pcam_reg_write(dev, data[0], data, 11);
197 if (err_code < 0) 183 if (err_code < 0)
198 return; 184 return;
199 185
200 data[0] = 0x23; /* address */ 186 data[0] = 0x23; /* address */
201 data[1] = 0x09; /* reg 35, append frame header */ 187 data[1] = 0x09; /* reg 35, append frame header */
202 188
203 err_code = pcam_reg_write(dev, data[0], data, 0x02); 189 err_code = pcam_reg_write(dev, data[0], data, 2);
204 if (err_code < 0) { 190 if (err_code < 0) {
205 PDEBUG(D_ERR, "Register write failed"); 191 PDEBUG(D_ERR, "Register write failed");
206 return; 192 return;
@@ -213,7 +199,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
213/* else */ 199/* else */
214 data[1] = 50; /* 50 reg 60, pc-cam frame size 200 data[1] = 50; /* 50 reg 60, pc-cam frame size
215 * (unit: 4KB) 200KB */ 201 * (unit: 4KB) 200KB */
216 err_code = pcam_reg_write(dev, data[0], data, 0x02); 202 err_code = pcam_reg_write(dev, data[0], data, 2);
217 if (err_code < 0) 203 if (err_code < 0)
218 return; 204 return;
219 205
@@ -255,13 +241,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
255 /* auto dark-gain */ 241 /* auto dark-gain */
256 data[0] = 0x5e; /* address */ 242 data[0] = 0x5e; /* address */
257 243
258 err_code = pcam_reg_write(dev, data[0], data, 0x06); 244 err_code = pcam_reg_write(dev, data[0], data, 6);
259 if (err_code < 0) 245 if (err_code < 0)
260 return; 246 return;
261 247
262 data[0] = 0x67; 248 data[0] = 0x67;
263 data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */ 249 data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */
264 err_code = pcam_reg_write(dev, data[0], data, 0x02); 250 err_code = pcam_reg_write(dev, data[0], data, 2);
265 if (err_code < 0) 251 if (err_code < 0)
266 return; 252 return;
267 253
@@ -340,7 +326,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
340 326
341 data[0] = 0x00; 327 data[0] = 0x00;
342 data[1] = 0x4d; /* ISOC transfering enable... */ 328 data[1] = 0x4d; /* ISOC transfering enable... */
343 pcam_reg_write(dev, data[0], data, 0x02); 329 pcam_reg_write(dev, data[0], data, 2);
344} 330}
345 331
346static void sd_stopN(struct gspca_dev *gspca_dev) 332static 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 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
27static const char version[] = "2.1.0"; 27static const char version[] = "2.1.3";
28 28
29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); 29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
30MODULE_DESCRIPTION("Pixart PAC7311"); 30MODULE_DESCRIPTION("Pixart PAC7311");
@@ -195,16 +195,18 @@ const unsigned char pac7311_jpeg_header[] = {
195}; 195};
196 196
197static void reg_w(struct usb_device *dev, 197static void reg_w(struct usb_device *dev,
198 __u16 req,
199 __u16 value,
200 __u16 index, 198 __u16 index,
201 __u8 *buffer, __u16 length) 199 char *buffer, __u16 len)
202{ 200{
201 __u8 tmpbuf[8];
202
203 memcpy(tmpbuf, buffer, len);
203 usb_control_msg(dev, 204 usb_control_msg(dev,
204 usb_sndctrlpipe(dev, 0), 205 usb_sndctrlpipe(dev, 0),
205 req, 206 1, /* request */
206 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 207 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
207 value, index, buffer, length, 208 0, /* value */
209 index, tmpbuf, len,
208 500); 210 500);
209} 211}
210 212
@@ -227,7 +229,12 @@ static void pac7311_reg_write(struct usb_device *dev,
227 __u8 buf; 229 __u8 buf;
228 230
229 buf = value; 231 buf = value;
230 reg_w(dev, 0x00, value, index, &buf, 1); 232 usb_control_msg(dev,
233 usb_sndctrlpipe(dev, 0),
234 0, /* request */
235 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
236 value, index, &buf, 1,
237 500);
231} 238}
232 239
233/* this function is called at probe time */ 240/* this function is called at probe time */
@@ -313,26 +320,26 @@ static void sd_start(struct gspca_dev *gspca_dev)
313 struct sd *sd = (struct sd *) gspca_dev; 320 struct sd *sd = (struct sd *) gspca_dev;
314 321
315 pac7311_reg_write(dev, 0xff, 0x01); 322 pac7311_reg_write(dev, 0xff, 0x01);
316 reg_w(dev, 0x01, 0, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); 323 reg_w(dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
317 reg_w(dev, 0x01, 0, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); 324 reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
318 reg_w(dev, 0x01, 0, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); 325 reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
319 reg_w(dev, 0x01, 0, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); 326 reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
320 reg_w(dev, 0x01, 0, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); 327 reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
321 reg_w(dev, 0x01, 0, 0x002a, "\x00\x00\x00", 3); 328 reg_w(dev, 0x002a, "\x00\x00\x00", 3);
322 reg_w(dev, 0x01, 0, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); 329 reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
323 reg_w(dev, 0x01, 0, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); 330 reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
324 reg_w(dev, 0x01, 0, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); 331 reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
325 reg_w(dev, 0x01, 0, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); 332 reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
326 reg_w(dev, 0x01, 0, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); 333 reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
327 reg_w(dev, 0x01, 0, 0x0066, "\xd0\xff", 2); 334 reg_w(dev, 0x0066, "\xd0\xff", 2);
328 reg_w(dev, 0x01, 0, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); 335 reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
329 reg_w(dev, 0x01, 0, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); 336 reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
330 reg_w(dev, 0x01, 0, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); 337 reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
331 reg_w(dev, 0x01, 0, 0x008f, "\x18\x20", 2); 338 reg_w(dev, 0x008f, "\x18\x20", 2);
332 reg_w(dev, 0x01, 0, 0x0096, "\x01\x08\x04", 3); 339 reg_w(dev, 0x0096, "\x01\x08\x04", 3);
333 reg_w(dev, 0x01, 0, 0x00a0, "\x44\x44\x44\x04", 4); 340 reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4);
334 reg_w(dev, 0x01, 0, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); 341 reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
335 reg_w(dev, 0x01, 0, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); 342 reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
336 343
337 pac7311_reg_write(dev, 0xff, 0x04); 344 pac7311_reg_write(dev, 0xff, 0x04);
338 pac7311_reg_write(dev, 0x02, 0x04); 345 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,
334static void reg_w(struct usb_device *dev, 334static void reg_w(struct usb_device *dev,
335 __u16 value, 335 __u16 value,
336 const __u8 *buffer, 336 const __u8 *buffer,
337 __u16 len) 337 int len)
338{ 338{
339 __u8 tmpbuf[32]; 339 __u8 tmpbuf[32];
340 340
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 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
28static const char version[] = "2.1.0"; 28static const char version[] = "2.1.3";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
@@ -515,15 +515,24 @@ static void reg_r(struct usb_device *dev,
515 515
516static void reg_w(struct usb_device *dev, 516static void reg_w(struct usb_device *dev,
517 __u16 value, 517 __u16 value,
518 __u8 *buffer, 518 const __u8 *buffer,
519 int len) 519 int len)
520{ 520{
521 __u8 tmpbuf[64];
522
523#ifdef CONFIG_VIDEO_ADV_DEBUG
524 if (len > sizeof tmpbuf) {
525 PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
526 return;
527 }
528#endif
529 memcpy(tmpbuf, buffer, len);
521 usb_control_msg(dev, 530 usb_control_msg(dev,
522 usb_sndctrlpipe(dev, 0), 531 usb_sndctrlpipe(dev, 0),
523 0x08, 532 0x08,
524 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 533 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
525 value, 0, 534 value, 0,
526 buffer, len, 535 tmpbuf, len,
527 500); 536 500);
528} 537}
529 538
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,
377 ret = usb_control_msg(dev, 377 ret = usb_control_msg(dev,
378 usb_sndctrlpipe(dev, 0), 378 usb_sndctrlpipe(dev, 0),
379 req, 379 req,
380 USB_TYPE_VENDOR | USB_RECIP_DEVICE, 380 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
381 value, index, NULL, 0, 500); 381 value, index, NULL, 0, 500);
382 PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x", 382 PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x",
383 index, value, ret); 383 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,
456 ret = usb_control_msg(dev, 456 ret = usb_control_msg(dev,
457 usb_sndctrlpipe(dev, 0), 457 usb_sndctrlpipe(dev, 0),
458 req, 458 req,
459 USB_TYPE_VENDOR | USB_RECIP_DEVICE, 459 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
460 value, index, NULL, 0, 500); 460 value, index, NULL, 0, 500);
461 PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x", 461 PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x",
462 req, index, value, ret); 462 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 @@
26 26
27#define MODULE_NAME "t613" 27#define MODULE_NAME "t613"
28#include "gspca.h" 28#include "gspca.h"
29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
30static const char version[] = "2.1.0"; 30static const char version[] = "2.1.3";
31 31
32struct control_menu_info { 32struct control_menu_info {
33 int value; 33 int value;
@@ -366,13 +366,22 @@ static void t16RegRead(struct usb_device *dev,
366 366
367static void t16RegWrite(struct usb_device *dev, 367static void t16RegWrite(struct usb_device *dev,
368 __u16 value, 368 __u16 value,
369 __u16 index, __u8 *buffer, __u16 length) 369 __u16 index, __u8 *buffer, __u16 len)
370{ 370{
371 __u8 tmpbuf[70];
372
373#ifdef CONFIG_VIDEO_ADV_DEBUG
374 if (len > sizeof tmpbuf) {
375 PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
376 return;
377 }
378#endif
379 memcpy(tmpbuf, buffer, len);
371 usb_control_msg(dev, 380 usb_control_msg(dev,
372 usb_sndctrlpipe(dev, 0), 381 usb_sndctrlpipe(dev, 0),
373 0, /* request */ 382 0, /* request */
374 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 383 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
375 value, index, buffer, length, 500); 384 value, index, tmpbuf, len, 500);
376} 385}
377 386
378/* this function is called at probe time */ 387/* this function is called at probe time */
@@ -491,24 +500,24 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
491 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); 500 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
492 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); 501 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
493 t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0); 502 t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0);
494 t16RegWrite(dev, 0x01, 00, nset5, 0x04); 503 t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
495 t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0); 504 t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0);
496 t16RegWrite(dev, 0x01, 00, nset6, 0x22); 505 t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
497 t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0); 506 t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0);
498 t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0); 507 t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0);
499 508
500 t16RegWrite(dev, 0x01, 00, missing, 0x08); 509 t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
501 510
502 t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0); 511 t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
503 t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0); 512 t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
504 t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0); 513 t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
505 514
506 t16RegWrite(dev, 0x01, 00, nset7, 0x4); 515 t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
507 t16RegWrite(dev, 0x01, 00, nset10, 0x06); 516 t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
508 t16RegWrite(dev, 0x01, 00, nset8, 0x06); 517 t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
509 t16RegWrite(dev, 0x01, 00, nset9, 0x04); 518 t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
510 519
511 t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x0); 520 t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x00);
512 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); 521 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
513 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); 522 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
514 t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); 523 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)
192 datacmd = 0xb0;; 192 datacmd = 0xb0;;
193 reg_w(dev, TV8532_GPIO, &datacmd, 1); 193 reg_w(dev, TV8532_GPIO, &datacmd, 1);
194 datacmd = TV8532_CMD_EEprom_Open; 194 datacmd = TV8532_CMD_EEprom_Open;
195 reg_w(dev, TV8532_CTRL, &datacmd, 195 reg_w(dev, TV8532_CTRL, &datacmd, 1);
196 1);
197/* msleep(1); */ 196/* msleep(1); */
198 while (tv_8532_eeprom_data[i]) { 197 while (tv_8532_eeprom_data[i]) {
199 reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24; 198 reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24;
@@ -390,8 +389,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
390 tv_8532_setReg(gspca_dev); 389 tv_8532_setReg(gspca_dev);
391 /*************************************************/ 390 /*************************************************/
392 data = 0x0b; 391 data = 0x0b;
393 reg_w(dev, TV8532_GPIO_OE, &data, 392 reg_w(dev, TV8532_GPIO_OE, &data, 1);
394 1);
395 /*************************************************/ 393 /*************************************************/
396 tv_8532_setReg(gspca_dev); 394 tv_8532_setReg(gspca_dev);
397 /*************************************************/ 395 /*************************************************/
@@ -417,8 +415,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
417static void sd_start(struct gspca_dev *gspca_dev) 415static void sd_start(struct gspca_dev *gspca_dev)
418{ 416{
419 struct usb_device *dev = gspca_dev->dev; 417 struct usb_device *dev = gspca_dev->dev;
420 __u8 data = 0; 418 __u8 data;
421 __u8 dataStart = 0;
422 __u8 value[2]; 419 __u8 value[2];
423 420
424 data = 0x32; 421 data = 0x32;
@@ -459,8 +456,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
459 reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */ 456 reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */
460 data = TESTPTH; /* 0x04; */ 457 data = TESTPTH; /* 0x04; */
461 reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */ 458 reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */
462 dataStart = TESTPTBL; /* 0x04; */ 459 data = TESTPTBL; /* 0x04; */
463 reg_w(dev, TV8532_POINTB_L, &dataStart, 1); /* 0x2f */ 460 reg_w(dev, TV8532_POINTB_L, &data, 1); /* 0x2f */
464 data = TESTPTBH; /* 0x04; */ 461 data = TESTPTBH; /* 0x04; */
465 reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */ 462 reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */
466 data = TV8532_CMD_UPDATE; 463 data = TV8532_CMD_UPDATE;