[PATCH] v4l: 867: correcting fixes to accept radio devices like tea5767
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>
Wed, 9 Nov 2005 05:38:18 +0000 (21:38 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 9 Nov 2005 15:56:26 +0000 (07:56 -0800)
- Correcting fixes to accept radio devices like tea5767.

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/media/video/bttv-i2c.c

index d6cccce48041e789b0fd937b2184b6e255767515..e509ed91a290dc9a3a9f6a9d16750377fc993fb1 100644 (file)
@@ -291,11 +291,14 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = {
 static int attach_inform(struct i2c_client *client)
 {
        struct bttv *btv = i2c_get_adapdata(client->adapter);
-       int radio_addr=ADDR_UNSET;
+       int radio_addr=ADDR_UNSET, addr=ADDR_UNSET;
 
        if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr)
                radio_addr = bttv_tvcards[btv->c.type].radio_addr;
 
+       if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
+               addr = bttv_tvcards[btv->c.type].tuner_addr;
+
        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,
@@ -306,14 +309,20 @@ static int attach_inform(struct i2c_client *client)
        if (btv->tuner_type != UNSET) {
                struct tuner_setup tun_setup;
 
-               tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
-               tun_setup.type = btv->tuner_type;
-               tun_setup.addr = ADDR_UNSET;
+               if ((addr==ADDR_UNSET)||(addr==client->addr)) {
+                       tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
+                       tun_setup.type = btv->tuner_type;
+                       tun_setup.addr = ADDR_UNSET;
 
-               if (client->addr == radio_addr)
-                       tun_setup.mode_mask =  T_RADIO;
+                       client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
+               }
+               if ((radio_addr==ADDR_UNSET)||(radio_addr==client->addr)) {
+                       tun_setup.mode_mask =  T_RADIO;
+                       tun_setup.type = btv->tuner_type;
+                       tun_setup.addr = ADDR_UNSET;
 
-               client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
+                       client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
+               }
        }
 
        if (btv->pinnacle_id != UNSET)