aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/t613.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/t613.c')
-rw-r--r--drivers/media/video/gspca/t613.c198
1 files changed, 103 insertions, 95 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index de43118dec7a..4e69a8e16357 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -26,13 +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, 3) 29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
30static const char version[] = "2.1.3"; 30static const char version[] = "2.1.4";
31
32struct control_menu_info {
33 int value;
34 char name[32];
35};
36 31
37#define MAX_GAMMA 0x10 /* 0 to 15 */ 32#define MAX_GAMMA 0x10 /* 0 to 15 */
38 33
@@ -227,19 +222,16 @@ static struct ctrl sd_ctrls[] = {
227 }, 222 },
228}; 223};
229 224
230static struct control_menu_info effects_control[] = { 225static char *effects_control[] = {
231 {0, "Normal"}, 226 "Normal",
232 {1, "Emboss"}, /* disabled */ 227 "Emboss", /* disabled */
233 {2, "Monochrome"}, 228 "Monochrome",
234 {3, "Sepia"}, 229 "Sepia",
235 {4, "Sketch"}, 230 "Sketch",
236 {5, "Sun Effect"}, /* disabled */ 231 "Sun Effect", /* disabled */
237 {6, "Negative"}, 232 "Negative",
238}; 233};
239 234
240#define NUM_EFFECTS_CONTROL \
241 (sizeof(effects_control)/sizeof(effects_control[0]))
242
243static struct cam_mode vga_mode_t16[] = { 235static struct cam_mode vga_mode_t16[] = {
244 {V4L2_PIX_FMT_JPEG, 160, 120, 4}, 236 {V4L2_PIX_FMT_JPEG, 160, 120, 4},
245 {V4L2_PIX_FMT_JPEG, 176, 144, 3}, 237 {V4L2_PIX_FMT_JPEG, 176, 144, 3},
@@ -252,7 +244,7 @@ static struct cam_mode vga_mode_t16[] = {
252#define MAX_EFFECTS 7 244#define MAX_EFFECTS 7
253/* easily done by soft, this table could be removed, 245/* easily done by soft, this table could be removed,
254 * i keep it here just in case */ 246 * i keep it here just in case */
255unsigned char effects_table[MAX_EFFECTS][6] = { 247static const __u8 effects_table[MAX_EFFECTS][6] = {
256 {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */ 248 {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */
257 {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */ 249 {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */
258 {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */ 250 {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */
@@ -262,7 +254,7 @@ unsigned char effects_table[MAX_EFFECTS][6] = {
262 {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */ 254 {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */
263}; 255};
264 256
265unsigned char gamma_table[MAX_GAMMA][34] = { 257static const __u8 gamma_table[MAX_GAMMA][34] = {
266 {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85, 258 {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85,
267 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9, 259 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9,
268 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb, 260 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb,
@@ -345,7 +337,7 @@ unsigned char gamma_table[MAX_GAMMA][34] = {
345 0xA0, 0xFF} 337 0xA0, 0xFF}
346}; 338};
347 339
348static __u8 tas5130a_sensor_init[][8] = { 340static const __u8 tas5130a_sensor_init[][8] = {
349 {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09}, 341 {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09},
350 {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09}, 342 {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09},
351 {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}, 343 {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
@@ -366,22 +358,41 @@ static void t16RegRead(struct usb_device *dev,
366 358
367static void t16RegWrite(struct usb_device *dev, 359static void t16RegWrite(struct usb_device *dev,
368 __u16 value, 360 __u16 value,
369 __u16 index, __u8 *buffer, __u16 len) 361 __u16 index,
362 const __u8 *buffer, __u16 len)
370{ 363{
371 __u8 tmpbuf[70]; 364 if (buffer == NULL) {
372 365 usb_control_msg(dev,
373#ifdef CONFIG_VIDEO_ADV_DEBUG 366 usb_sndctrlpipe(dev, 0),
374 if (len > sizeof tmpbuf) { 367 0,
375 PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); 368 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
369 value, index,
370 NULL, 0, 500);
376 return; 371 return;
377 } 372 }
378#endif 373 if (len < 16) {
379 memcpy(tmpbuf, buffer, len); 374 __u8 tmpbuf[16];
380 usb_control_msg(dev, 375
381 usb_sndctrlpipe(dev, 0), 376 memcpy(tmpbuf, buffer, len);
382 0, /* request */ 377 usb_control_msg(dev,
383 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 378 usb_sndctrlpipe(dev, 0),
384 value, index, tmpbuf, len, 500); 379 0,
380 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
381 value, index,
382 tmpbuf, len, 500);
383 } else {
384 __u8 *tmpbuf;
385
386 tmpbuf = kmalloc(len, GFP_KERNEL);
387 memcpy(tmpbuf, buffer, len);
388 usb_control_msg(dev,
389 usb_sndctrlpipe(dev, 0),
390 0,
391 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
392 value, index,
393 tmpbuf, len, 500);
394 kfree(tmpbuf);
395 }
385} 396}
386 397
387/* this function is called at probe time */ 398/* this function is called at probe time */
@@ -421,18 +432,18 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
421 int i = 0; 432 int i = 0;
422 __u8 test_byte; 433 __u8 test_byte;
423 434
424 static unsigned char read_indexs[] = 435 static const __u8 read_indexs[] =
425 { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, 436 { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5,
426 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 }; 437 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 };
427 static unsigned char n1[6] = 438 static const __u8 n1[6] =
428 {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; 439 {0x08, 0x03, 0x09, 0x03, 0x12, 0x04};
429 static unsigned char n2[2] = 440 static const __u8 n2[2] =
430 {0x08, 0x00}; 441 {0x08, 0x00};
431 static unsigned char nset[6] = 442 static const __u8 nset[6] =
432 { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 }; 443 { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 };
433 static unsigned char n3[6] = 444 static const __u8 n3[6] =
434 {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04}; 445 {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04};
435 static unsigned char n4[0x46] = 446 static const __u8 n4[0x46] =
436 {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c, 447 {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
437 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68, 448 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
438 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1, 449 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
@@ -442,40 +453,40 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
442 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68, 453 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68,
443 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40, 454 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
444 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46}; 455 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46};
445 static unsigned char nset4[18] = { 456 static const __u8 nset4[18] = {
446 0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8, 457 0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8,
447 0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8, 458 0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8,
448 0xe8, 0xe0 459 0xe8, 0xe0
449 }; 460 };
450 /* ojo puede ser 0xe6 en vez de 0xe9 */ 461 /* ojo puede ser 0xe6 en vez de 0xe9 */
451 static unsigned char nset2[20] = { 462 static const __u8 nset2[20] = {
452 0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb, 463 0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb,
453 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27, 464 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
454 0xd8, 0xc8, 0xd9, 0xfc 465 0xd8, 0xc8, 0xd9, 0xfc
455 }; 466 };
456 static unsigned char missing[8] = 467 static const __u8 missing[8] =
457 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; 468 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
458 static unsigned char nset3[18] = { 469 static const __u8 nset3[18] = {
459 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8, 470 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
460 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8, 471 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
461 0xcf, 0xe0 472 0xcf, 0xe0
462 }; 473 };
463 static unsigned char nset5[4] = 474 static const __u8 nset5[4] =
464 { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */ 475 { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */
465 static unsigned char nset6[34] = { 476 static const __u8 nset6[34] = {
466 0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54, 477 0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54,
467 0x95, 0x65, 0x96, 0x75, 0x97, 0x84, 478 0x95, 0x65, 0x96, 0x75, 0x97, 0x84,
468 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca, 479 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca,
469 0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2, 480 0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2,
470 0xa0, 0xff 481 0xa0, 0xff
471 }; /* Gamma */ 482 }; /* Gamma */
472 static unsigned char nset7[4] = 483 static const __u8 nset7[4] =
473 { 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */ 484 { 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */
474 static unsigned char nset9[4] = 485 static const __u8 nset9[4] =
475 { 0x0b, 0x04, 0x0a, 0x78 }; 486 { 0x0b, 0x04, 0x0a, 0x78 };
476 static unsigned char nset8[6] = 487 static const __u8 nset8[6] =
477 { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 }; 488 { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 };
478 static unsigned char nset10[6] = 489 static const __u8 nset10[6] =
479 { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; 490 { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 };
480 491
481 t16RegWrite(dev, 0x01, 0x0000, n1, 0x06); 492 t16RegWrite(dev, 0x01, 0x0000, n1, 0x06);
@@ -493,31 +504,31 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
493 t16RegWrite(dev, 0x01, 0x0000, n3, 0x06); 504 t16RegWrite(dev, 0x01, 0x0000, n3, 0x06);
494 t16RegWrite(dev, 0x01, 0x0000, n4, 0x46); 505 t16RegWrite(dev, 0x01, 0x0000, n4, 0x46);
495 t16RegRead(dev, 0x0080, &test_byte, 1); 506 t16RegRead(dev, 0x0080, &test_byte, 1);
496 t16RegWrite(dev, 0x00, 0x2c80, 0x00, 0x0); 507 t16RegWrite(dev, 0x00, 0x2c80, NULL, 0x0);
497 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); 508 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
498 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); 509 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
499 t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); 510 t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
500 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); 511 t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0);
501 t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); 512 t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0);
502 t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0); 513 t16RegWrite(dev, 0x00, 0x338e, NULL, 0x0);
503 t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04); 514 t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
504 t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0); 515 t16RegWrite(dev, 0x00, 0x00a9, NULL, 0x0);
505 t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22); 516 t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
506 t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0); 517 t16RegWrite(dev, 0x00, 0x86bb, NULL, 0x0);
507 t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0); 518 t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x0);
508 519
509 t16RegWrite(dev, 0x01, 0x0000, missing, 0x08); 520 t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
510 521
511 t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0); 522 t16RegWrite(dev, 0x00, 0x2087, NULL, 0x0);
512 t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0); 523 t16RegWrite(dev, 0x00, 0x2088, NULL, 0x0);
513 t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0); 524 t16RegWrite(dev, 0x00, 0x2089, NULL, 0x0);
514 525
515 t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04); 526 t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
516 t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06); 527 t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
517 t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06); 528 t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
518 t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04); 529 t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
519 530
520 t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x00); 531 t16RegWrite(dev, 0x00, 0x2880, NULL, 0x00);
521 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); 532 t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
522 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); 533 t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
523 t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); 534 t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
@@ -530,7 +541,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
530 struct sd *sd = (struct sd *) gspca_dev; 541 struct sd *sd = (struct sd *) gspca_dev;
531 struct usb_device *dev = gspca_dev->dev; 542 struct usb_device *dev = gspca_dev->dev;
532 unsigned int brightness; 543 unsigned int brightness;
533 unsigned char set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; 544 __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
534 brightness = sd->brightness; 545 brightness = sd->brightness;
535 546
536 if (brightness < 7) { 547 if (brightness < 7) {
@@ -548,7 +559,7 @@ static void setflip(struct gspca_dev *gspca_dev)
548 struct sd *sd = (struct sd *) gspca_dev; 559 struct sd *sd = (struct sd *) gspca_dev;
549 struct usb_device *dev = gspca_dev->dev; 560 struct usb_device *dev = gspca_dev->dev;
550 561
551 unsigned char flipcmd[8] = 562 __u8 flipcmd[8] =
552 { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; 563 { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 };
553 564
554 if (sd->mirror == 1) 565 if (sd->mirror == 1)
@@ -570,9 +581,9 @@ static void seteffect(struct gspca_dev *gspca_dev)
570 } 581 }
571 582
572 if (sd->effect == 1 || sd->effect == 4) 583 if (sd->effect == 1 || sd->effect == 4)
573 t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x00); 584 t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x00);
574 else 585 else
575 t16RegWrite(dev, 0x00, 0xfaa6, 0x00, 0x00); 586 t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0x00);
576} 587}
577 588
578static void setwhitebalance(struct gspca_dev *gspca_dev) 589static void setwhitebalance(struct gspca_dev *gspca_dev)
@@ -580,7 +591,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev)
580 struct sd *sd = (struct sd *) gspca_dev; 591 struct sd *sd = (struct sd *) gspca_dev;
581 struct usb_device *dev = gspca_dev->dev; 592 struct usb_device *dev = gspca_dev->dev;
582 593
583 unsigned char white_balance[8] = 594 __u8 white_balance[8] =
584 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; 595 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
585 596
586 if (sd->whitebalance == 1) 597 if (sd->whitebalance == 1)
@@ -613,18 +624,17 @@ static void setcontrast(struct gspca_dev *gspca_dev)
613 else 624 else
614 reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); 625 reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
615 626
616 t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0); 627 t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
617
618} 628}
619 629
620static void setcolors(struct gspca_dev *gspca_dev) 630static void setcolors(struct gspca_dev *gspca_dev)
621{ 631{
622 struct sd *sd = (struct sd *) gspca_dev; 632 struct sd *sd = (struct sd *) gspca_dev;
623 struct usb_device *dev = gspca_dev->dev; 633 struct usb_device *dev = gspca_dev->dev;
624 __u16 reg_to_write = 0x00; 634 __u16 reg_to_write;
625 635
626 reg_to_write = 0xc0bb + sd->colors * 0x100; 636 reg_to_write = 0xc0bb + sd->colors * 0x100;
627 t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0); 637 t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
628} 638}
629 639
630static void setgamma(struct gspca_dev *gspca_dev) 640static void setgamma(struct gspca_dev *gspca_dev)
@@ -635,11 +645,11 @@ static void setsharpness(struct gspca_dev *gspca_dev)
635{ 645{
636 struct sd *sd = (struct sd *) gspca_dev; 646 struct sd *sd = (struct sd *) gspca_dev;
637 struct usb_device *dev = gspca_dev->dev; 647 struct usb_device *dev = gspca_dev->dev;
638 __u16 reg_to_write = 0x00; 648 __u16 reg_to_write;
639 649
640 reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; 650 reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
641 651
642 t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0x00); 652 t16RegWrite(dev, 0x00, reg_to_write, NULL, 0x00);
643} 653}
644 654
645static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) 655static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@@ -655,6 +665,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
655static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) 665static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
656{ 666{
657 struct sd *sd = (struct sd *) gspca_dev; 667 struct sd *sd = (struct sd *) gspca_dev;
668
658 *val = sd->brightness; 669 *val = sd->brightness;
659 return *val; 670 return *val;
660} 671}
@@ -677,7 +688,6 @@ static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
677 return *val; 688 return *val;
678} 689}
679 690
680
681static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val) 691static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val)
682{ 692{
683 struct sd *sd = (struct sd *) gspca_dev; 693 struct sd *sd = (struct sd *) gspca_dev;
@@ -811,9 +821,9 @@ static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val)
811 821
812 sd->autogain = val; 822 sd->autogain = val;
813 if (val != 0) 823 if (val != 0)
814 t16RegWrite(dev, 0x00, 0xf48e, 0x00, 0); 824 t16RegWrite(dev, 0x00, 0xf48e, NULL, 0);
815 else 825 else
816 t16RegWrite(dev, 0x00, 0xb48e, 0x00, 0); 826 t16RegWrite(dev, 0x00, 0xb48e, NULL, 0);
817 return 0; 827 return 0;
818} 828}
819 829
@@ -831,12 +841,12 @@ static void sd_start(struct gspca_dev *gspca_dev)
831 int mode; 841 int mode;
832 __u8 test_byte; 842 __u8 test_byte;
833 843
834 static __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; 844 static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
835 __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; 845 __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 };
836 static __u8 t3[] = 846 static const __u8 t3[] =
837 { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06, 847 { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06,
838 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; 848 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
839 static __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; 849 static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
840 850
841 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode; 851 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode;
842 switch (mode) { 852 switch (mode) {
@@ -860,16 +870,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
860 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); 870 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8);
861 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); 871 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8);
862 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); 872 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
863 t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00); 873 t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00);
864 /* just in case and to keep sync with logs (for mine) */ 874 /* just in case and to keep sync with logs (for mine) */
865 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); 875 t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
866 t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00); 876 t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00);
867 /* just in case and to keep sync with logs (for mine) */ 877 /* just in case and to keep sync with logs (for mine) */
868 t16RegWrite(dev, 0x01, 0x0000, t1, 4); 878 t16RegWrite(dev, 0x01, 0x0000, t1, 4);
869 t16RegWrite(dev, 0x01, 0x0000, t2, 6); 879 t16RegWrite(dev, 0x01, 0x0000, t2, 6);
870 t16RegRead(dev, 0x0012, &test_byte, 0x1); 880 t16RegRead(dev, 0x0012, &test_byte, 0x1);
871 t16RegWrite(dev, 0x01, 0x0000, t3, 0x10); 881 t16RegWrite(dev, 0x01, 0x0000, t3, 0x10);
872 t16RegWrite(dev, 0x00, 0x0013, 0x00, 0x00); 882 t16RegWrite(dev, 0x00, 0x0013, NULL, 0x00);
873 t16RegWrite(dev, 0x01, 0x0000, t4, 0x4); 883 t16RegWrite(dev, 0x01, 0x0000, t4, 0x4);
874 /* restart on each start, just in case, sometimes regs goes wrong 884 /* restart on each start, just in case, sometimes regs goes wrong
875 * when using controls from app */ 885 * when using controls from app */
@@ -892,11 +902,11 @@ static void sd_close(struct gspca_dev *gspca_dev)
892 902
893static void sd_pkt_scan(struct gspca_dev *gspca_dev, 903static void sd_pkt_scan(struct gspca_dev *gspca_dev,
894 struct gspca_frame *frame, /* target */ 904 struct gspca_frame *frame, /* target */
895 unsigned char *data, /* isoc packet */ 905 __u8 *data, /* isoc packet */
896 int len) /* iso packet length */ 906 int len) /* iso packet length */
897{ 907{
898 int sof = 0; 908 int sof = 0;
899 static unsigned char ffd9[] = { 0xff, 0xd9 }; 909 static __u8 ffd9[] = { 0xff, 0xd9 };
900 910
901 if (data[0] == 0x5a) { 911 if (data[0] == 0x5a) {
902 /* Control Packet, after this came the header again, 912 /* Control Packet, after this came the header again,
@@ -935,27 +945,26 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
935static int sd_querymenu(struct gspca_dev *gspca_dev, 945static int sd_querymenu(struct gspca_dev *gspca_dev,
936 struct v4l2_querymenu *menu) 946 struct v4l2_querymenu *menu)
937{ 947{
938 memset(menu->name, 0, sizeof menu->name);
939
940 switch (menu->id) { 948 switch (menu->id) {
941 case V4L2_CID_POWER_LINE_FREQUENCY: 949 case V4L2_CID_POWER_LINE_FREQUENCY:
942 switch (menu->index) { 950 switch (menu->index) {
943 case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ 951 case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
944 strcpy(menu->name, "50 Hz"); 952 strcpy((char *) menu->name, "50 Hz");
945 return 0; 953 return 0;
946 case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ 954 case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
947 strcpy(menu->name, "60 Hz"); 955 strcpy((char *) menu->name, "60 Hz");
948 return 0; 956 return 0;
949 } 957 }
950 break; 958 break;
951 case V4L2_CID_EFFECTS: 959 case V4L2_CID_EFFECTS:
952 if (menu->index < 0 || menu->index >= NUM_EFFECTS_CONTROL) 960 if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
953 return -EINVAL; 961 strncpy((char *) menu->name,
954 strncpy((char *) menu->name, 962 effects_control[menu->index], 32);
955 effects_control[menu->index].name, 32); 963 return 0;
964 }
956 break; 965 break;
957 } 966 }
958 return 0; 967 return -EINVAL;
959} 968}
960 969
961/* this function is called at open time */ 970/* this function is called at open time */
@@ -966,7 +975,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
966} 975}
967 976
968/* sub-driver description */ 977/* sub-driver description */
969static struct sd_desc sd_desc = { 978static const struct sd_desc sd_desc = {
970 .name = MODULE_NAME, 979 .name = MODULE_NAME,
971 .ctrls = sd_ctrls, 980 .ctrls = sd_ctrls,
972 .nctrls = ARRAY_SIZE(sd_ctrls), 981 .nctrls = ARRAY_SIZE(sd_ctrls),
@@ -982,11 +991,10 @@ static struct sd_desc sd_desc = {
982 991
983/* -- module initialisation -- */ 992/* -- module initialisation -- */
984#define DVNM(name) .driver_info = (kernel_ulong_t) name 993#define DVNM(name) .driver_info = (kernel_ulong_t) name
985static __devinitdata struct usb_device_id device_table[] = { 994static const __devinitdata struct usb_device_id device_table[] = {
986 {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")}, 995 {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")},
987 {} 996 {}
988}; 997};
989
990MODULE_DEVICE_TABLE(usb, device_table); 998MODULE_DEVICE_TABLE(usb, device_table);
991 999
992/* -- device connect -- */ 1000/* -- device connect -- */