aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-i2c.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c71
1 files changed, 3 insertions, 68 deletions
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 02c12fe6361..f0bf1d960c7 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -459,70 +459,15 @@ static u32 functionality(struct i2c_adapter *adap)
459static int attach_inform(struct i2c_client *client) 459static int attach_inform(struct i2c_client *client)
460{ 460{
461 struct em28xx *dev = client->adapter->algo_data; 461 struct em28xx *dev = client->adapter->algo_data;
462 struct IR_i2c *ir = i2c_get_clientdata(client);
462 463
463 switch (client->addr << 1) { 464 switch (client->addr << 1) {
464 case 0x86:
465 case 0x84:
466 case 0x96:
467 case 0x94:
468 {
469 struct v4l2_priv_tun_config tda9887_cfg;
470
471 struct tuner_setup tun_setup;
472
473 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
474 tun_setup.type = TUNER_TDA9887;
475 tun_setup.addr = client->addr;
476
477 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR,
478 &tun_setup);
479
480 tda9887_cfg.tuner = TUNER_TDA9887;
481 tda9887_cfg.priv = &dev->tda9887_conf;
482 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG,
483 &tda9887_cfg);
484 break;
485 }
486 case 0x42:
487 dprintk1(1, "attach_inform: saa7114 detected.\n");
488 break;
489 case 0x4a:
490 dprintk1(1, "attach_inform: saa7113 detected.\n");
491 break;
492 case 0xa0:
493 dprintk1(1, "attach_inform: eeprom detected.\n");
494 break;
495 case 0x60: 465 case 0x60:
496 case 0x8e: 466 case 0x8e:
497 { 467 dprintk1(1, "attach_inform: IR detected (%s).\n", ir->phys);
498 struct IR_i2c *ir = i2c_get_clientdata(client);
499 dprintk1(1, "attach_inform: IR detected (%s).\n",
500 ir->phys);
501 em28xx_set_ir(dev, ir); 468 em28xx_set_ir(dev, ir);
502 break; 469 break;
503 } 470 }
504 case 0x80:
505 case 0x88:
506 dprintk1(1, "attach_inform: msp34xx detected.\n");
507 break;
508 case 0xb8:
509 case 0xba:
510 dprintk1(1, "attach_inform: tvp5150 detected.\n");
511 break;
512
513 case 0xb0:
514 dprintk1(1, "attach_inform: tda9874 detected\n");
515 break;
516
517 default:
518 if (!dev->tuner_addr)
519 dev->tuner_addr = client->addr;
520
521 dprintk1(1, "attach inform: detected I2C address %x\n",
522 client->addr << 1);
523 dprintk1(1, "driver id %d\n", client->driver->id);
524
525 }
526 471
527 return 0; 472 return 0;
528} 473}
@@ -534,7 +479,6 @@ static struct i2c_algorithm em28xx_algo = {
534 479
535static struct i2c_adapter em28xx_adap_template = { 480static struct i2c_adapter em28xx_adap_template = {
536 .owner = THIS_MODULE, 481 .owner = THIS_MODULE,
537 .class = I2C_CLASS_TV_ANALOG,
538 .name = "em28xx", 482 .name = "em28xx",
539 .id = I2C_HW_B_EM28XX, 483 .id = I2C_HW_B_EM28XX,
540 .algo = &em28xx_algo, 484 .algo = &em28xx_algo,
@@ -595,16 +539,6 @@ void em28xx_do_i2c_scan(struct em28xx *dev)
595} 539}
596 540
597/* 541/*
598 * em28xx_i2c_call_clients()
599 * send commands to all attached i2c devices
600 */
601void em28xx_i2c_call_clients(struct em28xx *dev, unsigned int cmd, void *arg)
602{
603 BUG_ON(NULL == dev->i2c_adap.algo_data);
604 i2c_clients_command(&dev->i2c_adap, cmd, arg);
605}
606
607/*
608 * em28xx_i2c_register() 542 * em28xx_i2c_register()
609 * register i2c bus 543 * register i2c bus
610 */ 544 */
@@ -618,6 +552,7 @@ int em28xx_i2c_register(struct em28xx *dev)
618 dev->i2c_adap.dev.parent = &dev->udev->dev; 552 dev->i2c_adap.dev.parent = &dev->udev->dev;
619 strcpy(dev->i2c_adap.name, dev->name); 553 strcpy(dev->i2c_adap.name, dev->name);
620 dev->i2c_adap.algo_data = dev; 554 dev->i2c_adap.algo_data = dev;
555 i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev);
621 556
622 retval = i2c_add_adapter(&dev->i2c_adap); 557 retval = i2c_add_adapter(&dev->i2c_adap);
623 if (retval < 0) { 558 if (retval < 0) {