aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/et61x251
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-12-12 17:55:49 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:35 -0500
commit7cd355e7c0c02e499784c77e88720f7cc8f98473 (patch)
tree900ed17fb12dcd4c09f7ef915edd7c53a634b8a4 /drivers/media/video/et61x251
parent39b43b1a61f3c4b540b024843e592b14533aa961 (diff)
V4L/DVB (6809): git-dvb: drivers/media/video/et61x251/et61x251_core.c: fix warnings
drivers/media/video/et61x251/et61x251_core.c:390: warning: 'et61x251_i2c_read' defined but not used drivers/media/video/et61x251/et61x251_core.c:397: warning: 'et61x251_i2c_write' defined but not used Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/et61x251')
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c155
1 files changed, 77 insertions, 78 deletions
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 38d2ad0aadef..06b6a3ae06c4 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -268,72 +268,6 @@ et61x251_i2c_wait(struct et61x251_device* cam,
268} 268}
269 269
270 270
271static int et61x251_i2c_try_read(struct et61x251_device* cam,
272 const struct et61x251_sensor* sensor,
273 u8 address)
274{
275 struct usb_device* udev = cam->usbdev;
276 u8* data = cam->control_buffer;
277 int err = 0, res;
278
279 data[0] = address;
280 data[1] = cam->sensor.i2c_slave_id;
281 data[2] = cam->sensor.rsta | 0x10;
282 data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02);
283 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
284 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT);
285 if (res < 0)
286 err += res;
287
288 err += et61x251_i2c_wait(cam, sensor);
289
290 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
291 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT);
292 if (res < 0)
293 err += res;
294
295 if (err)
296 DBG(3, "I2C read failed for %s image sensor", sensor->name);
297
298 PDBGG("I2C read: address 0x%02X, value: 0x%02X", address, data[0]);
299
300 return err ? -1 : (int)data[0];
301}
302
303
304static int et61x251_i2c_try_write(struct et61x251_device* cam,
305 const struct et61x251_sensor* sensor,
306 u8 address, u8 value)
307{
308 struct usb_device* udev = cam->usbdev;
309 u8* data = cam->control_buffer;
310 int err = 0, res;
311
312 data[0] = address;
313 data[1] = cam->sensor.i2c_slave_id;
314 data[2] = cam->sensor.rsta | 0x12;
315 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
316 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
317 if (res < 0)
318 err += res;
319
320 data[0] = value;
321 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
322 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
323 if (res < 0)
324 err += res;
325
326 err += et61x251_i2c_wait(cam, sensor);
327
328 if (err)
329 DBG(3, "I2C write failed for %s image sensor", sensor->name);
330
331 PDBGG("I2C write: address 0x%02X, value: 0x%02X", address, value);
332
333 return err ? -1 : 0;
334}
335
336
337int 271int
338et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, 272et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
339 u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, 273 u8 data3, u8 data4, u8 data5, u8 data6, u8 data7,
@@ -386,18 +320,6 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
386} 320}
387 321
388 322
389static int et61x251_i2c_read(struct et61x251_device* cam, u8 address)
390{
391 return et61x251_i2c_try_read(cam, &cam->sensor, address);
392}
393
394
395static int et61x251_i2c_write(struct et61x251_device* cam,
396 u8 address, u8 value)
397{
398 return et61x251_i2c_try_write(cam, &cam->sensor, address, value);
399}
400
401/*****************************************************************************/ 323/*****************************************************************************/
402 324
403static void et61x251_urb_complete(struct urb *urb) 325static void et61x251_urb_complete(struct urb *urb)
@@ -675,6 +597,83 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam)
675/*****************************************************************************/ 597/*****************************************************************************/
676 598
677#ifdef CONFIG_VIDEO_ADV_DEBUG 599#ifdef CONFIG_VIDEO_ADV_DEBUG
600
601static int et61x251_i2c_try_read(struct et61x251_device* cam,
602 const struct et61x251_sensor* sensor,
603 u8 address)
604{
605 struct usb_device* udev = cam->usbdev;
606 u8* data = cam->control_buffer;
607 int err = 0, res;
608
609 data[0] = address;
610 data[1] = cam->sensor.i2c_slave_id;
611 data[2] = cam->sensor.rsta | 0x10;
612 data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02);
613 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
614 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT);
615 if (res < 0)
616 err += res;
617
618 err += et61x251_i2c_wait(cam, sensor);
619
620 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
621 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT);
622 if (res < 0)
623 err += res;
624
625 if (err)
626 DBG(3, "I2C read failed for %s image sensor", sensor->name);
627
628 PDBGG("I2C read: address 0x%02X, value: 0x%02X", address, data[0]);
629
630 return err ? -1 : (int)data[0];
631}
632
633
634static int et61x251_i2c_try_write(struct et61x251_device* cam,
635 const struct et61x251_sensor* sensor,
636 u8 address, u8 value)
637{
638 struct usb_device* udev = cam->usbdev;
639 u8* data = cam->control_buffer;
640 int err = 0, res;
641
642 data[0] = address;
643 data[1] = cam->sensor.i2c_slave_id;
644 data[2] = cam->sensor.rsta | 0x12;
645 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
646 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
647 if (res < 0)
648 err += res;
649
650 data[0] = value;
651 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
652 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
653 if (res < 0)
654 err += res;
655
656 err += et61x251_i2c_wait(cam, sensor);
657
658 if (err)
659 DBG(3, "I2C write failed for %s image sensor", sensor->name);
660
661 PDBGG("I2C write: address 0x%02X, value: 0x%02X", address, value);
662
663 return err ? -1 : 0;
664}
665
666static int et61x251_i2c_read(struct et61x251_device* cam, u8 address)
667{
668 return et61x251_i2c_try_read(cam, &cam->sensor, address);
669}
670
671static int et61x251_i2c_write(struct et61x251_device* cam,
672 u8 address, u8 value)
673{
674 return et61x251_i2c_try_write(cam, &cam->sensor, address, value);
675}
676
678static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) 677static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count)
679{ 678{
680 char str[5]; 679 char str[5];