diff options
author | Joe Perches <joe@perches.com> | 2009-09-02 00:12:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:20:12 -0400 |
commit | 58aa68c2fbdc3d025a3aff280935ede66dbcdc3e (patch) | |
tree | bddb0e12e093a01c011575e48e62139eeebd34a1 /drivers | |
parent | e14304712939133d58a5132501e80509658e0449 (diff) |
V4L/DVB (12703): gspca - sn9c20x: Reduces size of object
Use s16 instead of int where possible.
Use struct instead of arrays
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Brian Johnson <brijohn@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 101 |
1 files changed, 56 insertions, 45 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index a74c36f4c8d2..20b03a005293 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -94,6 +94,16 @@ struct sd { | |||
94 | #endif | 94 | #endif |
95 | }; | 95 | }; |
96 | 96 | ||
97 | struct i2c_reg_u8 { | ||
98 | u8 reg; | ||
99 | u8 val; | ||
100 | }; | ||
101 | |||
102 | struct i2c_reg_u16 { | ||
103 | u8 reg; | ||
104 | u16 val; | ||
105 | }; | ||
106 | |||
97 | static int sd_setbrightness(struct gspca_dev *gspca_dev, s32 val); | 107 | static int sd_setbrightness(struct gspca_dev *gspca_dev, s32 val); |
98 | static int sd_getbrightness(struct gspca_dev *gspca_dev, s32 *val); | 108 | static int sd_getbrightness(struct gspca_dev *gspca_dev, s32 *val); |
99 | static int sd_setcontrast(struct gspca_dev *gspca_dev, s32 val); | 109 | static int sd_setcontrast(struct gspca_dev *gspca_dev, s32 val); |
@@ -403,7 +413,7 @@ static const struct v4l2_pix_format sxga_mode[] = { | |||
403 | .priv = 3 | MODE_RAW | MODE_SXGA}, | 413 | .priv = 3 | MODE_RAW | MODE_SXGA}, |
404 | }; | 414 | }; |
405 | 415 | ||
406 | static const int hsv_red_x[] = { | 416 | static const s16 hsv_red_x[] = { |
407 | 41, 44, 46, 48, 50, 52, 54, 56, | 417 | 41, 44, 46, 48, 50, 52, 54, 56, |
408 | 58, 60, 62, 64, 66, 68, 70, 72, | 418 | 58, 60, 62, 64, 66, 68, 70, 72, |
409 | 74, 76, 78, 80, 81, 83, 85, 87, | 419 | 74, 76, 78, 80, 81, 83, 85, 87, |
@@ -451,7 +461,7 @@ static const int hsv_red_x[] = { | |||
451 | 24, 26, 28, 30, 33, 35, 37, 39, 41 | 461 | 24, 26, 28, 30, 33, 35, 37, 39, 41 |
452 | }; | 462 | }; |
453 | 463 | ||
454 | static const int hsv_red_y[] = { | 464 | static const s16 hsv_red_y[] = { |
455 | 82, 80, 78, 76, 74, 73, 71, 69, | 465 | 82, 80, 78, 76, 74, 73, 71, 69, |
456 | 67, 65, 63, 61, 58, 56, 54, 52, | 466 | 67, 65, 63, 61, 58, 56, 54, 52, |
457 | 50, 48, 46, 44, 41, 39, 37, 35, | 467 | 50, 48, 46, 44, 41, 39, 37, 35, |
@@ -499,7 +509,7 @@ static const int hsv_red_y[] = { | |||
499 | 96, 94, 92, 91, 89, 87, 85, 84, 82 | 509 | 96, 94, 92, 91, 89, 87, 85, 84, 82 |
500 | }; | 510 | }; |
501 | 511 | ||
502 | static const int hsv_green_x[] = { | 512 | static const s16 hsv_green_x[] = { |
503 | -124, -124, -125, -125, -125, -125, -125, -125, | 513 | -124, -124, -125, -125, -125, -125, -125, -125, |
504 | -125, -126, -126, -125, -125, -125, -125, -125, | 514 | -125, -126, -126, -125, -125, -125, -125, -125, |
505 | -125, -124, -124, -124, -123, -123, -122, -122, | 515 | -125, -124, -124, -124, -123, -123, -122, -122, |
@@ -547,7 +557,7 @@ static const int hsv_green_x[] = { | |||
547 | -120, -120, -121, -122, -122, -123, -123, -124, -124 | 557 | -120, -120, -121, -122, -122, -123, -123, -124, -124 |
548 | }; | 558 | }; |
549 | 559 | ||
550 | static const int hsv_green_y[] = { | 560 | static const s16 hsv_green_y[] = { |
551 | -100, -99, -98, -97, -95, -94, -93, -91, | 561 | -100, -99, -98, -97, -95, -94, -93, -91, |
552 | -90, -89, -87, -86, -84, -83, -81, -80, | 562 | -90, -89, -87, -86, -84, -83, -81, -80, |
553 | -78, -76, -75, -73, -71, -70, -68, -66, | 563 | -78, -76, -75, -73, -71, -70, -68, -66, |
@@ -595,7 +605,7 @@ static const int hsv_green_y[] = { | |||
595 | -109, -108, -107, -106, -105, -104, -103, -102, -100 | 605 | -109, -108, -107, -106, -105, -104, -103, -102, -100 |
596 | }; | 606 | }; |
597 | 607 | ||
598 | static const int hsv_blue_x[] = { | 608 | static const s16 hsv_blue_x[] = { |
599 | 112, 113, 114, 114, 115, 116, 117, 117, | 609 | 112, 113, 114, 114, 115, 116, 117, 117, |
600 | 118, 118, 119, 119, 120, 120, 120, 121, | 610 | 118, 118, 119, 119, 120, 120, 120, 121, |
601 | 121, 121, 122, 122, 122, 122, 122, 122, | 611 | 121, 121, 122, 122, 122, 122, 122, 122, |
@@ -643,7 +653,7 @@ static const int hsv_blue_x[] = { | |||
643 | 104, 105, 106, 107, 108, 109, 110, 111, 112 | 653 | 104, 105, 106, 107, 108, 109, 110, 111, 112 |
644 | }; | 654 | }; |
645 | 655 | ||
646 | static const int hsv_blue_y[] = { | 656 | static const s16 hsv_blue_y[] = { |
647 | -11, -13, -15, -17, -19, -21, -23, -25, | 657 | -11, -13, -15, -17, -19, -21, -23, -25, |
648 | -27, -29, -31, -33, -35, -37, -39, -41, | 658 | -27, -29, -31, -33, -35, -37, -39, -41, |
649 | -43, -45, -46, -48, -50, -52, -54, -55, | 659 | -43, -45, -46, -48, -50, -52, -54, -55, |
@@ -792,7 +802,7 @@ static u8 hv7131r_gain[] = { | |||
792 | 0x78 /* 8x */ | 802 | 0x78 /* 8x */ |
793 | }; | 803 | }; |
794 | 804 | ||
795 | static u8 soi968_init[][2] = { | 805 | static struct i2c_reg_u8 soi968_init[] = { |
796 | {0x12, 0x80}, {0x0c, 0x00}, {0x0f, 0x1f}, | 806 | {0x12, 0x80}, {0x0c, 0x00}, {0x0f, 0x1f}, |
797 | {0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00}, | 807 | {0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00}, |
798 | {0x33, 0x08}, {0x35, 0x8c}, {0x36, 0x0c}, | 808 | {0x33, 0x08}, {0x35, 0x8c}, {0x36, 0x0c}, |
@@ -806,7 +816,7 @@ static u8 soi968_init[][2] = { | |||
806 | {0x00, 0x00}, {0x01, 0x80}, {0x02, 0x80}, | 816 | {0x00, 0x00}, {0x01, 0x80}, {0x02, 0x80}, |
807 | }; | 817 | }; |
808 | 818 | ||
809 | static u8 ov7660_init[][2] = { | 819 | static struct i2c_reg_u8 ov7660_init[] = { |
810 | {0x0e, 0x80}, {0x0d, 0x08}, {0x0f, 0xc3}, | 820 | {0x0e, 0x80}, {0x0d, 0x08}, {0x0f, 0xc3}, |
811 | {0x04, 0xc3}, {0x10, 0x40}, {0x11, 0x40}, | 821 | {0x04, 0xc3}, {0x10, 0x40}, {0x11, 0x40}, |
812 | {0x12, 0x05}, {0x13, 0xba}, {0x14, 0x2a}, | 822 | {0x12, 0x05}, {0x13, 0xba}, {0x14, 0x2a}, |
@@ -815,7 +825,7 @@ static u8 ov7660_init[][2] = { | |||
815 | {0x2e, 0x0b}, {0x01, 0x78}, {0x02, 0x50}, | 825 | {0x2e, 0x0b}, {0x01, 0x78}, {0x02, 0x50}, |
816 | }; | 826 | }; |
817 | 827 | ||
818 | static u8 ov7670_init[][2] = { | 828 | static struct i2c_reg_u8 ov7670_init[] = { |
819 | {0x12, 0x80}, {0x11, 0x80}, {0x3a, 0x04}, {0x12, 0x01}, | 829 | {0x12, 0x80}, {0x11, 0x80}, {0x3a, 0x04}, {0x12, 0x01}, |
820 | {0x32, 0xb6}, {0x03, 0x0a}, {0x0c, 0x00}, {0x3e, 0x00}, | 830 | {0x32, 0xb6}, {0x03, 0x0a}, {0x0c, 0x00}, {0x3e, 0x00}, |
821 | {0x70, 0x3a}, {0x71, 0x35}, {0x72, 0x11}, {0x73, 0xf0}, | 831 | {0x70, 0x3a}, {0x71, 0x35}, {0x72, 0x11}, {0x73, 0xf0}, |
@@ -872,7 +882,7 @@ static u8 ov7670_init[][2] = { | |||
872 | {0x93, 0x00}, | 882 | {0x93, 0x00}, |
873 | }; | 883 | }; |
874 | 884 | ||
875 | static u8 ov9650_init[][2] = { | 885 | static struct i2c_reg_u8 ov9650_init[] = { |
876 | {0x12, 0x80}, {0x00, 0x00}, {0x01, 0x78}, | 886 | {0x12, 0x80}, {0x00, 0x00}, {0x01, 0x78}, |
877 | {0x02, 0x78}, {0x03, 0x36}, {0x04, 0x03}, | 887 | {0x02, 0x78}, {0x03, 0x36}, {0x04, 0x03}, |
878 | {0x05, 0x00}, {0x06, 0x00}, {0x08, 0x00}, | 888 | {0x05, 0x00}, {0x06, 0x00}, {0x08, 0x00}, |
@@ -902,7 +912,7 @@ static u8 ov9650_init[][2] = { | |||
902 | {0xaa, 0x92}, {0xab, 0x0a}, | 912 | {0xaa, 0x92}, {0xab, 0x0a}, |
903 | }; | 913 | }; |
904 | 914 | ||
905 | static u8 ov9655_init[][2] = { | 915 | static struct i2c_reg_u8 ov9655_init[] = { |
906 | {0x12, 0x80}, {0x12, 0x01}, {0x0d, 0x00}, {0x0e, 0x61}, | 916 | {0x12, 0x80}, {0x12, 0x01}, {0x0d, 0x00}, {0x0e, 0x61}, |
907 | {0x11, 0x80}, {0x13, 0xba}, {0x14, 0x2e}, {0x16, 0x24}, | 917 | {0x11, 0x80}, {0x13, 0xba}, {0x14, 0x2e}, {0x16, 0x24}, |
908 | {0x1e, 0x04}, {0x1e, 0x04}, {0x1e, 0x04}, {0x27, 0x08}, | 918 | {0x1e, 0x04}, {0x1e, 0x04}, {0x1e, 0x04}, {0x27, 0x08}, |
@@ -939,7 +949,7 @@ static u8 ov9655_init[][2] = { | |||
939 | {0x00, 0x03}, {0x00, 0x0a}, {0x00, 0x10}, {0x00, 0x13}, | 949 | {0x00, 0x03}, {0x00, 0x0a}, {0x00, 0x10}, {0x00, 0x13}, |
940 | }; | 950 | }; |
941 | 951 | ||
942 | static u16 mt9v112_init[][2] = { | 952 | static struct i2c_reg_u16 mt9v112_init[] = { |
943 | {0xf0, 0x0000}, {0x0d, 0x0021}, {0x0d, 0x0020}, | 953 | {0xf0, 0x0000}, {0x0d, 0x0021}, {0x0d, 0x0020}, |
944 | {0x34, 0xc019}, {0x0a, 0x0011}, {0x0b, 0x000b}, | 954 | {0x34, 0xc019}, {0x0a, 0x0011}, {0x0b, 0x000b}, |
945 | {0x20, 0x0703}, {0x35, 0x2022}, {0xf0, 0x0001}, | 955 | {0x20, 0x0703}, {0x35, 0x2022}, {0xf0, 0x0001}, |
@@ -958,7 +968,7 @@ static u16 mt9v112_init[][2] = { | |||
958 | {0x2c, 0x00ae}, {0x2d, 0x00ae}, {0x2e, 0x00ae}, | 968 | {0x2c, 0x00ae}, {0x2d, 0x00ae}, {0x2e, 0x00ae}, |
959 | }; | 969 | }; |
960 | 970 | ||
961 | static u16 mt9v111_init[][2] = { | 971 | static struct i2c_reg_u16 mt9v111_init[] = { |
962 | {0x01, 0x0004}, {0x0d, 0x0001}, {0x0d, 0x0000}, | 972 | {0x01, 0x0004}, {0x0d, 0x0001}, {0x0d, 0x0000}, |
963 | {0x01, 0x0001}, {0x02, 0x0016}, {0x03, 0x01e1}, | 973 | {0x01, 0x0001}, {0x02, 0x0016}, {0x03, 0x01e1}, |
964 | {0x04, 0x0281}, {0x05, 0x0004}, {0x07, 0x3002}, | 974 | {0x04, 0x0281}, {0x05, 0x0004}, {0x07, 0x3002}, |
@@ -985,7 +995,7 @@ static u16 mt9v111_init[][2] = { | |||
985 | {0x0e, 0x0008}, {0x06, 0x002d}, {0x05, 0x0004}, | 995 | {0x0e, 0x0008}, {0x06, 0x002d}, {0x05, 0x0004}, |
986 | }; | 996 | }; |
987 | 997 | ||
988 | static u16 mt9v011_init[][2] = { | 998 | static struct i2c_reg_u16 mt9v011_init[] = { |
989 | {0x07, 0x0002}, {0x0d, 0x0001}, {0x0d, 0x0000}, | 999 | {0x07, 0x0002}, {0x0d, 0x0001}, {0x0d, 0x0000}, |
990 | {0x01, 0x0008}, {0x02, 0x0016}, {0x03, 0x01e1}, | 1000 | {0x01, 0x0008}, {0x02, 0x0016}, {0x03, 0x01e1}, |
991 | {0x04, 0x0281}, {0x05, 0x0083}, {0x06, 0x0006}, | 1001 | {0x04, 0x0281}, {0x05, 0x0083}, {0x06, 0x0006}, |
@@ -1012,7 +1022,7 @@ static u16 mt9v011_init[][2] = { | |||
1012 | {0x06, 0x0029}, {0x05, 0x0009}, | 1022 | {0x06, 0x0029}, {0x05, 0x0009}, |
1013 | }; | 1023 | }; |
1014 | 1024 | ||
1015 | static u16 mt9m001_init[][2] = { | 1025 | static struct i2c_reg_u16 mt9m001_init[] = { |
1016 | {0x0d, 0x0001}, {0x0d, 0x0000}, {0x01, 0x000e}, | 1026 | {0x0d, 0x0001}, {0x0d, 0x0000}, {0x01, 0x000e}, |
1017 | {0x02, 0x0014}, {0x03, 0x03c1}, {0x04, 0x0501}, | 1027 | {0x02, 0x0014}, {0x03, 0x03c1}, {0x04, 0x0501}, |
1018 | {0x05, 0x0083}, {0x06, 0x0006}, {0x0d, 0x0002}, | 1028 | {0x05, 0x0083}, {0x06, 0x0006}, {0x0d, 0x0002}, |
@@ -1025,14 +1035,14 @@ static u16 mt9m001_init[][2] = { | |||
1025 | {0x2e, 0x0029}, {0x07, 0x0002}, | 1035 | {0x2e, 0x0029}, {0x07, 0x0002}, |
1026 | }; | 1036 | }; |
1027 | 1037 | ||
1028 | static u16 mt9m111_init[][2] = { | 1038 | static struct i2c_reg_u16 mt9m111_init[] = { |
1029 | {0xf0, 0x0000}, {0x0d, 0x0008}, {0x0d, 0x0009}, | 1039 | {0xf0, 0x0000}, {0x0d, 0x0008}, {0x0d, 0x0009}, |
1030 | {0x0d, 0x0008}, {0xf0, 0x0001}, {0x3a, 0x4300}, | 1040 | {0x0d, 0x0008}, {0xf0, 0x0001}, {0x3a, 0x4300}, |
1031 | {0x9b, 0x4300}, {0xa1, 0x0280}, {0xa4, 0x0200}, | 1041 | {0x9b, 0x4300}, {0xa1, 0x0280}, {0xa4, 0x0200}, |
1032 | {0x06, 0x308e}, {0xf0, 0x0000}, | 1042 | {0x06, 0x308e}, {0xf0, 0x0000}, |
1033 | }; | 1043 | }; |
1034 | 1044 | ||
1035 | static u8 hv7131r_init[][2] = { | 1045 | static struct i2c_reg_u8 hv7131r_init[] = { |
1036 | {0x02, 0x08}, {0x02, 0x00}, {0x01, 0x08}, | 1046 | {0x02, 0x08}, {0x02, 0x00}, {0x01, 0x08}, |
1037 | {0x02, 0x00}, {0x20, 0x00}, {0x21, 0xd0}, | 1047 | {0x02, 0x00}, {0x20, 0x00}, {0x21, 0xd0}, |
1038 | {0x22, 0x00}, {0x23, 0x09}, {0x01, 0x08}, | 1048 | {0x22, 0x00}, {0x23, 0x09}, {0x01, 0x08}, |
@@ -1043,7 +1053,7 @@ static u8 hv7131r_init[][2] = { | |||
1043 | {0x23, 0x09}, {0x01, 0x08}, | 1053 | {0x23, 0x09}, {0x01, 0x08}, |
1044 | }; | 1054 | }; |
1045 | 1055 | ||
1046 | int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) | 1056 | static int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) |
1047 | { | 1057 | { |
1048 | struct usb_device *dev = gspca_dev->dev; | 1058 | struct usb_device *dev = gspca_dev->dev; |
1049 | int result; | 1059 | int result; |
@@ -1062,7 +1072,8 @@ int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) | |||
1062 | return 0; | 1072 | return 0; |
1063 | } | 1073 | } |
1064 | 1074 | ||
1065 | int reg_w(struct gspca_dev *gspca_dev, u16 reg, const u8 *buffer, int length) | 1075 | static int reg_w(struct gspca_dev *gspca_dev, u16 reg, |
1076 | const u8 *buffer, int length) | ||
1066 | { | 1077 | { |
1067 | struct usb_device *dev = gspca_dev->dev; | 1078 | struct usb_device *dev = gspca_dev->dev; |
1068 | int result; | 1079 | int result; |
@@ -1082,13 +1093,13 @@ int reg_w(struct gspca_dev *gspca_dev, u16 reg, const u8 *buffer, int length) | |||
1082 | return 0; | 1093 | return 0; |
1083 | } | 1094 | } |
1084 | 1095 | ||
1085 | int reg_w1(struct gspca_dev *gspca_dev, u16 reg, const u8 value) | 1096 | static int reg_w1(struct gspca_dev *gspca_dev, u16 reg, const u8 value) |
1086 | { | 1097 | { |
1087 | u8 data[1] = {value}; | 1098 | u8 data[1] = {value}; |
1088 | return reg_w(gspca_dev, reg, data, 1); | 1099 | return reg_w(gspca_dev, reg, data, 1); |
1089 | } | 1100 | } |
1090 | 1101 | ||
1091 | int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) | 1102 | static int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) |
1092 | { | 1103 | { |
1093 | int i; | 1104 | int i; |
1094 | reg_w(gspca_dev, 0x10c0, buffer, 8); | 1105 | reg_w(gspca_dev, 0x10c0, buffer, 8); |
@@ -1104,7 +1115,7 @@ int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) | |||
1104 | return -EIO; | 1115 | return -EIO; |
1105 | } | 1116 | } |
1106 | 1117 | ||
1107 | int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) | 1118 | static int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) |
1108 | { | 1119 | { |
1109 | struct sd *sd = (struct sd *) gspca_dev; | 1120 | struct sd *sd = (struct sd *) gspca_dev; |
1110 | 1121 | ||
@@ -1126,7 +1137,7 @@ int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) | |||
1126 | return i2c_w(gspca_dev, row); | 1137 | return i2c_w(gspca_dev, row); |
1127 | } | 1138 | } |
1128 | 1139 | ||
1129 | int i2c_w2(struct gspca_dev *gspca_dev, u8 reg, u16 val) | 1140 | static int i2c_w2(struct gspca_dev *gspca_dev, u8 reg, u16 val) |
1130 | { | 1141 | { |
1131 | struct sd *sd = (struct sd *) gspca_dev; | 1142 | struct sd *sd = (struct sd *) gspca_dev; |
1132 | u8 row[8]; | 1143 | u8 row[8]; |
@@ -1203,8 +1214,8 @@ static int ov9650_init_sensor(struct gspca_dev *gspca_dev) | |||
1203 | struct sd *sd = (struct sd *) gspca_dev; | 1214 | struct sd *sd = (struct sd *) gspca_dev; |
1204 | 1215 | ||
1205 | for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { | 1216 | for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { |
1206 | if (i2c_w1(gspca_dev, ov9650_init[i][0], | 1217 | if (i2c_w1(gspca_dev, ov9650_init[i].reg, |
1207 | ov9650_init[i][1]) < 0) { | 1218 | ov9650_init[i].val) < 0) { |
1208 | err("OV9650 sensor initialization failed"); | 1219 | err("OV9650 sensor initialization failed"); |
1209 | return -ENODEV; | 1220 | return -ENODEV; |
1210 | } | 1221 | } |
@@ -1220,8 +1231,8 @@ static int ov9655_init_sensor(struct gspca_dev *gspca_dev) | |||
1220 | struct sd *sd = (struct sd *) gspca_dev; | 1231 | struct sd *sd = (struct sd *) gspca_dev; |
1221 | 1232 | ||
1222 | for (i = 0; i < ARRAY_SIZE(ov9655_init); i++) { | 1233 | for (i = 0; i < ARRAY_SIZE(ov9655_init); i++) { |
1223 | if (i2c_w1(gspca_dev, ov9655_init[i][0], | 1234 | if (i2c_w1(gspca_dev, ov9655_init[i].reg, |
1224 | ov9655_init[i][1]) < 0) { | 1235 | ov9655_init[i].val) < 0) { |
1225 | err("OV9655 sensor initialization failed"); | 1236 | err("OV9655 sensor initialization failed"); |
1226 | return -ENODEV; | 1237 | return -ENODEV; |
1227 | } | 1238 | } |
@@ -1239,8 +1250,8 @@ static int soi968_init_sensor(struct gspca_dev *gspca_dev) | |||
1239 | struct sd *sd = (struct sd *) gspca_dev; | 1250 | struct sd *sd = (struct sd *) gspca_dev; |
1240 | 1251 | ||
1241 | for (i = 0; i < ARRAY_SIZE(soi968_init); i++) { | 1252 | for (i = 0; i < ARRAY_SIZE(soi968_init); i++) { |
1242 | if (i2c_w1(gspca_dev, soi968_init[i][0], | 1253 | if (i2c_w1(gspca_dev, soi968_init[i].reg, |
1243 | soi968_init[i][1]) < 0) { | 1254 | soi968_init[i].val) < 0) { |
1244 | err("SOI968 sensor initialization failed"); | 1255 | err("SOI968 sensor initialization failed"); |
1245 | return -ENODEV; | 1256 | return -ENODEV; |
1246 | } | 1257 | } |
@@ -1258,8 +1269,8 @@ static int ov7660_init_sensor(struct gspca_dev *gspca_dev) | |||
1258 | struct sd *sd = (struct sd *) gspca_dev; | 1269 | struct sd *sd = (struct sd *) gspca_dev; |
1259 | 1270 | ||
1260 | for (i = 0; i < ARRAY_SIZE(ov7660_init); i++) { | 1271 | for (i = 0; i < ARRAY_SIZE(ov7660_init); i++) { |
1261 | if (i2c_w1(gspca_dev, ov7660_init[i][0], | 1272 | if (i2c_w1(gspca_dev, ov7660_init[i].reg, |
1262 | ov7660_init[i][1]) < 0) { | 1273 | ov7660_init[i].val) < 0) { |
1263 | err("OV7660 sensor initialization failed"); | 1274 | err("OV7660 sensor initialization failed"); |
1264 | return -ENODEV; | 1275 | return -ENODEV; |
1265 | } | 1276 | } |
@@ -1277,8 +1288,8 @@ static int ov7670_init_sensor(struct gspca_dev *gspca_dev) | |||
1277 | struct sd *sd = (struct sd *) gspca_dev; | 1288 | struct sd *sd = (struct sd *) gspca_dev; |
1278 | 1289 | ||
1279 | for (i = 0; i < ARRAY_SIZE(ov7670_init); i++) { | 1290 | for (i = 0; i < ARRAY_SIZE(ov7670_init); i++) { |
1280 | if (i2c_w1(gspca_dev, ov7670_init[i][0], | 1291 | if (i2c_w1(gspca_dev, ov7670_init[i].reg, |
1281 | ov7670_init[i][1]) < 0) { | 1292 | ov7670_init[i].val) < 0) { |
1282 | err("OV7670 sensor initialization failed"); | 1293 | err("OV7670 sensor initialization failed"); |
1283 | return -ENODEV; | 1294 | return -ENODEV; |
1284 | } | 1295 | } |
@@ -1301,8 +1312,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) | |||
1301 | ret = i2c_r2(gspca_dev, 0xff, &value); | 1312 | ret = i2c_r2(gspca_dev, 0xff, &value); |
1302 | if ((ret == 0) && (value == 0x8243)) { | 1313 | if ((ret == 0) && (value == 0x8243)) { |
1303 | for (i = 0; i < ARRAY_SIZE(mt9v011_init); i++) { | 1314 | for (i = 0; i < ARRAY_SIZE(mt9v011_init); i++) { |
1304 | if (i2c_w2(gspca_dev, mt9v011_init[i][0], | 1315 | if (i2c_w2(gspca_dev, mt9v011_init[i].reg, |
1305 | mt9v011_init[i][1]) < 0) { | 1316 | mt9v011_init[i].val) < 0) { |
1306 | err("MT9V011 sensor initialization failed"); | 1317 | err("MT9V011 sensor initialization failed"); |
1307 | return -ENODEV; | 1318 | return -ENODEV; |
1308 | } | 1319 | } |
@@ -1319,8 +1330,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) | |||
1319 | ret = i2c_r2(gspca_dev, 0xff, &value); | 1330 | ret = i2c_r2(gspca_dev, 0xff, &value); |
1320 | if ((ret == 0) && (value == 0x823a)) { | 1331 | if ((ret == 0) && (value == 0x823a)) { |
1321 | for (i = 0; i < ARRAY_SIZE(mt9v111_init); i++) { | 1332 | for (i = 0; i < ARRAY_SIZE(mt9v111_init); i++) { |
1322 | if (i2c_w2(gspca_dev, mt9v111_init[i][0], | 1333 | if (i2c_w2(gspca_dev, mt9v111_init[i].reg, |
1323 | mt9v111_init[i][1]) < 0) { | 1334 | mt9v111_init[i].val) < 0) { |
1324 | err("MT9V111 sensor initialization failed"); | 1335 | err("MT9V111 sensor initialization failed"); |
1325 | return -ENODEV; | 1336 | return -ENODEV; |
1326 | } | 1337 | } |
@@ -1341,8 +1352,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) | |||
1341 | ret = i2c_r2(gspca_dev, 0x00, &value); | 1352 | ret = i2c_r2(gspca_dev, 0x00, &value); |
1342 | if ((ret == 0) && (value == 0x1229)) { | 1353 | if ((ret == 0) && (value == 0x1229)) { |
1343 | for (i = 0; i < ARRAY_SIZE(mt9v112_init); i++) { | 1354 | for (i = 0; i < ARRAY_SIZE(mt9v112_init); i++) { |
1344 | if (i2c_w2(gspca_dev, mt9v112_init[i][0], | 1355 | if (i2c_w2(gspca_dev, mt9v112_init[i].reg, |
1345 | mt9v112_init[i][1]) < 0) { | 1356 | mt9v112_init[i].val) < 0) { |
1346 | err("MT9V112 sensor initialization failed"); | 1357 | err("MT9V112 sensor initialization failed"); |
1347 | return -ENODEV; | 1358 | return -ENODEV; |
1348 | } | 1359 | } |
@@ -1362,8 +1373,8 @@ static int mt9m111_init_sensor(struct gspca_dev *gspca_dev) | |||
1362 | struct sd *sd = (struct sd *) gspca_dev; | 1373 | struct sd *sd = (struct sd *) gspca_dev; |
1363 | int i; | 1374 | int i; |
1364 | for (i = 0; i < ARRAY_SIZE(mt9m111_init); i++) { | 1375 | for (i = 0; i < ARRAY_SIZE(mt9m111_init); i++) { |
1365 | if (i2c_w2(gspca_dev, mt9m111_init[i][0], | 1376 | if (i2c_w2(gspca_dev, mt9m111_init[i].reg, |
1366 | mt9m111_init[i][1]) < 0) { | 1377 | mt9m111_init[i].val) < 0) { |
1367 | err("MT9M111 sensor initialization failed"); | 1378 | err("MT9M111 sensor initialization failed"); |
1368 | return -ENODEV; | 1379 | return -ENODEV; |
1369 | } | 1380 | } |
@@ -1378,8 +1389,8 @@ static int mt9m001_init_sensor(struct gspca_dev *gspca_dev) | |||
1378 | struct sd *sd = (struct sd *) gspca_dev; | 1389 | struct sd *sd = (struct sd *) gspca_dev; |
1379 | int i; | 1390 | int i; |
1380 | for (i = 0; i < ARRAY_SIZE(mt9m001_init); i++) { | 1391 | for (i = 0; i < ARRAY_SIZE(mt9m001_init); i++) { |
1381 | if (i2c_w2(gspca_dev, mt9m001_init[i][0], | 1392 | if (i2c_w2(gspca_dev, mt9m001_init[i].reg, |
1382 | mt9m001_init[i][1]) < 0) { | 1393 | mt9m001_init[i].val) < 0) { |
1383 | err("MT9M001 sensor initialization failed"); | 1394 | err("MT9M001 sensor initialization failed"); |
1384 | return -ENODEV; | 1395 | return -ENODEV; |
1385 | } | 1396 | } |
@@ -1397,8 +1408,8 @@ static int hv7131r_init_sensor(struct gspca_dev *gspca_dev) | |||
1397 | struct sd *sd = (struct sd *) gspca_dev; | 1408 | struct sd *sd = (struct sd *) gspca_dev; |
1398 | 1409 | ||
1399 | for (i = 0; i < ARRAY_SIZE(hv7131r_init); i++) { | 1410 | for (i = 0; i < ARRAY_SIZE(hv7131r_init); i++) { |
1400 | if (i2c_w1(gspca_dev, hv7131r_init[i][0], | 1411 | if (i2c_w1(gspca_dev, hv7131r_init[i].reg, |
1401 | hv7131r_init[i][1]) < 0) { | 1412 | hv7131r_init[i].val) < 0) { |
1402 | err("HV7131R Sensor initialization failed"); | 1413 | err("HV7131R Sensor initialization failed"); |
1403 | return -ENODEV; | 1414 | return -ENODEV; |
1404 | } | 1415 | } |