diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-01-19 05:37:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:33 -0400 |
commit | 9881918756be1cf0a33ae7454ca767682cbfadc3 (patch) | |
tree | 8b3786b23f306a4ca83fc755a82d24a3ef298b4a /drivers/media/video/gspca | |
parent | a48196a2f74a2e19e67debe194e337dfc583702f (diff) |
V4L/DVB (10372): gspca - sonixj: Cleanup code.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index db8db0c6bbb9..59363e077bbf 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -36,28 +36,28 @@ struct sd { | |||
36 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 36 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
37 | 37 | ||
38 | atomic_t avg_lum; | 38 | atomic_t avg_lum; |
39 | unsigned int exposure; | 39 | u32 exposure; |
40 | 40 | ||
41 | __u16 brightness; | 41 | u16 brightness; |
42 | __u8 contrast; | 42 | u8 contrast; |
43 | __u8 colors; | 43 | u8 colors; |
44 | __u8 autogain; | 44 | u8 autogain; |
45 | __u8 blue; | 45 | u8 blue; |
46 | __u8 red; | 46 | u8 red; |
47 | u8 gamma; | 47 | u8 gamma; |
48 | __u8 vflip; /* ov7630 only */ | 48 | u8 vflip; /* ov7630 only */ |
49 | __u8 infrared; /* mi0360 only */ | 49 | u8 infrared; /* mi0360 only */ |
50 | 50 | ||
51 | __s8 ag_cnt; | 51 | s8 ag_cnt; |
52 | #define AG_CNT_START 13 | 52 | #define AG_CNT_START 13 |
53 | 53 | ||
54 | __u8 bridge; | 54 | u8 bridge; |
55 | #define BRIDGE_SN9C102P 0 | 55 | #define BRIDGE_SN9C102P 0 |
56 | #define BRIDGE_SN9C105 1 | 56 | #define BRIDGE_SN9C105 1 |
57 | #define BRIDGE_SN9C110 2 | 57 | #define BRIDGE_SN9C110 2 |
58 | #define BRIDGE_SN9C120 3 | 58 | #define BRIDGE_SN9C120 3 |
59 | #define BRIDGE_SN9C325 4 | 59 | #define BRIDGE_SN9C325 4 |
60 | __u8 sensor; /* Type of image sensor chip */ | 60 | u8 sensor; /* Type of image sensor chip */ |
61 | #define SENSOR_HV7131R 0 | 61 | #define SENSOR_HV7131R 0 |
62 | #define SENSOR_MI0360 1 | 62 | #define SENSOR_MI0360 1 |
63 | #define SENSOR_MO4000 2 | 63 | #define SENSOR_MO4000 2 |
@@ -65,7 +65,7 @@ struct sd { | |||
65 | #define SENSOR_OV7630 4 | 65 | #define SENSOR_OV7630 4 |
66 | #define SENSOR_OV7648 5 | 66 | #define SENSOR_OV7648 5 |
67 | #define SENSOR_OV7660 6 | 67 | #define SENSOR_OV7660 6 |
68 | __u8 i2c_base; | 68 | u8 i2c_base; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* V4L2 controls supported by the driver */ | 71 | /* V4L2 controls supported by the driver */ |
@@ -349,20 +349,20 @@ static const u8 *sn_tb[] = { | |||
349 | sn_ov7660 | 349 | sn_ov7660 |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static const __u8 gamma_def[17] = { | 352 | static const u8 gamma_def[17] = { |
353 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, | 353 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, |
354 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff | 354 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff |
355 | }; | 355 | }; |
356 | 356 | ||
357 | 357 | ||
358 | /* color matrix and offsets */ | 358 | /* color matrix and offsets */ |
359 | static const __u8 reg84[] = { | 359 | static const u8 reg84[] = { |
360 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, /* YR YG YB gains */ | 360 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, /* YR YG YB gains */ |
361 | 0xe8, 0x0f, 0xda, 0x0f, 0x40, 0x00, /* UR UG UB */ | 361 | 0xe8, 0x0f, 0xda, 0x0f, 0x40, 0x00, /* UR UG UB */ |
362 | 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */ | 362 | 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */ |
363 | 0x00, 0x00, 0x00 /* YUV offsets */ | 363 | 0x00, 0x00, 0x00 /* YUV offsets */ |
364 | }; | 364 | }; |
365 | static const __u8 hv7131r_sensor_init[][8] = { | 365 | static const u8 hv7131r_sensor_init[][8] = { |
366 | {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, | 366 | {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, |
367 | {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, | 367 | {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, |
368 | {0xd1, 0x11, 0x40, 0xff, 0x7f, 0x7f, 0x7f, 0x10}, | 368 | {0xd1, 0x11, 0x40, 0xff, 0x7f, 0x7f, 0x7f, 0x10}, |
@@ -393,9 +393,9 @@ static const __u8 hv7131r_sensor_init[][8] = { | |||
393 | {0xa1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10}, | 393 | {0xa1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10}, |
394 | {} | 394 | {} |
395 | }; | 395 | }; |
396 | static const __u8 mi0360_sensor_init[][8] = { | 396 | static const u8 mi0360_sensor_init[][8] = { |
397 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, | 397 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
398 | {0xb1, 0x5d, 0x0D, 0x00, 0x01, 0x00, 0x00, 0x10}, | 398 | {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, |
399 | {0xb1, 0x5d, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x10}, | 399 | {0xb1, 0x5d, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x10}, |
400 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, | 400 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, |
401 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, | 401 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, |
@@ -416,7 +416,7 @@ static const __u8 mi0360_sensor_init[][8] = { | |||
416 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | 416 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
417 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, | 417 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, |
418 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, | 418 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, |
419 | {0xd1, 0x5d, 0x2F, 0xF7, 0xB0, 0x00, 0x04, 0x10}, | 419 | {0xd1, 0x5d, 0x2f, 0xf7, 0xB0, 0x00, 0x04, 0x10}, |
420 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, | 420 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, |
421 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, | 421 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, |
422 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, | 422 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, |
@@ -447,7 +447,7 @@ static const __u8 mi0360_sensor_init[][8] = { | |||
447 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ | 447 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ |
448 | {} | 448 | {} |
449 | }; | 449 | }; |
450 | static const __u8 mo4000_sensor_init[][8] = { | 450 | static const u8 mo4000_sensor_init[][8] = { |
451 | {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10}, | 451 | {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10}, |
452 | {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10}, | 452 | {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10}, |
453 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, | 453 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, |
@@ -470,7 +470,7 @@ static const __u8 mo4000_sensor_init[][8] = { | |||
470 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, | 470 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, |
471 | {} | 471 | {} |
472 | }; | 472 | }; |
473 | static __u8 om6802_sensor_init[][8] = { | 473 | static const u8 om6802_sensor_init[][8] = { |
474 | {0xa0, 0x34, 0x90, 0x05, 0x00, 0x00, 0x00, 0x10}, | 474 | {0xa0, 0x34, 0x90, 0x05, 0x00, 0x00, 0x00, 0x10}, |
475 | {0xa0, 0x34, 0x49, 0x85, 0x00, 0x00, 0x00, 0x10}, | 475 | {0xa0, 0x34, 0x49, 0x85, 0x00, 0x00, 0x00, 0x10}, |
476 | {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10}, | 476 | {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10}, |
@@ -504,7 +504,7 @@ static __u8 om6802_sensor_init[][8] = { | |||
504 | /* {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, */ | 504 | /* {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, */ |
505 | {} | 505 | {} |
506 | }; | 506 | }; |
507 | static const __u8 ov7630_sensor_init[][8] = { | 507 | static const u8 ov7630_sensor_init[][8] = { |
508 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, | 508 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, |
509 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | 509 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, |
510 | /* win: delay 20ms */ | 510 | /* win: delay 20ms */ |
@@ -558,7 +558,7 @@ static const __u8 ov7630_sensor_init[][8] = { | |||
558 | {} | 558 | {} |
559 | }; | 559 | }; |
560 | 560 | ||
561 | static const __u8 ov7648_sensor_init[][8] = { | 561 | static const u8 ov7648_sensor_init[][8] = { |
562 | {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10}, | 562 | {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10}, |
563 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ | 563 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ |
564 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, | 564 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
@@ -604,7 +604,7 @@ static const __u8 ov7648_sensor_init[][8] = { | |||
604 | {} | 604 | {} |
605 | }; | 605 | }; |
606 | 606 | ||
607 | static const __u8 ov7660_sensor_init[][8] = { | 607 | static const u8 ov7660_sensor_init[][8] = { |
608 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ | 608 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ |
609 | /* (delay 20ms) */ | 609 | /* (delay 20ms) */ |
610 | {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, | 610 | {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, |
@@ -693,28 +693,28 @@ static const __u8 ov7660_sensor_init[][8] = { | |||
693 | {} | 693 | {} |
694 | }; | 694 | }; |
695 | 695 | ||
696 | static const __u8 qtable4[] = { | 696 | static const u8 qtable4[] = { |
697 | 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, | 697 | 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, |
698 | 0x06, 0x08, 0x0a, 0x11, | 698 | 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0a, 0x11, |
699 | 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x15, 0x0f, 0x0f, 0x0c, 0x11, 0x19, 0x15, | 699 | 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x15, 0x0f, 0x0f, |
700 | 0x19, 0x19, 0x17, 0x15, | 700 | 0x0c, 0x11, 0x19, 0x15, 0x19, 0x19, 0x17, 0x15, |
701 | 0x17, 0x17, 0x1b, 0x1d, 0x25, 0x21, 0x1b, 0x1d, 0x23, 0x1d, 0x17, 0x17, | 701 | 0x17, 0x17, 0x1b, 0x1d, 0x25, 0x21, 0x1b, 0x1d, |
702 | 0x21, 0x2e, 0x21, 0x23, | 702 | 0x23, 0x1d, 0x17, 0x17, 0x21, 0x2e, 0x21, 0x23, |
703 | 0x27, 0x29, 0x2c, 0x2c, 0x2c, 0x19, 0x1f, 0x30, 0x32, 0x2e, 0x29, 0x32, | 703 | 0x27, 0x29, 0x2c, 0x2c, 0x2c, 0x19, 0x1f, 0x30, |
704 | 0x25, 0x29, 0x2c, 0x29, | 704 | 0x32, 0x2e, 0x29, 0x32, 0x25, 0x29, 0x2c, 0x29, |
705 | 0x06, 0x08, 0x08, 0x0a, 0x08, 0x0a, 0x13, 0x0a, 0x0a, 0x13, 0x29, 0x1b, | 705 | 0x06, 0x08, 0x08, 0x0a, 0x08, 0x0a, 0x13, 0x0a, |
706 | 0x17, 0x1b, 0x29, 0x29, | 706 | 0x0a, 0x13, 0x29, 0x1b, 0x17, 0x1b, 0x29, 0x29, |
707 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, | 707 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, |
708 | 0x29, 0x29, 0x29, 0x29, | 708 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, |
709 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, | 709 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, |
710 | 0x29, 0x29, 0x29, 0x29, | 710 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, |
711 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, | 711 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, |
712 | 0x29, 0x29, 0x29, 0x29 | 712 | 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29 |
713 | }; | 713 | }; |
714 | 714 | ||
715 | /* read <len> bytes to gspca_dev->usb_buf */ | 715 | /* read <len> bytes to gspca_dev->usb_buf */ |
716 | static void reg_r(struct gspca_dev *gspca_dev, | 716 | static void reg_r(struct gspca_dev *gspca_dev, |
717 | __u16 value, int len) | 717 | u16 value, int len) |
718 | { | 718 | { |
719 | #ifdef GSPCA_DEBUG | 719 | #ifdef GSPCA_DEBUG |
720 | if (len > USB_BUF_SZ) { | 720 | if (len > USB_BUF_SZ) { |
@@ -733,8 +733,8 @@ static void reg_r(struct gspca_dev *gspca_dev, | |||
733 | } | 733 | } |
734 | 734 | ||
735 | static void reg_w1(struct gspca_dev *gspca_dev, | 735 | static void reg_w1(struct gspca_dev *gspca_dev, |
736 | __u16 value, | 736 | u16 value, |
737 | __u8 data) | 737 | u8 data) |
738 | { | 738 | { |
739 | PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data); | 739 | PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data); |
740 | gspca_dev->usb_buf[0] = data; | 740 | gspca_dev->usb_buf[0] = data; |
@@ -748,8 +748,8 @@ static void reg_w1(struct gspca_dev *gspca_dev, | |||
748 | 500); | 748 | 500); |
749 | } | 749 | } |
750 | static void reg_w(struct gspca_dev *gspca_dev, | 750 | static void reg_w(struct gspca_dev *gspca_dev, |
751 | __u16 value, | 751 | u16 value, |
752 | const __u8 *buffer, | 752 | const u8 *buffer, |
753 | int len) | 753 | int len) |
754 | { | 754 | { |
755 | PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..", | 755 | PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..", |
@@ -771,7 +771,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
771 | } | 771 | } |
772 | 772 | ||
773 | /* I2C write 1 byte */ | 773 | /* I2C write 1 byte */ |
774 | static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val) | 774 | static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) |
775 | { | 775 | { |
776 | struct sd *sd = (struct sd *) gspca_dev; | 776 | struct sd *sd = (struct sd *) gspca_dev; |
777 | 777 | ||
@@ -796,7 +796,7 @@ static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val) | |||
796 | 796 | ||
797 | /* I2C write 8 bytes */ | 797 | /* I2C write 8 bytes */ |
798 | static void i2c_w8(struct gspca_dev *gspca_dev, | 798 | static void i2c_w8(struct gspca_dev *gspca_dev, |
799 | const __u8 *buffer) | 799 | const u8 *buffer) |
800 | { | 800 | { |
801 | memcpy(gspca_dev->usb_buf, buffer, 8); | 801 | memcpy(gspca_dev->usb_buf, buffer, 8); |
802 | usb_control_msg(gspca_dev->dev, | 802 | usb_control_msg(gspca_dev->dev, |
@@ -810,10 +810,10 @@ static void i2c_w8(struct gspca_dev *gspca_dev, | |||
810 | } | 810 | } |
811 | 811 | ||
812 | /* read 5 bytes in gspca_dev->usb_buf */ | 812 | /* read 5 bytes in gspca_dev->usb_buf */ |
813 | static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg) | 813 | static void i2c_r5(struct gspca_dev *gspca_dev, u8 reg) |
814 | { | 814 | { |
815 | struct sd *sd = (struct sd *) gspca_dev; | 815 | struct sd *sd = (struct sd *) gspca_dev; |
816 | __u8 mode[8]; | 816 | u8 mode[8]; |
817 | 817 | ||
818 | mode[0] = 0x81 | 0x10; | 818 | mode[0] = 0x81 | 0x10; |
819 | mode[1] = sd->i2c_base; | 819 | mode[1] = sd->i2c_base; |
@@ -855,15 +855,15 @@ static int probesensor(struct gspca_dev *gspca_dev) | |||
855 | } | 855 | } |
856 | 856 | ||
857 | static int configure_gpio(struct gspca_dev *gspca_dev, | 857 | static int configure_gpio(struct gspca_dev *gspca_dev, |
858 | const __u8 *sn9c1xx) | 858 | const u8 *sn9c1xx) |
859 | { | 859 | { |
860 | struct sd *sd = (struct sd *) gspca_dev; | 860 | struct sd *sd = (struct sd *) gspca_dev; |
861 | const __u8 *reg9a; | 861 | const u8 *reg9a; |
862 | static const __u8 reg9a_def[] = | 862 | static const u8 reg9a_def[] = |
863 | {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; | 863 | {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; |
864 | static const __u8 reg9a_sn9c325[] = | 864 | static const u8 reg9a_sn9c325[] = |
865 | {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; | 865 | {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; |
866 | static const __u8 regd4[] = {0x60, 0x00, 0x00}; | 866 | static const u8 regd4[] = {0x60, 0x00, 0x00}; |
867 | 867 | ||
868 | reg_w1(gspca_dev, 0xf1, 0x00); | 868 | reg_w1(gspca_dev, 0xf1, 0x00); |
869 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 869 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); |
@@ -931,7 +931,7 @@ static int configure_gpio(struct gspca_dev *gspca_dev, | |||
931 | static void hv7131R_InitSensor(struct gspca_dev *gspca_dev) | 931 | static void hv7131R_InitSensor(struct gspca_dev *gspca_dev) |
932 | { | 932 | { |
933 | int i = 0; | 933 | int i = 0; |
934 | static const __u8 SetSensorClk[] = /* 0x08 Mclk */ | 934 | static const u8 SetSensorClk[] = /* 0x08 Mclk */ |
935 | { 0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10 }; | 935 | { 0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10 }; |
936 | 936 | ||
937 | while (hv7131r_sensor_init[i][0]) { | 937 | while (hv7131r_sensor_init[i][0]) { |
@@ -1059,8 +1059,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1059 | static int sd_init(struct gspca_dev *gspca_dev) | 1059 | static int sd_init(struct gspca_dev *gspca_dev) |
1060 | { | 1060 | { |
1061 | struct sd *sd = (struct sd *) gspca_dev; | 1061 | struct sd *sd = (struct sd *) gspca_dev; |
1062 | __u8 regGpio[] = { 0x29, 0x74 }; | 1062 | u8 regGpio[] = { 0x29, 0x74 }; |
1063 | __u8 regF1; | 1063 | u8 regF1; |
1064 | 1064 | ||
1065 | /* setup a selector by bridge */ | 1065 | /* setup a selector by bridge */ |
1066 | reg_w1(gspca_dev, 0xf1, 0x01); | 1066 | reg_w1(gspca_dev, 0xf1, 0x01); |
@@ -1100,20 +1100,14 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1100 | return 0; | 1100 | return 0; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | static unsigned int setexposure(struct gspca_dev *gspca_dev, | 1103 | static u32 setexposure(struct gspca_dev *gspca_dev, |
1104 | unsigned int expo) | 1104 | u32 expo) |
1105 | { | 1105 | { |
1106 | struct sd *sd = (struct sd *) gspca_dev; | 1106 | struct sd *sd = (struct sd *) gspca_dev; |
1107 | static const __u8 doit[] = /* update sensor */ | ||
1108 | { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 }; | ||
1109 | static const __u8 sensorgo[] = /* sensor on */ | ||
1110 | { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 }; | ||
1111 | static const __u8 gainMo[] = | ||
1112 | { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d }; | ||
1113 | 1107 | ||
1114 | switch (sd->sensor) { | 1108 | switch (sd->sensor) { |
1115 | case SENSOR_HV7131R: { | 1109 | case SENSOR_HV7131R: { |
1116 | __u8 Expodoit[] = | 1110 | u8 Expodoit[] = |
1117 | { 0xc1, 0x11, 0x25, 0x07, 0x27, 0xc0, 0x00, 0x16 }; | 1111 | { 0xc1, 0x11, 0x25, 0x07, 0x27, 0xc0, 0x00, 0x16 }; |
1118 | 1112 | ||
1119 | Expodoit[3] = expo >> 16; | 1113 | Expodoit[3] = expo >> 16; |
@@ -1123,8 +1117,12 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, | |||
1123 | break; | 1117 | break; |
1124 | } | 1118 | } |
1125 | case SENSOR_MI0360: { | 1119 | case SENSOR_MI0360: { |
1126 | __u8 expoMi[] = /* exposure 0x0635 -> 4 fp/s 0x10 */ | 1120 | u8 expoMi[] = /* exposure 0x0635 -> 4 fp/s 0x10 */ |
1127 | { 0xb1, 0x5d, 0x09, 0x06, 0x35, 0x00, 0x00, 0x16 }; | 1121 | { 0xb1, 0x5d, 0x09, 0x06, 0x35, 0x00, 0x00, 0x16 }; |
1122 | static const u8 doit[] = /* update sensor */ | ||
1123 | { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 }; | ||
1124 | static const u8 sensorgo[] = /* sensor on */ | ||
1125 | { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 }; | ||
1128 | 1126 | ||
1129 | if (expo > 0x0635) | 1127 | if (expo > 0x0635) |
1130 | expo = 0x0635; | 1128 | expo = 0x0635; |
@@ -1138,10 +1136,12 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, | |||
1138 | break; | 1136 | break; |
1139 | } | 1137 | } |
1140 | case SENSOR_MO4000: { | 1138 | case SENSOR_MO4000: { |
1141 | __u8 expoMof[] = | 1139 | u8 expoMof[] = |
1142 | { 0xa1, 0x21, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 1140 | { 0xa1, 0x21, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
1143 | __u8 expoMo10[] = | 1141 | u8 expoMo10[] = |
1144 | { 0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 1142 | { 0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
1143 | static const u8 gainMo[] = | ||
1144 | { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d }; | ||
1145 | 1145 | ||
1146 | if (expo > 0x1fff) | 1146 | if (expo > 0x1fff) |
1147 | expo = 0x1fff; | 1147 | expo = 0x1fff; |
@@ -1160,7 +1160,7 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, | |||
1160 | break; | 1160 | break; |
1161 | } | 1161 | } |
1162 | case SENSOR_OM6802: { | 1162 | case SENSOR_OM6802: { |
1163 | __u8 gainOm[] = | 1163 | u8 gainOm[] = |
1164 | { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 }; | 1164 | { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
1165 | 1165 | ||
1166 | if (expo > 0x03ff) | 1166 | if (expo > 0x03ff) |
@@ -1181,7 +1181,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
1181 | { | 1181 | { |
1182 | struct sd *sd = (struct sd *) gspca_dev; | 1182 | struct sd *sd = (struct sd *) gspca_dev; |
1183 | unsigned int expo; | 1183 | unsigned int expo; |
1184 | __u8 k2; | 1184 | u8 k2; |
1185 | 1185 | ||
1186 | k2 = ((int) sd->brightness - 0x8000) >> 10; | 1186 | k2 = ((int) sd->brightness - 0x8000) >> 10; |
1187 | switch (sd->sensor) { | 1187 | switch (sd->sensor) { |
@@ -1211,8 +1211,8 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
1211 | static void setcontrast(struct gspca_dev *gspca_dev) | 1211 | static void setcontrast(struct gspca_dev *gspca_dev) |
1212 | { | 1212 | { |
1213 | struct sd *sd = (struct sd *) gspca_dev; | 1213 | struct sd *sd = (struct sd *) gspca_dev; |
1214 | __u8 k2; | 1214 | u8 k2; |
1215 | __u8 contrast[6]; | 1215 | u8 contrast[6]; |
1216 | 1216 | ||
1217 | k2 = sd->contrast * 0x30 / (CONTRAST_MAX + 1) + 0x10; /* 10..40 */ | 1217 | k2 = sd->contrast * 0x30 / (CONTRAST_MAX + 1) + 0x10; /* 10..40 */ |
1218 | contrast[0] = (k2 + 1) / 2; /* red */ | 1218 | contrast[0] = (k2 + 1) / 2; /* red */ |
@@ -1228,8 +1228,8 @@ static void setcolors(struct gspca_dev *gspca_dev) | |||
1228 | { | 1228 | { |
1229 | struct sd *sd = (struct sd *) gspca_dev; | 1229 | struct sd *sd = (struct sd *) gspca_dev; |
1230 | int i, v; | 1230 | int i, v; |
1231 | __u8 reg8a[12]; /* U & V gains */ | 1231 | u8 reg8a[12]; /* U & V gains */ |
1232 | static __s16 uv[6] = { /* same as reg84 in signed decimal */ | 1232 | static s16 uv[6] = { /* same as reg84 in signed decimal */ |
1233 | -24, -38, 64, /* UR UG UB */ | 1233 | -24, -38, 64, /* UR UG UB */ |
1234 | 62, -51, -9 /* VR VG VB */ | 1234 | 62, -51, -9 /* VR VG VB */ |
1235 | }; | 1235 | }; |
@@ -1297,13 +1297,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1297 | { | 1297 | { |
1298 | struct sd *sd = (struct sd *) gspca_dev; | 1298 | struct sd *sd = (struct sd *) gspca_dev; |
1299 | int i; | 1299 | int i; |
1300 | __u8 reg1, reg17, reg18; | 1300 | u8 reg1, reg17, reg18; |
1301 | const __u8 *sn9c1xx; | 1301 | const u8 *sn9c1xx; |
1302 | int mode; | 1302 | int mode; |
1303 | static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 1303 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
1304 | static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 1304 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
1305 | static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ | 1305 | static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ |
1306 | static const __u8 CE_ov76xx[] = | 1306 | static const u8 CE_ov76xx[] = |
1307 | { 0x32, 0xdd, 0x32, 0xdd }; | 1307 | { 0x32, 0xdd, 0x32, 0xdd }; |
1308 | 1308 | ||
1309 | sn9c1xx = sn_tb[(int) sd->sensor]; | 1309 | sn9c1xx = sn_tb[(int) sd->sensor]; |
@@ -1460,14 +1460,14 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1460 | static void sd_stopN(struct gspca_dev *gspca_dev) | 1460 | static void sd_stopN(struct gspca_dev *gspca_dev) |
1461 | { | 1461 | { |
1462 | struct sd *sd = (struct sd *) gspca_dev; | 1462 | struct sd *sd = (struct sd *) gspca_dev; |
1463 | static const __u8 stophv7131[] = | 1463 | static const u8 stophv7131[] = |
1464 | { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; | 1464 | { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; |
1465 | static const __u8 stopmi0360[] = | 1465 | static const u8 stopmi0360[] = |
1466 | { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; | 1466 | { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
1467 | static const __u8 stopov7648[] = | 1467 | static const u8 stopov7648[] = |
1468 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 1468 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
1469 | __u8 data; | 1469 | u8 data; |
1470 | const __u8 *sn9c1xx; | 1470 | const u8 *sn9c1xx; |
1471 | 1471 | ||
1472 | data = 0x0b; | 1472 | data = 0x0b; |
1473 | switch (sd->sensor) { | 1473 | switch (sd->sensor) { |
@@ -1503,8 +1503,8 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
1503 | struct sd *sd = (struct sd *) gspca_dev; | 1503 | struct sd *sd = (struct sd *) gspca_dev; |
1504 | int delta; | 1504 | int delta; |
1505 | int expotimes; | 1505 | int expotimes; |
1506 | __u8 luma_mean = 130; | 1506 | u8 luma_mean = 130; |
1507 | __u8 luma_delta = 20; | 1507 | u8 luma_delta = 20; |
1508 | 1508 | ||
1509 | /* Thanks S., without your advice, autobright should not work :) */ | 1509 | /* Thanks S., without your advice, autobright should not work :) */ |
1510 | if (sd->ag_cnt < 0) | 1510 | if (sd->ag_cnt < 0) |
@@ -1546,7 +1546,7 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
1546 | /* This function is run at interrupt level. */ | 1546 | /* This function is run at interrupt level. */ |
1547 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1547 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
1548 | struct gspca_frame *frame, /* target */ | 1548 | struct gspca_frame *frame, /* target */ |
1549 | __u8 *data, /* isoc packet */ | 1549 | u8 *data, /* isoc packet */ |
1550 | int len) /* iso packet length */ | 1550 | int len) /* iso packet length */ |
1551 | { | 1551 | { |
1552 | struct sd *sd = (struct sd *) gspca_dev; | 1552 | struct sd *sd = (struct sd *) gspca_dev; |