aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-i2c.c
diff options
context:
space:
mode:
authorSascha Sommer <saschasommer@freenet.de>2007-11-04 06:06:48 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:56 -0500
commitfad7b958e753e18ff443786360f7846da50a3085 (patch)
tree7bb5af47b1c5b43269826983a16d72dbf959ecea /drivers/media/video/em28xx/em28xx-i2c.c
parentf1f32849d65ab1eacfedbabb624876ac06c1af9f (diff)
V4L/DVB (6545): em28xx: autodetect Cinergy 200 USB and VGear PocketTV
Adds autodetection support for the Cinergy200 USB and the VGear PocketTV. Whenever a usb device with generic empia em2800 usb ids is detected the device gets scanned for connected i2c devices. If the device list matches an em2800 device in the device list the model id gets changed accordingly. Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-i2c.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index e2003455f2b2..acd853d217ea 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -533,19 +533,26 @@ static char *i2c_devs[128] = {
533 * do_i2c_scan() 533 * do_i2c_scan()
534 * check i2c address range for devices 534 * check i2c address range for devices
535 */ 535 */
536static void do_i2c_scan(char *name, struct i2c_client *c) 536void em28xx_do_i2c_scan(struct em28xx *dev)
537{ 537{
538 u8 i2c_devicelist[128];
538 unsigned char buf; 539 unsigned char buf;
539 int i, rc; 540 int i, rc;
540 541
542 memset(i2c_devicelist, 0, ARRAY_SIZE(i2c_devicelist));
543
541 for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) { 544 for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) {
542 c->addr = i; 545 dev->i2c_client.addr = i;
543 rc = i2c_master_recv(c, &buf, 0); 546 rc = i2c_master_recv(&dev->i2c_client, &buf, 0);
544 if (rc < 0) 547 if (rc < 0)
545 continue; 548 continue;
546 printk(KERN_INFO "%s: found i2c device @ 0x%x [%s]\n", name, 549 i2c_devicelist[i] = i;
547 i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); 550 printk(KERN_INFO "%s: found i2c device @ 0x%x [%s]\n",
551 dev->name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
548 } 552 }
553
554 dev->i2c_hash = em28xx_hash_mem(i2c_devicelist,
555 ARRAY_SIZE(i2c_devicelist), 32);
549} 556}
550 557
551/* 558/*
@@ -578,7 +585,7 @@ int em28xx_i2c_register(struct em28xx *dev)
578 em28xx_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata)); 585 em28xx_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata));
579 586
580 if (i2c_scan) 587 if (i2c_scan)
581 do_i2c_scan(dev->name, &dev->i2c_client); 588 em28xx_do_i2c_scan(dev);
582 return 0; 589 return 0;
583} 590}
584 591