summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-i2c.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
index 587f6cc06..fae227bfe 100644
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-i2c.c,v 1.15 2005/07/02 15:24:11 nsh Exp $
+ * $Id: saa7134-i2c.c,v 1.16 2005/07/03 13:41:38 mchehab Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
@@ -331,24 +331,40 @@ static u32 functionality(struct i2c_adapter *adap)
static int attach_inform(struct i2c_client *client)
{
- struct saa7134_dev *dev = client->adapter->algo_data;
- int tuner = dev->tuner_type;
+ struct saa7134_dev *dev = client->adapter->algo_data;
+ /* int tuner = dev->tuner_type; */
int conf = dev->tda9887_conf;
- struct tuner_addr tun_addr;
+ struct tuner_addr tun_addr;
- tun_addr.type = saa7134_boards[dev->board].radio_type;
- if (tun_addr.type != UNSET) {
- tun_addr.state = T_RADIO;
- tun_addr.addr = saa7134_boards[dev->board].radio_addr;
- saa7134_i2c_call_clients(dev,TUNER_SET_TYPE_ADDR,&tun_addr);
- }
+ d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
+ client->driver->name,client->addr,i2c_clientname(client));
+
+ if (!client->driver->command)
+ return 0;
+
+ tun_addr.type = saa7134_boards[dev->board].radio_type;
+ if ( tun_addr.type != UNSET) {
+ tun_addr.addr = saa7134_boards[dev->board].radio_addr;
+
+ if ((tun_addr.addr==ADDR_UNSET)||(tun_addr.addr==client->addr)) {
+ tun_addr.state = T_RADIO;
+
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ }
+ }
- tun_addr.state = T_ANALOG_TV;
tun_addr.type = saa7134_boards[dev->board].tuner_type;
- tun_addr.addr = saa7134_boards[dev->board].tuner_addr;
+ if (tun_addr.type != UNSET) {
+ tun_addr.addr = saa7134_boards[dev->board].tuner_addr;
+ if ((tun_addr.addr==ADDR_UNSET)||(tun_addr.addr==client->addr)) {
+
+ tun_addr.state = T_ANALOG_TV;
+
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ }
+ }
- saa7134_i2c_call_clients(dev,TUNER_SET_TYPE_ADDR, &tun_addr);
- saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf);
+ client->driver->command(client, TDA9887_SET_CONFIG, &conf);
return 0;
}