diff options
author | Gerd Knorr <devnull@localhost> | 2004-10-06 17:30:51 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-10-06 17:30:51 +0000 |
commit | 5ed9c18ec57458d731d60be5304ccd25d6264da9 (patch) | |
tree | 99a1f323285a52795ce69567edcfda9fa3c7b26a /linux/drivers/media/video/cx88 | |
parent | a1ae31f75dbc6e51f7ae1a986d81e18f8425194d (diff) | |
download | mediapointer-dvb-s2-5ed9c18ec57458d731d60be5304ccd25d6264da9.tar.gz mediapointer-dvb-s2-5ed9c18ec57458d731d60be5304ccd25d6264da9.tar.bz2 |
- bttv: irq fixes.
- add i2c scans.
Diffstat (limited to 'linux/drivers/media/video/cx88')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-i2c.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index da49619c0..7d2c0f00e 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -1,5 +1,5 @@ /* - $Id: cx88-i2c.c,v 1.14 2004/09/23 13:58:19 kraxel Exp $ + $Id: cx88-i2c.c,v 1.15 2004/10/06 17:30:51 kraxel Exp $ cx88-i2c.c -- all the i2c code is here @@ -35,6 +35,10 @@ static unsigned int i2c_debug = 0; MODULE_PARM(i2c_debug,"i"); MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); +static unsigned int i2c_scan = 0; +MODULE_PARM(i2c_scan,"i"); +MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); + #define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ printk(KERN_DEBUG "%s: " fmt, core->name , ## arg) @@ -140,6 +144,28 @@ static struct i2c_client cx8800_i2c_client_template = { .id = -1, }; +static char *i2c_devs[128] = { + [ 0x86 >> 1 ] = "tda9887/cx22702", + [ 0xa0 >> 1 ] = "eeprom", + [ 0xc0 >> 1 ] = "tuner (analog)", + [ 0xc2 >> 1 ] = "tuner (analog/dvb)", +}; + +static void do_i2c_scan(char *name, struct i2c_client *c) +{ + unsigned char buf; + int i,rc; + + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c,&buf,0); + if (rc < 0) + continue; + printk("%s: i2c scan: found device @ 0x%x [%s]\n", + name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); + } +} + /* init + register i2c algo-bit adapter */ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) { @@ -166,10 +192,12 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) cx8800_bit_setsda(core,1); core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap); - if (0 != core->i2c_rc) - printk("%s: i2c register FAILED\n", core->name); - else + if (0 == core->i2c_rc) { dprintk(1, "i2c register ok\n"); + if (i2c_scan) + do_i2c_scan(core->name,&core->i2c_client); + } else + printk("%s: i2c register FAILED\n", core->name); return core->i2c_rc; } |