summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-07-03 13:41:38 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-07-03 13:41:38 +0000
commit77bd3f4b79844adf564a9a7ab09c89e44ac8d929 (patch)
tree785ca57d1e003b51502ac5e385df46d7b0414ceb /linux
parentbaa52f41b316708d50ad39912800718637f7cef2 (diff)
downloadmediapointer-dvb-s2-77bd3f4b79844adf564a9a7ab09c89e44ac8d929.tar.gz
mediapointer-dvb-s2-77bd3f4b79844adf564a9a7ab09c89e44ac8d929.tar.bz2
* bttv-i2c.c, cx88-i2c.c, saa7134-i2c.c:
- I2C cleanups. Now, all drivers uses the same basic structure. * cx88-video.c: - Duplicated code commented. Should be removed soon. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/bttv-i2c.c16
-rw-r--r--linux/drivers/media/video/cx88/cx88-i2c.c27
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c7
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c44
4 files changed, 60 insertions, 34 deletions
diff --git a/linux/drivers/media/video/bttv-i2c.c b/linux/drivers/media/video/bttv-i2c.c
index d7a8e3edb..ce7f5ae8a 100644
--- a/linux/drivers/media/video/bttv-i2c.c
+++ b/linux/drivers/media/video/bttv-i2c.c
@@ -1,5 +1,5 @@
/*
- $Id: bttv-i2c.c,v 1.23 2005/07/02 16:24:34 mkrufky Exp $
+ $Id: bttv-i2c.c,v 1.24 2005/07/03 13:41:38 mchehab Exp $
bttv-i2c.c -- all the i2c code is here
@@ -295,6 +295,13 @@ static int attach_inform(struct i2c_client *client)
{
struct bttv *btv = i2c_get_adapdata(client->adapter);
+ if (bttv_debug)
+ printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
+ btv->c.nr,client->driver->name,client->addr,
+ i2c_clientname(client));
+ if (!client->driver->command)
+ return 0;
+
if (btv->tuner_type != UNSET) {
struct tuner_addr tun_addr;
@@ -302,15 +309,12 @@ static int attach_inform(struct i2c_client *client)
tun_addr.type = btv->tuner_type;
tun_addr.addr = ADDR_UNSET;
- bttv_call_i2c_clients(btv,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
}
if (btv->pinnacle_id != UNSET)
- bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
+ client->driver->command(client,AUDC_CONFIG_PINNACLE,
&btv->pinnacle_id);
- if (bttv_debug)
- printk("bttv%d: i2c attach [client=%s]\n",
- btv->c.nr, i2c_clientname(client));
return 0;
}
diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c
index e88e9aaeb..7f1f4a6c5 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.26 2005/07/02 15:24:11 nsh Exp $
+ $Id: cx88-i2c.c,v 1.27 2005/07/03 13:41:38 mchehab Exp $
cx88-i2c.c -- all the i2c code is here
@@ -94,26 +94,29 @@ static int attach_inform(struct i2c_client *client)
struct tuner_addr tun_addr;
struct cx88_core *core = i2c_get_adapdata(client->adapter);
- dprintk(1, "i2c attach [addr=0x%x,client=%s]\n",
- client->addr, i2c_clientname(client));
+ dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
+ client->driver->name,client->addr,i2c_clientname(client));
if (!client->driver->command)
return 0;
if (core->radio_type != UNSET) {
+ if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) {
+ tun_addr.state = T_RADIO;
+ tun_addr.type = core->radio_type;
+ tun_addr.addr = core->radio_addr;
- tun_addr.state = T_RADIO;
- tun_addr.type = core->radio_type;
- tun_addr.addr = core->radio_addr;
-
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ }
}
if (core->tuner_type != UNSET) {
+ if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) {
- tun_addr.state = T_ANALOG_TV;
- tun_addr.type = core->tuner_type;
- tun_addr.addr = core->tuner_addr;
+ tun_addr.state = T_ANALOG_TV;
+ tun_addr.type = core->tuner_type;
+ tun_addr.addr = core->tuner_addr;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ }
}
if (core->tda9887_conf)
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 38609f609..5110ac203 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-video.c,v 1.73 2005/07/02 15:24:11 nsh Exp $
+ * $Id: cx88-video.c,v 1.74 2005/07/03 13:41:38 mchehab Exp $
*
* device driver for Conexant 2388x based TV cards
* video4linux video interface
@@ -2020,7 +2020,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
{
struct cx8800_dev *dev;
struct cx88_core *core;
+#if 0
struct tuner_addr tun_addr;
+#endif
int err;
dev = kmalloc(sizeof(*dev),GFP_KERNEL);
@@ -2094,6 +2096,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
request_module("tuner");
if (core->tda9887_conf)
request_module("tda9887");
+#if 0 /* cx88-i2c has already this function */
if (core->radio_type != UNSET) {
tun_addr.state = T_RADIO;
tun_addr.type = core->radio_type;
@@ -2111,7 +2114,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
if (core->tda9887_conf)
cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf);
-
+#endif
/* register v4l devices */
dev->video_dev = cx88_vdev_init(core,dev->pci,
&cx8800_video_template,"video");
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;
}