diff options
author | Hartmut Hackmann <devnull@localhost> | 2005-06-14 22:40:57 +0000 |
---|---|---|
committer | Hartmut Hackmann <devnull@localhost> | 2005-06-14 22:40:57 +0000 |
commit | 818bb7d7945fd29039e206f071adf1b1c016b883 (patch) | |
tree | 079c0cd51bd0f1c8537abbd846f156461907fd9c /linux | |
parent | ee50642298e550fcfafea5d97268a03599e7ff69 (diff) | |
download | mediapointer-dvb-s2-818bb7d7945fd29039e206f071adf1b1c016b883.tar.gz mediapointer-dvb-s2-818bb7d7945fd29039e206f071adf1b1c016b883.tar.bz2 |
- distinguish the different variants of the Medion MD7134 modules via eeprom
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-core.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 6bfe1358f..e6bd23ba2 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.30 2005/05/22 19:23:39 nsh Exp $ + * $Id: saa7134-core.c,v 1.31 2005/06/14 22:40:57 hhackmann Exp $ * * device driver for philips saa7134 based TV cards * driver core @@ -722,7 +722,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) SAA7134_MAIN_CTRL_EVFE1 | SAA7134_MAIN_CTRL_EVFE2 | SAA7134_MAIN_CTRL_ESFE | - SAA7134_MAIN_CTRL_EBADC | SAA7134_MAIN_CTRL_EBDAC); /* enable peripheral devices */ @@ -990,6 +989,68 @@ 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) { + 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; + saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type); + } + /* initialize hardware #2 */ saa7134_board_init2(dev); saa7134_hwinit2(dev); @@ -997,7 +1058,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, /* load i2c helpers */ if (TUNER_ABSENT != dev->tuner_type) request_module("tuner"); - if (dev->tda9887_conf) + if (dev->tda9887_conf) request_module("tda9887"); if (card_is_empress(dev)) { request_module("saa6752hs"); |