diff options
author | Michael Hunold <devnull@localhost> | 2002-12-20 14:18:26 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2002-12-20 14:18:26 +0000 |
commit | e62b273dd417c051d1624d6854414d6054e6a131 (patch) | |
tree | 84cab0d55c55c4742a03eb8e6aad210def78f7e3 /linux/drivers/media/video/mxb.c | |
parent | df166bc1551ee91e374068939c2e58925db8064e (diff) | |
download | mediapointer-dvb-s2-e62b273dd417c051d1624d6854414d6054e6a131.tar.gz mediapointer-dvb-s2-e62b273dd417c051d1624d6854414d6054e6a131.tar.bz2 |
Removed the dependecy to i2c-core from saa7146 and av7110,
changed mxb to (un)register the i2c adapter by itself
Diffstat (limited to 'linux/drivers/media/video/mxb.c')
-rw-r--r-- | linux/drivers/media/video/mxb.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/linux/drivers/media/video/mxb.c b/linux/drivers/media/video/mxb.c index c9688cf9c..572faa133 100644 --- a/linux/drivers/media/video/mxb.c +++ b/linux/drivers/media/video/mxb.c @@ -129,6 +129,8 @@ static struct saa7146_extension_ioctls ioctls[] = { struct mxb { + struct i2c_adapter i2c_adapter; + struct i2c_client* saa7111a; struct i2c_client* tda9840; struct i2c_client* tea6415c; @@ -167,26 +169,34 @@ static int mxb_probe(struct saa7146_dev* dev, unsigned int subvendor, unsigned i } memset(mxb, 0x0, sizeof(struct mxb)); + saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); + if(i2c_add_adapter(&mxb->i2c_adapter) < 0) { + DEB_S(("cannot register i2c-device. skipping.\n")); + kfree(mxb); + return -EFAULT; + } + /* loop through all i2c-devices on the bus and look who is there */ - for(i = 0; i < dev->i2c_adapter->client_count; i++) { - if( I2C_TEA6420_1 == dev->i2c_adapter->clients[i]->addr ) - mxb->tea6420_1 = dev->i2c_adapter->clients[i]; - if( I2C_TEA6420_2 == dev->i2c_adapter->clients[i]->addr ) - mxb->tea6420_2 = dev->i2c_adapter->clients[i]; - if( I2C_TEA6415C_2 == dev->i2c_adapter->clients[i]->addr ) - mxb->tea6415c = dev->i2c_adapter->clients[i]; - if( I2C_TDA9840 == dev->i2c_adapter->clients[i]->addr ) - mxb->tda9840 = dev->i2c_adapter->clients[i]; - if( I2C_SAA7111A == dev->i2c_adapter->clients[i]->addr ) - mxb->saa7111a = dev->i2c_adapter->clients[i]; - if( 0x60 == dev->i2c_adapter->clients[i]->addr ) - mxb->tuner = dev->i2c_adapter->clients[i]; + for(i = 0; i < mxb->i2c_adapter.client_count; i++) { + if( I2C_TEA6420_1 == mxb->i2c_adapter.clients[i]->addr ) + mxb->tea6420_1 = mxb->i2c_adapter.clients[i]; + if( I2C_TEA6420_2 == mxb->i2c_adapter.clients[i]->addr ) + mxb->tea6420_2 = mxb->i2c_adapter.clients[i]; + if( I2C_TEA6415C_2 == mxb->i2c_adapter.clients[i]->addr ) + mxb->tea6415c = mxb->i2c_adapter.clients[i]; + if( I2C_TDA9840 == mxb->i2c_adapter.clients[i]->addr ) + mxb->tda9840 = mxb->i2c_adapter.clients[i]; + if( I2C_SAA7111A == mxb->i2c_adapter.clients[i]->addr ) + mxb->saa7111a = mxb->i2c_adapter.clients[i]; + if( 0x60 == mxb->i2c_adapter.clients[i]->addr ) + mxb->tuner = mxb->i2c_adapter.clients[i]; } /* check if all devices are present */ if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c || 0 == mxb->tda9840 || 0 == mxb->saa7111a || 0 == mxb->tuner ) { DEB_D(("this saa7146 is not on an mxb.\n")); + i2c_del_adapter(&mxb->i2c_adapter); kfree(mxb); return -ENODEV; } @@ -352,14 +362,14 @@ static int mxb_init_done(struct saa7146_dev* dev) msg.len = saa7740_init[0].length; msg.buf = &saa7740_init[0].data[0]; - if( 1 == (err = i2c_transfer(dev->i2c_adapter, &msg, 1))) { + if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { for(i = 1;;i++) { msg.len = saa7740_init[i].length; if( -1 == msg.len ) { break; } msg.buf = &saa7740_init[i].data[0]; - if( 1 != (err = i2c_transfer(dev->i2c_adapter, &msg, 1))) { + if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { DEB_D(("failed to initialize 'sound arena module'.\n")); goto err; } @@ -427,6 +437,8 @@ static int mxb_detach(struct saa7146_dev* dev) i2c_dec_use_client(mxb->tuner); mxb_num--; + + i2c_del_adapter(&mxb->i2c_adapter); kfree(mxb); return 0; @@ -955,7 +967,6 @@ struct saa7146_extension extension = { .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), .std_callback = &std_callback, - .use_kernel_i2c = 1, .vbi = mxb_vbi_bypass, .ioctls = &ioctls[0], |