diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-03-25 06:04:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:40 -0400 |
commit | 33f5b07e30b1daf98416f2e621a6201f6fff9041 (patch) | |
tree | abac231e5f9bc526ace0d36e03263c263dac6e22 /drivers/media/video/gspca/vc032x.c | |
parent | db786a3fde5fca025dc2ea96232e010baf335961 (diff) |
V4L/DVB (11211): gspca - vc032x: Simplify the i2c write function.
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/vc032x.c')
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index cdd17bcf42c7..8aab2fb95ac6 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -2400,33 +2400,19 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) | |||
2400 | } | 2400 | } |
2401 | 2401 | ||
2402 | static void i2c_write(struct gspca_dev *gspca_dev, | 2402 | static void i2c_write(struct gspca_dev *gspca_dev, |
2403 | __u8 reg, const __u8 *val, __u8 size) | 2403 | u8 reg, const u8 *val, |
2404 | u8 size) /* 1 or 2 */ | ||
2404 | { | 2405 | { |
2405 | struct usb_device *dev = gspca_dev->dev; | 2406 | struct usb_device *dev = gspca_dev->dev; |
2406 | int retry; | 2407 | int retry; |
2407 | 2408 | ||
2408 | #ifdef GSPCA_DEBUG | ||
2409 | if (size > 3 || size < 1) | ||
2410 | return; | ||
2411 | #endif | ||
2412 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); | 2409 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); |
2410 | /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/ | ||
2413 | reg_w(dev, 0xa0, size, 0xb334); | 2411 | reg_w(dev, 0xa0, size, 0xb334); |
2414 | reg_w(dev, 0xa0, reg, 0xb33a); | 2412 | reg_w(dev, 0xa0, reg, 0xb33a); |
2415 | switch (size) { | 2413 | reg_w(dev, 0xa0, val[0], 0xb336); |
2416 | case 1: | 2414 | if (size > 1) |
2417 | reg_w(dev, 0xa0, val[0], 0xb336); | ||
2418 | break; | ||
2419 | case 2: | ||
2420 | reg_w(dev, 0xa0, val[0], 0xb336); | ||
2421 | reg_w(dev, 0xa0, val[1], 0xb337); | ||
2422 | break; | ||
2423 | default: | ||
2424 | /* case 3: */ | ||
2425 | reg_w(dev, 0xa0, val[0], 0xb336); | ||
2426 | reg_w(dev, 0xa0, val[1], 0xb337); | 2415 | reg_w(dev, 0xa0, val[1], 0xb337); |
2427 | reg_w(dev, 0xa0, val[2], 0xb338); | ||
2428 | break; | ||
2429 | } | ||
2430 | reg_w(dev, 0xa0, 0x01, 0xb339); | 2416 | reg_w(dev, 0xa0, 0x01, 0xb339); |
2431 | retry = 4; | 2417 | retry = 4; |
2432 | do { | 2418 | do { |