aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-11-09 00:38:23 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:27 -0500
commitf3b512fd42b4ed6ff47a8afb4f42ac3cc325ddad (patch)
tree5c3d79670b5823ad1f9bf8baf2ccec292522903e /drivers/media/video
parent50c8640725453f2487da9267844a962108c8418e (diff)
[PATCH] v4l: 875: some cleanups at i2c stuff and fixing when tuner addr is set
- Some cleanups at I2C stuff and fixing when tuner addr is set. 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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bttv-cards.c19
-rw-r--r--drivers/media/video/bttv-i2c.c20
2 files changed, 11 insertions, 28 deletions
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 89aa5cbb8b9e..d81672acdaad 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -3188,7 +3188,7 @@ void __devinit bttv_init_card1(struct bttv *btv)
3188void __devinit bttv_init_card2(struct bttv *btv) 3188void __devinit bttv_init_card2(struct bttv *btv)
3189{ 3189{
3190 int tda9887; 3190 int tda9887;
3191 int addr=ADDR_UNSET, radio_addr=ADDR_UNSET; 3191 int addr=ADDR_UNSET;
3192 3192
3193 btv->tuner_type = -1; 3193 btv->tuner_type = -1;
3194 3194
@@ -3333,31 +3333,28 @@ void __devinit bttv_init_card2(struct bttv *btv)
3333 if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) 3333 if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
3334 addr = bttv_tvcards[btv->c.type].tuner_addr; 3334 addr = bttv_tvcards[btv->c.type].tuner_addr;
3335 3335
3336 if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr)
3337 radio_addr = bttv_tvcards[btv->c.type].radio_addr;
3338
3339 if (UNSET != bttv_tvcards[btv->c.type].tuner_type) 3336 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
3340 if(UNSET == btv->tuner_type) 3337 if(UNSET == btv->tuner_type)
3341 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; 3338 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
3342 if (UNSET != tuner[btv->c.nr]) 3339 if (UNSET != tuner[btv->c.nr])
3343 btv->tuner_type = tuner[btv->c.nr]; 3340 btv->tuner_type = tuner[btv->c.nr];
3344 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); 3341 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
3345 if (btv->pinnacle_id != UNSET) 3342
3346 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
3347 &btv->pinnacle_id);
3348 if (btv->tuner_type != UNSET) { 3343 if (btv->tuner_type != UNSET) {
3349 struct tuner_setup tun_setup; 3344 struct tuner_setup tun_setup;
3350 3345
3351 tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; 3346 tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
3352 tun_setup.type = btv->tuner_type; 3347 tun_setup.type = btv->tuner_type;
3353 tun_setup.addr = addr; 3348 tun_setup.addr = addr;
3354 3349
3355 if (addr == radio_addr)
3356 tun_setup.mode_mask = T_RADIO;
3357
3358 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); 3350 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
3359 } 3351 }
3360 3352
3353 if (btv->pinnacle_id != UNSET) {
3354 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
3355 &btv->pinnacle_id);
3356 }
3357
3361 btv->svhs = bttv_tvcards[btv->c.type].svhs; 3358 btv->svhs = bttv_tvcards[btv->c.type].svhs;
3362 if (svhs[btv->c.nr] != UNSET) 3359 if (svhs[btv->c.nr] != UNSET)
3363 btv->svhs = svhs[btv->c.nr]; 3360 btv->svhs = svhs[btv->c.nr];
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index 5ad335705e1f..aaabef26105a 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -291,14 +291,11 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = {
291static int attach_inform(struct i2c_client *client) 291static int attach_inform(struct i2c_client *client)
292{ 292{
293 struct bttv *btv = i2c_get_adapdata(client->adapter); 293 struct bttv *btv = i2c_get_adapdata(client->adapter);
294 int radio_addr=ADDR_UNSET, addr=ADDR_UNSET; 294 int radio_addr=ADDR_UNSET;
295 295
296 if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) 296 if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr)
297 radio_addr = bttv_tvcards[btv->c.type].radio_addr; 297 radio_addr = bttv_tvcards[btv->c.type].radio_addr;
298 298
299 if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
300 addr = bttv_tvcards[btv->c.type].tuner_addr;
301
302 if (bttv_debug) 299 if (bttv_debug)
303 printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", 300 printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
304 btv->c.nr,client->driver->name,client->addr, 301 btv->c.nr,client->driver->name,client->addr,
@@ -310,25 +307,14 @@ static int attach_inform(struct i2c_client *client)
310 struct tuner_setup tun_setup; 307 struct tuner_setup tun_setup;
311 struct tuner *t = i2c_get_clientdata(client); 308 struct tuner *t = i2c_get_clientdata(client);
312 309
313 if ((addr==ADDR_UNSET)||(addr==client->addr)) {
314 tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
315 tun_setup.type = btv->tuner_type;
316 tun_setup.addr = ADDR_UNSET;
317
318 }
319
320 if (t->type != UNSET && t->mode_mask == T_RADIO) { 310 if (t->type != UNSET && t->mode_mask == T_RADIO) {
321 tun_setup.type = t->type; 311 tun_setup.type = t->type;
322 tun_setup.mode_mask = T_RADIO; 312 tun_setup.mode_mask = T_RADIO;
323 tun_setup.addr = ADDR_UNSET; 313 tun_setup.addr = radio_addr;
314 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
324 } 315 }
325
326 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
327 } 316 }
328 317
329 if (btv->pinnacle_id != UNSET)
330 client->driver->command(client,AUDC_CONFIG_PINNACLE,
331 &btv->pinnacle_id);
332 return 0; 318 return 0;
333} 319}
334 320