Commit 58aa68c2 authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab

V4L/DVB (12703): gspca - sn9c20x: Reduces size of object

Use s16 instead of int where possible.
Use struct instead of arrays
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarBrian Johnson <brijohn@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e1430471
...@@ -94,6 +94,16 @@ struct sd { ...@@ -94,6 +94,16 @@ struct sd {
#endif #endif
}; };
struct i2c_reg_u8 {
u8 reg;
u8 val;
};
struct i2c_reg_u16 {
u8 reg;
u16 val;
};
static int sd_setbrightness(struct gspca_dev *gspca_dev, s32 val); static int sd_setbrightness(struct gspca_dev *gspca_dev, s32 val);
static int sd_getbrightness(struct gspca_dev *gspca_dev, s32 *val); static int sd_getbrightness(struct gspca_dev *gspca_dev, s32 *val);
static int sd_setcontrast(struct gspca_dev *gspca_dev, s32 val); static int sd_setcontrast(struct gspca_dev *gspca_dev, s32 val);
...@@ -403,7 +413,7 @@ static const struct v4l2_pix_format sxga_mode[] = { ...@@ -403,7 +413,7 @@ static const struct v4l2_pix_format sxga_mode[] = {
.priv = 3 | MODE_RAW | MODE_SXGA}, .priv = 3 | MODE_RAW | MODE_SXGA},
}; };
static const int hsv_red_x[] = { static const s16 hsv_red_x[] = {
41, 44, 46, 48, 50, 52, 54, 56, 41, 44, 46, 48, 50, 52, 54, 56,
58, 60, 62, 64, 66, 68, 70, 72, 58, 60, 62, 64, 66, 68, 70, 72,
74, 76, 78, 80, 81, 83, 85, 87, 74, 76, 78, 80, 81, 83, 85, 87,
...@@ -451,7 +461,7 @@ static const int hsv_red_x[] = { ...@@ -451,7 +461,7 @@ static const int hsv_red_x[] = {
24, 26, 28, 30, 33, 35, 37, 39, 41 24, 26, 28, 30, 33, 35, 37, 39, 41
}; };
static const int hsv_red_y[] = { static const s16 hsv_red_y[] = {
82, 80, 78, 76, 74, 73, 71, 69, 82, 80, 78, 76, 74, 73, 71, 69,
67, 65, 63, 61, 58, 56, 54, 52, 67, 65, 63, 61, 58, 56, 54, 52,
50, 48, 46, 44, 41, 39, 37, 35, 50, 48, 46, 44, 41, 39, 37, 35,
...@@ -499,7 +509,7 @@ static const int hsv_red_y[] = { ...@@ -499,7 +509,7 @@ static const int hsv_red_y[] = {
96, 94, 92, 91, 89, 87, 85, 84, 82 96, 94, 92, 91, 89, 87, 85, 84, 82
}; };
static const int hsv_green_x[] = { static const s16 hsv_green_x[] = {
-124, -124, -125, -125, -125, -125, -125, -125, -124, -124, -125, -125, -125, -125, -125, -125,
-125, -126, -126, -125, -125, -125, -125, -125, -125, -126, -126, -125, -125, -125, -125, -125,
-125, -124, -124, -124, -123, -123, -122, -122, -125, -124, -124, -124, -123, -123, -122, -122,
...@@ -547,7 +557,7 @@ static const int hsv_green_x[] = { ...@@ -547,7 +557,7 @@ static const int hsv_green_x[] = {
-120, -120, -121, -122, -122, -123, -123, -124, -124 -120, -120, -121, -122, -122, -123, -123, -124, -124
}; };
static const int hsv_green_y[] = { static const s16 hsv_green_y[] = {
-100, -99, -98, -97, -95, -94, -93, -91, -100, -99, -98, -97, -95, -94, -93, -91,
-90, -89, -87, -86, -84, -83, -81, -80, -90, -89, -87, -86, -84, -83, -81, -80,
-78, -76, -75, -73, -71, -70, -68, -66, -78, -76, -75, -73, -71, -70, -68, -66,
...@@ -595,7 +605,7 @@ static const int hsv_green_y[] = { ...@@ -595,7 +605,7 @@ static const int hsv_green_y[] = {
-109, -108, -107, -106, -105, -104, -103, -102, -100 -109, -108, -107, -106, -105, -104, -103, -102, -100
}; };
static const int hsv_blue_x[] = { static const s16 hsv_blue_x[] = {
112, 113, 114, 114, 115, 116, 117, 117, 112, 113, 114, 114, 115, 116, 117, 117,
118, 118, 119, 119, 120, 120, 120, 121, 118, 118, 119, 119, 120, 120, 120, 121,
121, 121, 122, 122, 122, 122, 122, 122, 121, 121, 122, 122, 122, 122, 122, 122,
...@@ -643,7 +653,7 @@ static const int hsv_blue_x[] = { ...@@ -643,7 +653,7 @@ static const int hsv_blue_x[] = {
104, 105, 106, 107, 108, 109, 110, 111, 112 104, 105, 106, 107, 108, 109, 110, 111, 112
}; };
static const int hsv_blue_y[] = { static const s16 hsv_blue_y[] = {
-11, -13, -15, -17, -19, -21, -23, -25, -11, -13, -15, -17, -19, -21, -23, -25,
-27, -29, -31, -33, -35, -37, -39, -41, -27, -29, -31, -33, -35, -37, -39, -41,
-43, -45, -46, -48, -50, -52, -54, -55, -43, -45, -46, -48, -50, -52, -54, -55,
...@@ -792,7 +802,7 @@ static u8 hv7131r_gain[] = { ...@@ -792,7 +802,7 @@ static u8 hv7131r_gain[] = {
0x78 /* 8x */ 0x78 /* 8x */
}; };
static u8 soi968_init[][2] = { static struct i2c_reg_u8 soi968_init[] = {
{0x12, 0x80}, {0x0c, 0x00}, {0x0f, 0x1f}, {0x12, 0x80}, {0x0c, 0x00}, {0x0f, 0x1f},
{0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00}, {0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00},
{0x33, 0x08}, {0x35, 0x8c}, {0x36, 0x0c}, {0x33, 0x08}, {0x35, 0x8c}, {0x36, 0x0c},
...@@ -806,7 +816,7 @@ static u8 soi968_init[][2] = { ...@@ -806,7 +816,7 @@ static u8 soi968_init[][2] = {
{0x00, 0x00}, {0x01, 0x80}, {0x02, 0x80}, {0x00, 0x00}, {0x01, 0x80}, {0x02, 0x80},
}; };
static u8 ov7660_init[][2] = { static struct i2c_reg_u8 ov7660_init[] = {
{0x0e, 0x80}, {0x0d, 0x08}, {0x0f, 0xc3}, {0x0e, 0x80}, {0x0d, 0x08}, {0x0f, 0xc3},
{0x04, 0xc3}, {0x10, 0x40}, {0x11, 0x40}, {0x04, 0xc3}, {0x10, 0x40}, {0x11, 0x40},
{0x12, 0x05}, {0x13, 0xba}, {0x14, 0x2a}, {0x12, 0x05}, {0x13, 0xba}, {0x14, 0x2a},
...@@ -815,7 +825,7 @@ static u8 ov7660_init[][2] = { ...@@ -815,7 +825,7 @@ static u8 ov7660_init[][2] = {
{0x2e, 0x0b}, {0x01, 0x78}, {0x02, 0x50}, {0x2e, 0x0b}, {0x01, 0x78}, {0x02, 0x50},
}; };
static u8 ov7670_init[][2] = { static struct i2c_reg_u8 ov7670_init[] = {
{0x12, 0x80}, {0x11, 0x80}, {0x3a, 0x04}, {0x12, 0x01}, {0x12, 0x80}, {0x11, 0x80}, {0x3a, 0x04}, {0x12, 0x01},
{0x32, 0xb6}, {0x03, 0x0a}, {0x0c, 0x00}, {0x3e, 0x00}, {0x32, 0xb6}, {0x03, 0x0a}, {0x0c, 0x00}, {0x3e, 0x00},
{0x70, 0x3a}, {0x71, 0x35}, {0x72, 0x11}, {0x73, 0xf0}, {0x70, 0x3a}, {0x71, 0x35}, {0x72, 0x11}, {0x73, 0xf0},
...@@ -872,7 +882,7 @@ static u8 ov7670_init[][2] = { ...@@ -872,7 +882,7 @@ static u8 ov7670_init[][2] = {
{0x93, 0x00}, {0x93, 0x00},
}; };
static u8 ov9650_init[][2] = { static struct i2c_reg_u8 ov9650_init[] = {
{0x12, 0x80}, {0x00, 0x00}, {0x01, 0x78}, {0x12, 0x80}, {0x00, 0x00}, {0x01, 0x78},
{0x02, 0x78}, {0x03, 0x36}, {0x04, 0x03}, {0x02, 0x78}, {0x03, 0x36}, {0x04, 0x03},
{0x05, 0x00}, {0x06, 0x00}, {0x08, 0x00}, {0x05, 0x00}, {0x06, 0x00}, {0x08, 0x00},
...@@ -902,7 +912,7 @@ static u8 ov9650_init[][2] = { ...@@ -902,7 +912,7 @@ static u8 ov9650_init[][2] = {
{0xaa, 0x92}, {0xab, 0x0a}, {0xaa, 0x92}, {0xab, 0x0a},
}; };
static u8 ov9655_init[][2] = { static struct i2c_reg_u8 ov9655_init[] = {
{0x12, 0x80}, {0x12, 0x01}, {0x0d, 0x00}, {0x0e, 0x61}, {0x12, 0x80}, {0x12, 0x01}, {0x0d, 0x00}, {0x0e, 0x61},
{0x11, 0x80}, {0x13, 0xba}, {0x14, 0x2e}, {0x16, 0x24}, {0x11, 0x80}, {0x13, 0xba}, {0x14, 0x2e}, {0x16, 0x24},
{0x1e, 0x04}, {0x1e, 0x04}, {0x1e, 0x04}, {0x27, 0x08}, {0x1e, 0x04}, {0x1e, 0x04}, {0x1e, 0x04}, {0x27, 0x08},
...@@ -939,7 +949,7 @@ static u8 ov9655_init[][2] = { ...@@ -939,7 +949,7 @@ static u8 ov9655_init[][2] = {
{0x00, 0x03}, {0x00, 0x0a}, {0x00, 0x10}, {0x00, 0x13}, {0x00, 0x03}, {0x00, 0x0a}, {0x00, 0x10}, {0x00, 0x13},
}; };
static u16 mt9v112_init[][2] = { static struct i2c_reg_u16 mt9v112_init[] = {
{0xf0, 0x0000}, {0x0d, 0x0021}, {0x0d, 0x0020}, {0xf0, 0x0000}, {0x0d, 0x0021}, {0x0d, 0x0020},
{0x34, 0xc019}, {0x0a, 0x0011}, {0x0b, 0x000b}, {0x34, 0xc019}, {0x0a, 0x0011}, {0x0b, 0x000b},
{0x20, 0x0703}, {0x35, 0x2022}, {0xf0, 0x0001}, {0x20, 0x0703}, {0x35, 0x2022}, {0xf0, 0x0001},
...@@ -958,7 +968,7 @@ static u16 mt9v112_init[][2] = { ...@@ -958,7 +968,7 @@ static u16 mt9v112_init[][2] = {
{0x2c, 0x00ae}, {0x2d, 0x00ae}, {0x2e, 0x00ae}, {0x2c, 0x00ae}, {0x2d, 0x00ae}, {0x2e, 0x00ae},
}; };
static u16 mt9v111_init[][2] = { static struct i2c_reg_u16 mt9v111_init[] = {
{0x01, 0x0004}, {0x0d, 0x0001}, {0x0d, 0x0000}, {0x01, 0x0004}, {0x0d, 0x0001}, {0x0d, 0x0000},
{0x01, 0x0001}, {0x02, 0x0016}, {0x03, 0x01e1}, {0x01, 0x0001}, {0x02, 0x0016}, {0x03, 0x01e1},
{0x04, 0x0281}, {0x05, 0x0004}, {0x07, 0x3002}, {0x04, 0x0281}, {0x05, 0x0004}, {0x07, 0x3002},
...@@ -985,7 +995,7 @@ static u16 mt9v111_init[][2] = { ...@@ -985,7 +995,7 @@ static u16 mt9v111_init[][2] = {
{0x0e, 0x0008}, {0x06, 0x002d}, {0x05, 0x0004}, {0x0e, 0x0008}, {0x06, 0x002d}, {0x05, 0x0004},
}; };
static u16 mt9v011_init[][2] = { static struct i2c_reg_u16 mt9v011_init[] = {
{0x07, 0x0002}, {0x0d, 0x0001}, {0x0d, 0x0000}, {0x07, 0x0002}, {0x0d, 0x0001}, {0x0d, 0x0000},
{0x01, 0x0008}, {0x02, 0x0016}, {0x03, 0x01e1}, {0x01, 0x0008}, {0x02, 0x0016}, {0x03, 0x01e1},
{0x04, 0x0281}, {0x05, 0x0083}, {0x06, 0x0006}, {0x04, 0x0281}, {0x05, 0x0083}, {0x06, 0x0006},
...@@ -1012,7 +1022,7 @@ static u16 mt9v011_init[][2] = { ...@@ -1012,7 +1022,7 @@ static u16 mt9v011_init[][2] = {
{0x06, 0x0029}, {0x05, 0x0009}, {0x06, 0x0029}, {0x05, 0x0009},
}; };
static u16 mt9m001_init[][2] = { static struct i2c_reg_u16 mt9m001_init[] = {
{0x0d, 0x0001}, {0x0d, 0x0000}, {0x01, 0x000e}, {0x0d, 0x0001}, {0x0d, 0x0000}, {0x01, 0x000e},
{0x02, 0x0014}, {0x03, 0x03c1}, {0x04, 0x0501}, {0x02, 0x0014}, {0x03, 0x03c1}, {0x04, 0x0501},
{0x05, 0x0083}, {0x06, 0x0006}, {0x0d, 0x0002}, {0x05, 0x0083}, {0x06, 0x0006}, {0x0d, 0x0002},
...@@ -1025,14 +1035,14 @@ static u16 mt9m001_init[][2] = { ...@@ -1025,14 +1035,14 @@ static u16 mt9m001_init[][2] = {
{0x2e, 0x0029}, {0x07, 0x0002}, {0x2e, 0x0029}, {0x07, 0x0002},
}; };
static u16 mt9m111_init[][2] = { static struct i2c_reg_u16 mt9m111_init[] = {
{0xf0, 0x0000}, {0x0d, 0x0008}, {0x0d, 0x0009}, {0xf0, 0x0000}, {0x0d, 0x0008}, {0x0d, 0x0009},
{0x0d, 0x0008}, {0xf0, 0x0001}, {0x3a, 0x4300}, {0x0d, 0x0008}, {0xf0, 0x0001}, {0x3a, 0x4300},
{0x9b, 0x4300}, {0xa1, 0x0280}, {0xa4, 0x0200}, {0x9b, 0x4300}, {0xa1, 0x0280}, {0xa4, 0x0200},
{0x06, 0x308e}, {0xf0, 0x0000}, {0x06, 0x308e}, {0xf0, 0x0000},
}; };
static u8 hv7131r_init[][2] = { static struct i2c_reg_u8 hv7131r_init[] = {
{0x02, 0x08}, {0x02, 0x00}, {0x01, 0x08}, {0x02, 0x08}, {0x02, 0x00}, {0x01, 0x08},
{0x02, 0x00}, {0x20, 0x00}, {0x21, 0xd0}, {0x02, 0x00}, {0x20, 0x00}, {0x21, 0xd0},
{0x22, 0x00}, {0x23, 0x09}, {0x01, 0x08}, {0x22, 0x00}, {0x23, 0x09}, {0x01, 0x08},
...@@ -1043,7 +1053,7 @@ static u8 hv7131r_init[][2] = { ...@@ -1043,7 +1053,7 @@ static u8 hv7131r_init[][2] = {
{0x23, 0x09}, {0x01, 0x08}, {0x23, 0x09}, {0x01, 0x08},
}; };
int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) static int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length)
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
int result; int result;
...@@ -1062,7 +1072,8 @@ int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) ...@@ -1062,7 +1072,8 @@ int reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length)
return 0; return 0;
} }
int reg_w(struct gspca_dev *gspca_dev, u16 reg, const u8 *buffer, int length) static int reg_w(struct gspca_dev *gspca_dev, u16 reg,
const u8 *buffer, int length)
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
int result; int result;
...@@ -1082,13 +1093,13 @@ int reg_w(struct gspca_dev *gspca_dev, u16 reg, const u8 *buffer, int length) ...@@ -1082,13 +1093,13 @@ int reg_w(struct gspca_dev *gspca_dev, u16 reg, const u8 *buffer, int length)
return 0; return 0;
} }
int reg_w1(struct gspca_dev *gspca_dev, u16 reg, const u8 value) static int reg_w1(struct gspca_dev *gspca_dev, u16 reg, const u8 value)
{ {
u8 data[1] = {value}; u8 data[1] = {value};
return reg_w(gspca_dev, reg, data, 1); return reg_w(gspca_dev, reg, data, 1);
} }
int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) static int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer)
{ {
int i; int i;
reg_w(gspca_dev, 0x10c0, buffer, 8); reg_w(gspca_dev, 0x10c0, buffer, 8);
...@@ -1104,7 +1115,7 @@ int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) ...@@ -1104,7 +1115,7 @@ int i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer)
return -EIO; return -EIO;
} }
int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) static int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
...@@ -1126,7 +1137,7 @@ int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) ...@@ -1126,7 +1137,7 @@ int i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
return i2c_w(gspca_dev, row); return i2c_w(gspca_dev, row);
} }
int i2c_w2(struct gspca_dev *gspca_dev, u8 reg, u16 val) static int i2c_w2(struct gspca_dev *gspca_dev, u8 reg, u16 val)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
u8 row[8]; u8 row[8];
...@@ -1203,8 +1214,8 @@ static int ov9650_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1203,8 +1214,8 @@ static int ov9650_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) {
if (i2c_w1(gspca_dev, ov9650_init[i][0], if (i2c_w1(gspca_dev, ov9650_init[i].reg,
ov9650_init[i][1]) < 0) { ov9650_init[i].val) < 0) {
err("OV9650 sensor initialization failed"); err("OV9650 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1220,8 +1231,8 @@ static int ov9655_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1220,8 +1231,8 @@ static int ov9655_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(ov9655_init); i++) { for (i = 0; i < ARRAY_SIZE(ov9655_init); i++) {
if (i2c_w1(gspca_dev, ov9655_init[i][0], if (i2c_w1(gspca_dev, ov9655_init[i].reg,
ov9655_init[i][1]) < 0) { ov9655_init[i].val) < 0) {
err("OV9655 sensor initialization failed"); err("OV9655 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1239,8 +1250,8 @@ static int soi968_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1239,8 +1250,8 @@ static int soi968_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(soi968_init); i++) { for (i = 0; i < ARRAY_SIZE(soi968_init); i++) {
if (i2c_w1(gspca_dev, soi968_init[i][0], if (i2c_w1(gspca_dev, soi968_init[i].reg,
soi968_init[i][1]) < 0) { soi968_init[i].val) < 0) {
err("SOI968 sensor initialization failed"); err("SOI968 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1258,8 +1269,8 @@ static int ov7660_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1258,8 +1269,8 @@ static int ov7660_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(ov7660_init); i++) { for (i = 0; i < ARRAY_SIZE(ov7660_init); i++) {
if (i2c_w1(gspca_dev, ov7660_init[i][0], if (i2c_w1(gspca_dev, ov7660_init[i].reg,
ov7660_init[i][1]) < 0) { ov7660_init[i].val) < 0) {
err("OV7660 sensor initialization failed"); err("OV7660 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1277,8 +1288,8 @@ static int ov7670_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1277,8 +1288,8 @@ static int ov7670_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(ov7670_init); i++) { for (i = 0; i < ARRAY_SIZE(ov7670_init); i++) {
if (i2c_w1(gspca_dev, ov7670_init[i][0], if (i2c_w1(gspca_dev, ov7670_init[i].reg,
ov7670_init[i][1]) < 0) { ov7670_init[i].val) < 0) {
err("OV7670 sensor initialization failed"); err("OV7670 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1301,8 +1312,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1301,8 +1312,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev)
ret = i2c_r2(gspca_dev, 0xff, &value); ret = i2c_r2(gspca_dev, 0xff, &value);
if ((ret == 0) && (value == 0x8243)) { if ((ret == 0) && (value == 0x8243)) {
for (i = 0; i < ARRAY_SIZE(mt9v011_init); i++) { for (i = 0; i < ARRAY_SIZE(mt9v011_init); i++) {
if (i2c_w2(gspca_dev, mt9v011_init[i][0], if (i2c_w2(gspca_dev, mt9v011_init[i].reg,
mt9v011_init[i][1]) < 0) { mt9v011_init[i].val) < 0) {
err("MT9V011 sensor initialization failed"); err("MT9V011 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1319,8 +1330,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1319,8 +1330,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev)
ret = i2c_r2(gspca_dev, 0xff, &value); ret = i2c_r2(gspca_dev, 0xff, &value);
if ((ret == 0) && (value == 0x823a)) { if ((ret == 0) && (value == 0x823a)) {
for (i = 0; i < ARRAY_SIZE(mt9v111_init); i++) { for (i = 0; i < ARRAY_SIZE(mt9v111_init); i++) {
if (i2c_w2(gspca_dev, mt9v111_init[i][0], if (i2c_w2(gspca_dev, mt9v111_init[i].reg,
mt9v111_init[i][1]) < 0) { mt9v111_init[i].val) < 0) {
err("MT9V111 sensor initialization failed"); err("MT9V111 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1341,8 +1352,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1341,8 +1352,8 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev)
ret = i2c_r2(gspca_dev, 0x00, &value); ret = i2c_r2(gspca_dev, 0x00, &value);
if ((ret == 0) && (value == 0x1229)) { if ((ret == 0) && (value == 0x1229)) {
for (i = 0; i < ARRAY_SIZE(mt9v112_init); i++) { for (i = 0; i < ARRAY_SIZE(mt9v112_init); i++) {
if (i2c_w2(gspca_dev, mt9v112_init[i][0], if (i2c_w2(gspca_dev, mt9v112_init[i].reg,
mt9v112_init[i][1]) < 0) { mt9v112_init[i].val) < 0) {
err("MT9V112 sensor initialization failed"); err("MT9V112 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1362,8 +1373,8 @@ static int mt9m111_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1362,8 +1373,8 @@ static int mt9m111_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int i; int i;
for (i = 0; i < ARRAY_SIZE(mt9m111_init); i++) { for (i = 0; i < ARRAY_SIZE(mt9m111_init); i++) {
if (i2c_w2(gspca_dev, mt9m111_init[i][0], if (i2c_w2(gspca_dev, mt9m111_init[i].reg,
mt9m111_init[i][1]) < 0) { mt9m111_init[i].val) < 0) {
err("MT9M111 sensor initialization failed"); err("MT9M111 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1378,8 +1389,8 @@ static int mt9m001_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1378,8 +1389,8 @@ static int mt9m001_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int i; int i;
for (i = 0; i < ARRAY_SIZE(mt9m001_init); i++) { for (i = 0; i < ARRAY_SIZE(mt9m001_init); i++) {
if (i2c_w2(gspca_dev, mt9m001_init[i][0], if (i2c_w2(gspca_dev, mt9m001_init[i].reg,
mt9m001_init[i][1]) < 0) { mt9m001_init[i].val) < 0) {
err("MT9M001 sensor initialization failed"); err("MT9M001 sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
...@@ -1397,8 +1408,8 @@ static int hv7131r_init_sensor(struct gspca_dev *gspca_dev) ...@@ -1397,8 +1408,8 @@ static int hv7131r_init_sensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
for (i = 0; i < ARRAY_SIZE(hv7131r_init); i++) { for (i = 0; i < ARRAY_SIZE(hv7131r_init); i++) {
if (i2c_w1(gspca_dev, hv7131r_init[i][0], if (i2c_w1(gspca_dev, hv7131r_init[i].reg,
hv7131r_init[i][1]) < 0) { hv7131r_init[i].val) < 0) {
err("HV7131R Sensor initialization failed"); err("HV7131R Sensor initialization failed");
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment