diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-07-14 08:38:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:26:14 -0400 |
commit | 739570bb218bb4607df1f197282561e97a98e54a (patch) | |
tree | 25555dfe5ac873bc96866c486d6f6c1dcabf24f4 /drivers/media/video/gspca/t613.c | |
parent | 5b77ae7776183d733ec86727bcc34c52a336afd6 (diff) |
V4L/DVB (8352): gspca: Buffers for USB exchanges cannot be in the stack.
gspca: Protect dq_callback() against simultaneous USB exchanges.
Temporary buffer for USB exchanges added in the device struct.
(all) Use a temporary buffer for all USB exchanges.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/t613.c')
-rw-r--r-- | drivers/media/video/gspca/t613.c | 176 |
1 files changed, 82 insertions, 94 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 299f84584e82..00f47e463a05 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, 5) | 29 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) |
30 | static const char version[] = "2.1.5"; | 30 | static const char version[] = "2.1.7"; |
31 | 31 | ||
32 | #define MAX_GAMMA 0x10 /* 0 to 15 */ | 32 | #define MAX_GAMMA 0x10 /* 0 to 15 */ |
33 | 33 | ||
@@ -365,48 +365,49 @@ static const __u8 tas5130a_sensor_init[][8] = { | |||
365 | {}, | 365 | {}, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | static void t16RegRead(struct usb_device *dev, | 368 | /* read 1 byte */ |
369 | __u16 index, __u8 *buffer, __u16 length) | 369 | static int reg_r_1(struct gspca_dev *gspca_dev, |
370 | __u16 index) | ||
370 | { | 371 | { |
371 | usb_control_msg(dev, | 372 | usb_control_msg(gspca_dev->dev, |
372 | usb_rcvctrlpipe(dev, 0), | 373 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
373 | 0, /* request */ | 374 | 0, /* request */ |
374 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 375 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
375 | 0, /* value */ | 376 | 0, /* value */ |
376 | index, buffer, length, 500); | 377 | index, |
378 | gspca_dev->usb_buf, 1, 500); | ||
379 | return gspca_dev->usb_buf[0]; | ||
377 | } | 380 | } |
378 | 381 | ||
379 | static void t16RegWrite(struct usb_device *dev, | 382 | static void reg_w(struct gspca_dev *gspca_dev, |
380 | __u16 value, | 383 | __u16 value, |
381 | __u16 index, | 384 | __u16 index, |
382 | const __u8 *buffer, __u16 len) | 385 | const __u8 *buffer, __u16 len) |
383 | { | 386 | { |
384 | if (buffer == NULL) { | 387 | if (buffer == NULL) { |
385 | usb_control_msg(dev, | 388 | usb_control_msg(gspca_dev->dev, |
386 | usb_sndctrlpipe(dev, 0), | 389 | usb_sndctrlpipe(gspca_dev->dev, 0), |
387 | 0, | 390 | 0, |
388 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | 391 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
389 | value, index, | 392 | value, index, |
390 | NULL, 0, 500); | 393 | NULL, 0, 500); |
391 | return; | 394 | return; |
392 | } | 395 | } |
393 | if (len < 16) { | 396 | if (len <= sizeof gspca_dev->usb_buf) { |
394 | __u8 tmpbuf[16]; | 397 | memcpy(gspca_dev->usb_buf, buffer, len); |
395 | 398 | usb_control_msg(gspca_dev->dev, | |
396 | memcpy(tmpbuf, buffer, len); | 399 | usb_sndctrlpipe(gspca_dev->dev, 0), |
397 | usb_control_msg(dev, | ||
398 | usb_sndctrlpipe(dev, 0), | ||
399 | 0, | 400 | 0, |
400 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | 401 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
401 | value, index, | 402 | value, index, |
402 | tmpbuf, len, 500); | 403 | gspca_dev->usb_buf, len, 500); |
403 | } else { | 404 | } else { |
404 | __u8 *tmpbuf; | 405 | __u8 *tmpbuf; |
405 | 406 | ||
406 | tmpbuf = kmalloc(len, GFP_KERNEL); | 407 | tmpbuf = kmalloc(len, GFP_KERNEL); |
407 | memcpy(tmpbuf, buffer, len); | 408 | memcpy(tmpbuf, buffer, len); |
408 | usb_control_msg(dev, | 409 | usb_control_msg(gspca_dev->dev, |
409 | usb_sndctrlpipe(dev, 0), | 410 | usb_sndctrlpipe(gspca_dev->dev, 0), |
410 | 0, | 411 | 0, |
411 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | 412 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
412 | value, index, | 413 | value, index, |
@@ -443,8 +444,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
443 | 444 | ||
444 | static int init_default_parameters(struct gspca_dev *gspca_dev) | 445 | static int init_default_parameters(struct gspca_dev *gspca_dev) |
445 | { | 446 | { |
446 | struct usb_device *dev = gspca_dev->dev; | ||
447 | |||
448 | /* some of this registers are not really neded, because | 447 | /* some of this registers are not really neded, because |
449 | * they are overriden by setbrigthness, setcontrast, etc, | 448 | * they are overriden by setbrigthness, setcontrast, etc, |
450 | * but wont hurt anyway, and can help someone with similar webcam | 449 | * but wont hurt anyway, and can help someone with similar webcam |
@@ -509,49 +508,49 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) | |||
509 | static const __u8 nset10[6] = | 508 | static const __u8 nset10[6] = |
510 | { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; | 509 | { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; |
511 | 510 | ||
512 | t16RegWrite(dev, 0x01, 0x0000, n1, 0x06); | 511 | reg_w(gspca_dev, 0x01, 0x0000, n1, 0x06); |
513 | t16RegWrite(dev, 0x01, 0x0000, nset, 0x06); | 512 | reg_w(gspca_dev, 0x01, 0x0000, nset, 0x06); |
514 | t16RegRead(dev, 0x0063, &test_byte, 1); | 513 | reg_r_1(gspca_dev, 0x0063); |
515 | t16RegWrite(dev, 0x01, 0x0000, n2, 0x02); | 514 | reg_w(gspca_dev, 0x01, 0x0000, n2, 0x02); |
516 | 515 | ||
517 | while (read_indexs[i] != 0x00) { | 516 | while (read_indexs[i] != 0x00) { |
518 | t16RegRead(dev, read_indexs[i], &test_byte, 1); | 517 | test_byte = reg_r_1(gspca_dev, read_indexs[i]); |
519 | PDEBUG(D_CONF, "Reg 0x%x => 0x%x", read_indexs[i], | 518 | PDEBUG(D_CONF, "Reg 0x%02x => 0x%02x", read_indexs[i], |
520 | test_byte); | 519 | test_byte); |
521 | i++; | 520 | i++; |
522 | } | 521 | } |
523 | 522 | ||
524 | t16RegWrite(dev, 0x01, 0x0000, n3, 0x06); | 523 | reg_w(gspca_dev, 0x01, 0x0000, n3, 0x06); |
525 | t16RegWrite(dev, 0x01, 0x0000, n4, 0x46); | 524 | reg_w(gspca_dev, 0x01, 0x0000, n4, 0x46); |
526 | t16RegRead(dev, 0x0080, &test_byte, 1); | 525 | reg_r_1(gspca_dev, 0x0080); |
527 | t16RegWrite(dev, 0x00, 0x2c80, NULL, 0); | 526 | reg_w(gspca_dev, 0x00, 0x2c80, NULL, 0); |
528 | t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); | 527 | reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); |
529 | t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); | 528 | reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); |
530 | t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); | 529 | reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); |
531 | t16RegWrite(dev, 0x00, 0x3880, NULL, 0); | 530 | reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); |
532 | t16RegWrite(dev, 0x00, 0x3880, NULL, 0); | 531 | reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); |
533 | t16RegWrite(dev, 0x00, 0x338e, NULL, 0); | 532 | reg_w(gspca_dev, 0x00, 0x338e, NULL, 0); |
534 | t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04); | 533 | reg_w(gspca_dev, 0x01, 0x0000, nset5, 0x04); |
535 | t16RegWrite(dev, 0x00, 0x00a9, NULL, 0); | 534 | reg_w(gspca_dev, 0x00, 0x00a9, NULL, 0); |
536 | t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22); | 535 | reg_w(gspca_dev, 0x01, 0x0000, nset6, 0x22); |
537 | t16RegWrite(dev, 0x00, 0x86bb, NULL, 0); | 536 | reg_w(gspca_dev, 0x00, 0x86bb, NULL, 0); |
538 | t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0); | 537 | reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); |
539 | 538 | ||
540 | t16RegWrite(dev, 0x01, 0x0000, missing, 0x08); | 539 | reg_w(gspca_dev, 0x01, 0x0000, missing, 0x08); |
541 | 540 | ||
542 | t16RegWrite(dev, 0x00, 0x2087, NULL, 0); | 541 | reg_w(gspca_dev, 0x00, 0x2087, NULL, 0); |
543 | t16RegWrite(dev, 0x00, 0x2088, NULL, 0); | 542 | reg_w(gspca_dev, 0x00, 0x2088, NULL, 0); |
544 | t16RegWrite(dev, 0x00, 0x2089, NULL, 0); | 543 | reg_w(gspca_dev, 0x00, 0x2089, NULL, 0); |
545 | 544 | ||
546 | t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04); | 545 | reg_w(gspca_dev, 0x01, 0x0000, nset7, 0x04); |
547 | t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06); | 546 | reg_w(gspca_dev, 0x01, 0x0000, nset10, 0x06); |
548 | t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06); | 547 | reg_w(gspca_dev, 0x01, 0x0000, nset8, 0x06); |
549 | t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04); | 548 | reg_w(gspca_dev, 0x01, 0x0000, nset9, 0x04); |
550 | 549 | ||
551 | t16RegWrite(dev, 0x00, 0x2880, NULL, 0); | 550 | reg_w(gspca_dev, 0x00, 0x2880, NULL, 0); |
552 | t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); | 551 | reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); |
553 | t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); | 552 | reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); |
554 | t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); | 553 | reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); |
555 | 554 | ||
556 | return 0; | 555 | return 0; |
557 | } | 556 | } |
@@ -559,7 +558,6 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) | |||
559 | static void setbrightness(struct gspca_dev *gspca_dev) | 558 | static void setbrightness(struct gspca_dev *gspca_dev) |
560 | { | 559 | { |
561 | struct sd *sd = (struct sd *) gspca_dev; | 560 | struct sd *sd = (struct sd *) gspca_dev; |
562 | struct usb_device *dev = gspca_dev->dev; | ||
563 | unsigned int brightness; | 561 | unsigned int brightness; |
564 | __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; | 562 | __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; |
565 | brightness = sd->brightness; | 563 | brightness = sd->brightness; |
@@ -571,13 +569,12 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
571 | set6[3] = 0x00 + ((brightness - 7) * 0xa); | 569 | set6[3] = 0x00 + ((brightness - 7) * 0xa); |
572 | } | 570 | } |
573 | 571 | ||
574 | t16RegWrite(dev, 0x01, 0x0000, set6, 4); | 572 | reg_w(gspca_dev, 0x01, 0x0000, set6, 4); |
575 | } | 573 | } |
576 | 574 | ||
577 | static void setflip(struct gspca_dev *gspca_dev) | 575 | static void setflip(struct gspca_dev *gspca_dev) |
578 | { | 576 | { |
579 | struct sd *sd = (struct sd *) gspca_dev; | 577 | struct sd *sd = (struct sd *) gspca_dev; |
580 | struct usb_device *dev = gspca_dev->dev; | ||
581 | 578 | ||
582 | __u8 flipcmd[8] = | 579 | __u8 flipcmd[8] = |
583 | { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; | 580 | { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; |
@@ -585,15 +582,14 @@ static void setflip(struct gspca_dev *gspca_dev) | |||
585 | if (sd->mirror == 1) | 582 | if (sd->mirror == 1) |
586 | flipcmd[3] = 0x01; | 583 | flipcmd[3] = 0x01; |
587 | 584 | ||
588 | t16RegWrite(dev, 0x01, 0x0000, flipcmd, 8); | 585 | reg_w(gspca_dev, 0x01, 0x0000, flipcmd, 8); |
589 | } | 586 | } |
590 | 587 | ||
591 | static void seteffect(struct gspca_dev *gspca_dev) | 588 | static void seteffect(struct gspca_dev *gspca_dev) |
592 | { | 589 | { |
593 | struct sd *sd = (struct sd *) gspca_dev; | 590 | struct sd *sd = (struct sd *) gspca_dev; |
594 | struct usb_device *dev = gspca_dev->dev; | ||
595 | 591 | ||
596 | t16RegWrite(dev, 0x01, 0x0000, effects_table[sd->effect], 0x06); | 592 | reg_w(gspca_dev, 0x01, 0x0000, effects_table[sd->effect], 0x06); |
597 | if (sd->effect == 1 || sd->effect == 5) { | 593 | if (sd->effect == 1 || sd->effect == 5) { |
598 | PDEBUG(D_CONF, | 594 | PDEBUG(D_CONF, |
599 | "This effect have been disabled for webcam \"safety\""); | 595 | "This effect have been disabled for webcam \"safety\""); |
@@ -601,15 +597,14 @@ static void seteffect(struct gspca_dev *gspca_dev) | |||
601 | } | 597 | } |
602 | 598 | ||
603 | if (sd->effect == 1 || sd->effect == 4) | 599 | if (sd->effect == 1 || sd->effect == 4) |
604 | t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0); | 600 | reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); |
605 | else | 601 | else |
606 | t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0); | 602 | reg_w(gspca_dev, 0x00, 0xfaa6, NULL, 0); |
607 | } | 603 | } |
608 | 604 | ||
609 | static void setwhitebalance(struct gspca_dev *gspca_dev) | 605 | static void setwhitebalance(struct gspca_dev *gspca_dev) |
610 | { | 606 | { |
611 | struct sd *sd = (struct sd *) gspca_dev; | 607 | struct sd *sd = (struct sd *) gspca_dev; |
612 | struct usb_device *dev = gspca_dev->dev; | ||
613 | 608 | ||
614 | __u8 white_balance[8] = | 609 | __u8 white_balance[8] = |
615 | { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; | 610 | { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; |
@@ -617,25 +612,23 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) | |||
617 | if (sd->whitebalance == 1) | 612 | if (sd->whitebalance == 1) |
618 | white_balance[7] = 0x3c; | 613 | white_balance[7] = 0x3c; |
619 | 614 | ||
620 | t16RegWrite(dev, 0x01, 0x0000, white_balance, 8); | 615 | reg_w(gspca_dev, 0x01, 0x0000, white_balance, 8); |
621 | } | 616 | } |
622 | 617 | ||
623 | static void setlightfreq(struct gspca_dev *gspca_dev) | 618 | static void setlightfreq(struct gspca_dev *gspca_dev) |
624 | { | 619 | { |
625 | struct sd *sd = (struct sd *) gspca_dev; | 620 | struct sd *sd = (struct sd *) gspca_dev; |
626 | struct usb_device *dev = gspca_dev->dev; | ||
627 | __u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; | 621 | __u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; |
628 | 622 | ||
629 | if (sd->freq == 2) /* 60hz */ | 623 | if (sd->freq == 2) /* 60hz */ |
630 | freq[1] = 0x00; | 624 | freq[1] = 0x00; |
631 | 625 | ||
632 | t16RegWrite(dev, 0x1, 0x0000, freq, 0x4); | 626 | reg_w(gspca_dev, 0x1, 0x0000, freq, 0x4); |
633 | } | 627 | } |
634 | 628 | ||
635 | static void setcontrast(struct gspca_dev *gspca_dev) | 629 | static void setcontrast(struct gspca_dev *gspca_dev) |
636 | { | 630 | { |
637 | struct sd *sd = (struct sd *) gspca_dev; | 631 | struct sd *sd = (struct sd *) gspca_dev; |
638 | struct usb_device *dev = gspca_dev->dev; | ||
639 | unsigned int contrast = sd->contrast; | 632 | unsigned int contrast = sd->contrast; |
640 | __u16 reg_to_write = 0x00; | 633 | __u16 reg_to_write = 0x00; |
641 | 634 | ||
@@ -644,17 +637,16 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
644 | else | 637 | else |
645 | reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); | 638 | reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); |
646 | 639 | ||
647 | t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); | 640 | reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); |
648 | } | 641 | } |
649 | 642 | ||
650 | static void setcolors(struct gspca_dev *gspca_dev) | 643 | static void setcolors(struct gspca_dev *gspca_dev) |
651 | { | 644 | { |
652 | struct sd *sd = (struct sd *) gspca_dev; | 645 | struct sd *sd = (struct sd *) gspca_dev; |
653 | struct usb_device *dev = gspca_dev->dev; | ||
654 | __u16 reg_to_write; | 646 | __u16 reg_to_write; |
655 | 647 | ||
656 | reg_to_write = 0xc0bb + sd->colors * 0x100; | 648 | reg_to_write = 0xc0bb + sd->colors * 0x100; |
657 | t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); | 649 | reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); |
658 | } | 650 | } |
659 | 651 | ||
660 | static void setgamma(struct gspca_dev *gspca_dev) | 652 | static void setgamma(struct gspca_dev *gspca_dev) |
@@ -664,12 +656,11 @@ static void setgamma(struct gspca_dev *gspca_dev) | |||
664 | static void setsharpness(struct gspca_dev *gspca_dev) | 656 | static void setsharpness(struct gspca_dev *gspca_dev) |
665 | { | 657 | { |
666 | struct sd *sd = (struct sd *) gspca_dev; | 658 | struct sd *sd = (struct sd *) gspca_dev; |
667 | struct usb_device *dev = gspca_dev->dev; | ||
668 | __u16 reg_to_write; | 659 | __u16 reg_to_write; |
669 | 660 | ||
670 | reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; | 661 | reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; |
671 | 662 | ||
672 | t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); | 663 | reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); |
673 | } | 664 | } |
674 | 665 | ||
675 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 666 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |
@@ -837,13 +828,12 @@ static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | |||
837 | static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val) | 828 | static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val) |
838 | { | 829 | { |
839 | struct sd *sd = (struct sd *) gspca_dev; | 830 | struct sd *sd = (struct sd *) gspca_dev; |
840 | struct usb_device *dev = gspca_dev->dev; | ||
841 | 831 | ||
842 | sd->autogain = val; | 832 | sd->autogain = val; |
843 | if (val != 0) | 833 | if (val != 0) |
844 | t16RegWrite(dev, 0x00, 0xf48e, NULL, 0); | 834 | reg_w(gspca_dev, 0x00, 0xf48e, NULL, 0); |
845 | else | 835 | else |
846 | t16RegWrite(dev, 0x00, 0xb48e, NULL, 0); | 836 | reg_w(gspca_dev, 0x00, 0xb48e, NULL, 0); |
847 | return 0; | 837 | return 0; |
848 | } | 838 | } |
849 | 839 | ||
@@ -857,9 +847,7 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val) | |||
857 | 847 | ||
858 | static void sd_start(struct gspca_dev *gspca_dev) | 848 | static void sd_start(struct gspca_dev *gspca_dev) |
859 | { | 849 | { |
860 | struct usb_device *dev = gspca_dev->dev; | ||
861 | int mode; | 850 | int mode; |
862 | __u8 test_byte; | ||
863 | 851 | ||
864 | static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; | 852 | static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; |
865 | __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; | 853 | __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; |
@@ -886,21 +874,21 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
886 | break; | 874 | break; |
887 | } | 875 | } |
888 | 876 | ||
889 | t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8); | 877 | reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8); |
890 | t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); | 878 | reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); |
891 | t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); | 879 | reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); |
892 | t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); | 880 | reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); |
893 | t16RegWrite(dev, 0x00, 0x3c80, NULL, 0); | 881 | reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); |
894 | /* just in case and to keep sync with logs (for mine) */ | 882 | /* just in case and to keep sync with logs (for mine) */ |
895 | t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); | 883 | reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); |
896 | t16RegWrite(dev, 0x00, 0x3c80, NULL, 0); | 884 | reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); |
897 | /* just in case and to keep sync with logs (for mine) */ | 885 | /* just in case and to keep sync with logs (for mine) */ |
898 | t16RegWrite(dev, 0x01, 0x0000, t1, 4); | 886 | reg_w(gspca_dev, 0x01, 0x0000, t1, 4); |
899 | t16RegWrite(dev, 0x01, 0x0000, t2, 6); | 887 | reg_w(gspca_dev, 0x01, 0x0000, t2, 6); |
900 | t16RegRead(dev, 0x0012, &test_byte, 0x01); | 888 | reg_r_1(gspca_dev, 0x0012); |
901 | t16RegWrite(dev, 0x01, 0x0000, t3, 0x10); | 889 | reg_w(gspca_dev, 0x01, 0x0000, t3, 0x10); |
902 | t16RegWrite(dev, 0x00, 0x0013, NULL, 0); | 890 | reg_w(gspca_dev, 0x00, 0x0013, NULL, 0); |
903 | t16RegWrite(dev, 0x01, 0x0000, t4, 0x4); | 891 | reg_w(gspca_dev, 0x01, 0x0000, t4, 0x4); |
904 | /* restart on each start, just in case, sometimes regs goes wrong | 892 | /* restart on each start, just in case, sometimes regs goes wrong |
905 | * when using controls from app */ | 893 | * when using controls from app */ |
906 | setbrightness(gspca_dev); | 894 | setbrightness(gspca_dev); |