diff options
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-cards.c | 79 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-core.c | 77 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-i2c.c | 31 |
3 files changed, 92 insertions, 95 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index f69567c16..a6a5d90e7 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-cards.c,v 1.78 2005/07/02 16:24:34 mkrufky Exp $ + * $Id: saa7134-cards.c,v 1.79 2005/07/05 17:37:35 nsh Exp $ * * device driver for philips saa7134 based TV cards * card-specific stuff. @@ -2527,13 +2527,80 @@ int saa7134_board_init2(struct saa7134_dev *dev) dev->tuner_type = saa7134_boards[dev->board].tuner_type; if (TUNER_ABSENT != dev->tuner_type) { - struct tuner_addr tun_addr; + struct tuner_setup tun_setup; - tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; - tun_addr.type = dev->tuner_type; - tun_addr.addr = ADDR_UNSET; + tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.type = dev->tuner_type; + tun_setup.addr = ADDR_UNSET; - saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_addr); + saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); + } + break; + case SAA7134_BOARD_MD7134: + { + struct tuner_setup tun_setup; + u8 subaddr; + u8 data[3]; + int ret, tuner_t; + + struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1}, + {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}}; + subaddr= 0x14; + tuner_t = 0; + ret = i2c_transfer(&dev->i2c_adap, msg, 2); + if (ret != 2) { + printk(KERN_ERR "EEPROM read failure\n"); + } else if ((data[0] != 0) && (data[0] != 0xff)) { + /* old config structure */ + subaddr = data[0] + 2; + msg[1].len = 2; + i2c_transfer(&dev->i2c_adap, msg, 2); + tuner_t = (data[0] << 8) + data[1]; + switch (tuner_t){ + case 0x0103: + dev->tuner_type = TUNER_PHILIPS_PAL; + break; + case 0x010C: + dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; + break; + default: + printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); + } + } else if ((data[1] != 0) && (data[1] != 0xff)) { + /* new config structure */ + subaddr = data[1] + 1; + msg[1].len = 1; + i2c_transfer(&dev->i2c_adap, msg, 2); + subaddr = data[0] + 1; + msg[1].len = 2; + i2c_transfer(&dev->i2c_adap, msg, 2); + tuner_t = (data[1] << 8) + data[0]; + switch (tuner_t) { + case 0x0005: + dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; + break; + case 0x001d: + dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3; + printk(KERN_INFO "%s Board has DVB-T\n", dev->name); + break; + default: + printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); + } + } else { + printk(KERN_ERR "%s unexpected config structure\n", dev->name); + } + + printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); + if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { + dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE; + saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf); + } + + tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.type = dev->tuner_type; + tun_setup.addr = ADDR_UNSET; + + saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); } break; } diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 16c4bb041..689453f2f 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-core.c,v 1.38 2005/07/02 16:24:34 mkrufky Exp $ + * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $ * * device driver for philips saa7134 based TV cards * driver core @@ -996,80 +996,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, msleep(100); saa7134_i2c_register(dev); - /* Hac: cards with this id have different tuners, find the type in the eeprom - and patch the data structures if necessary - */ - if (dev->board == SAA7134_BOARD_MD7134) { - struct tuner_addr tun_addr; - u8 subaddr; - u8 data[3]; - int ret, tuner_t; - - struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1}, - {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}}; - subaddr= 0x14; - tuner_t = 0; - ret = i2c_transfer(&dev->i2c_adap, msg, 2); - if (ret != 2) { - printk(KERN_ERR "EEPROM read failure\n"); - } else { - if ((data[0] != 0) && (data[0] != 0xff)) { - /* Hac: old config structure */ - subaddr = data[0] + 2; - msg[1].len = 2; - i2c_transfer(&dev->i2c_adap, msg, 2); - tuner_t = (data[0] << 8) + data[1]; - switch (tuner_t){ - case 0x0103: - dev->tuner_type = TUNER_PHILIPS_PAL; - break; - case 0x010C: - dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; - break; - default: - printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); - } - } else { - if ((data[1] != 0) && (data[1] != 0xff)) { - /* Hac: new config structure */ - subaddr = data[1] + 1; - msg[1].len = 1; - i2c_transfer(&dev->i2c_adap, msg, 2); - subaddr = data[0] + 1; - msg[1].len = 2; - i2c_transfer(&dev->i2c_adap, msg, 2); - tuner_t = (data[1] << 8) + data[0]; - switch (tuner_t){ - case 0x0005: - dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; - break; - case 0x001d: - dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3; - printk(KERN_INFO "%s Board has DVB-T\n", dev->name); - break; - default: - printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); - } - } else { - printk(KERN_ERR "%s unexpected config structure\n", dev->name); - } - } - } - printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); - saa7134_boards[SAA7134_BOARD_MD7134].tuner_type = dev->tuner_type; - if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { - dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE; - saa7134_boards[SAA7134_BOARD_MD7134].tda9887_conf = dev->tda9887_conf; - saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf); - } - - tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; - tun_addr.type = dev->tuner_type; - tun_addr.addr = ADDR_UNSET; - - saa7134_i2c_call_clients(dev,TUNER_SET_TYPE_ADDR,&tun_addr); - } - /* initialize hardware #2 */ saa7134_board_init2(dev); saa7134_hwinit2(dev); @@ -1083,6 +1009,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, request_module("saa6752hs"); request_module_depend("saa7134-empress",&need_empress); } + if (card_is_dvb(dev)) request_module_depend("saa7134-dvb",&need_dvb); diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c index 4e2b17a8f..3a71fa42a 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.17 2005/07/04 17:06:39 mchehab Exp $ + * $Id: saa7134-i2c.c,v 1.18 2005/07/05 17:37:35 nsh Exp $ * * device driver for philips saa7134 based TV cards * i2c interface support @@ -334,7 +334,7 @@ static int attach_inform(struct i2c_client *client) 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_setup tun_setup; d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", client->driver->name,client->addr,i2c_clientname(client)); @@ -342,25 +342,28 @@ static int attach_inform(struct i2c_client *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 (saa7134_boards[dev->board].radio_type != UNSET) { + + tun_setup.type = saa7134_boards[dev->board].radio_type; + tun_setup.addr = saa7134_boards[dev->board].radio_addr; - if ((tun_addr.addr==ADDR_UNSET)||(tun_addr.addr==client->addr)) { - tun_addr.state = T_RADIO; + if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) { + tun_setup.mode_mask = T_RADIO; - client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); + client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); } } - tun_addr.type = tuner; - 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)) { + if (tuner != UNSET) { - tun_addr.state = T_ANALOG_TV; + tun_setup.type = tuner; + tun_setup.addr = saa7134_boards[dev->board].tuner_addr; - client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); + if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { + + tun_setup.mode_mask = T_ANALOG_TV; + + client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); } } |