From 2cf36ac447308046d1c1d50b9f662bddbba56b33 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:36:32 -0800 Subject: [PATCH] [PATCH] v4l: 656: added support for the following cards - Added support for the following cards: - Philips EUROPA reference desigh - Compro VideoMate DVB-T300 - Compro VideoMate DVB-T200 (initial) Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 104 +++++++++++++- drivers/media/video/saa7134/saa7134-dvb.c | 152 +++++++++++++++++--- drivers/media/video/saa7134/saa7134.h | 3 + 3 files changed, 236 insertions(+), 23 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index fea2188b2fa9..8291ed709736 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2185,6 +2185,72 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x00200003, }, }, + [SAA7134_BOARD_PHILIPS_EUROPA] = { + .name = "Philips EUROPA V3 reference design", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TD1316, + .radio_type = UNSET, + .tuner_addr = 0x61, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_VIDEOMATE_DVBT_300] = { + .name = "Compro Videomate DVB-T300", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TD1316, + .radio_type = UNSET, + .tuner_addr = 0x61, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 1, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_VIDEOMATE_DVBT_200] = { + .name = "Compro Videomate DVB-T200", + .tuner_type = TUNER_ABSENT, + .audio_clock = 0x00187de7, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_comp1, + .vmux = 0, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2555,6 +2621,24 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice = 0x7135, .driver_data = SAA7134_BOARD_GOTVIEW_7135, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = PCI_VENDOR_ID_PHILIPS, + .subdevice = 0x2004, + .driver_data = SAA7134_BOARD_PHILIPS_EUROPA, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = 0x185b, + .subdevice = 0xc900, + .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_300, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7130, + .subvendor = 0x185b, + .subdevice = 0xc901, + .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_200, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -2708,7 +2792,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); } break; -case SAA7134_BOARD_MD7134: + case SAA7134_BOARD_MD7134: { struct tuner_setup tun_setup; u8 subaddr; @@ -2775,6 +2859,24 @@ case SAA7134_BOARD_MD7134: saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); } break; + case SAA7134_BOARD_PHILIPS_EUROPA: + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + /* The Philips EUROPA based hybrid boards have the tuner connected through + * the channel decoder. We have to make it transparent to find it + */ + { + struct tuner_setup tun_setup; + u8 data[] = { 0x07, 0x02}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + i2c_transfer(&dev->i2c_adap, &msg, 1); + + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr; + + saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); + } + break; } return 0; } diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 639ae51a052d..f8e01030fbc7 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -151,25 +151,12 @@ static struct mt352_config pinnacle_300i = { /* ------------------------------------------------------------------ */ #ifdef HAVE_TDA1004X -static int philips_tu1216_pll_init(struct dvb_frontend *fe) -{ - struct saa7134_dev *dev = fe->dvb->priv; - static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; - struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; - - /* setup PLL configuration */ - if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) - return -EIO; - msleep(1); - - return 0; -} -static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct saa7134_dev *dev = fe->dvb->priv; u8 tuner_buf[4]; - struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = + struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; int tuner_frequency = 0; u8 band, cp, filter; @@ -242,11 +229,36 @@ static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_p if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) return -EIO; + msleep(1); + return 0; +} + +static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; + struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; + /* setup PLL configuration */ + if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) + return -EIO; msleep(1); + return 0; } +/* ------------------------------------------------------------------ */ + +static int philips_tu1216_pll_60_init(struct dvb_frontend *fe) +{ + return philips_tda6651_pll_init(0x60, fe); +} + +static int philips_tu1216_pll_60_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x60, fe, params); +} + static int philips_tu1216_request_firmware(struct dvb_frontend *fe, const struct firmware **fw, char *name) { @@ -254,22 +266,108 @@ static int philips_tu1216_request_firmware(struct dvb_frontend *fe, return request_firmware(fw, name, &dev->pci->dev); } -static struct tda1004x_config philips_tu1216_config = { +static struct tda1004x_config philips_tu1216_60_config = { .demod_address = 0x8, .invert = 1, - .invert_oclk = 1, + .invert_oclk = 0, .xtal_freq = TDA10046_XTAL_4M, .agc_config = TDA10046_AGC_DEFAULT, .if_freq = TDA10046_FREQ_3617, - .pll_init = philips_tu1216_pll_init, - .pll_set = philips_tu1216_pll_set, + .pll_init = philips_tu1216_pll_60_init, + .pll_set = philips_tu1216_pll_60_set, .pll_sleep = NULL, .request_firmware = philips_tu1216_request_firmware, }; /* ------------------------------------------------------------------ */ +static int philips_tu1216_pll_61_init(struct dvb_frontend *fe) +{ + return philips_tda6651_pll_init(0x61, fe); +} + +static int philips_tu1216_pll_61_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x61, fe, params); +} + +static struct tda1004x_config philips_tu1216_61_config = { + + .demod_address = 0x8, + .invert = 1, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_4M, + .agc_config = TDA10046_AGC_DEFAULT, + .if_freq = TDA10046_FREQ_3617, + .pll_init = philips_tu1216_pll_61_init, + .pll_set = philips_tu1216_pll_61_set, + .pll_sleep = NULL, + .request_firmware = philips_tu1216_request_firmware, +}; + +/* ------------------------------------------------------------------ */ + +static int philips_europa_pll_init(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; + struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; + + /* setup PLL configuration */ + if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) + return -EIO; + msleep(1); + + /* switch the board to dvb mode */ + init_msg.addr = 0x43; + init_msg.len = 0x02; + msg[0] = 0x00; + msg[1] = 0x40; + if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) + return -EIO; + + return 0; +} + +static int philips_td1316_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x61, fe, params); +} + +static void philips_europa_analog(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + /* this message actually turns the tuner back to analog mode */ + static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; + struct i2c_msg analog_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; + + i2c_transfer(&dev->i2c_adap, &analog_msg, 1); + msleep(1); + + /* switch the board to analog mode */ + analog_msg.addr = 0x43; + analog_msg.len = 0x02; + msg[0] = 0x00; + msg[1] = 0x14; + i2c_transfer(&dev->i2c_adap, &analog_msg, 1); +} + +static struct tda1004x_config philips_europa_config = { + + .demod_address = 0x8, + .invert = 0, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_4M, + .agc_config = TDA10046_AGC_IFO_AUTO_POS, + .if_freq = TDA10046_FREQ_052, + .pll_init = philips_europa_pll_init, + .pll_set = philips_td1316_pll_set, + .pll_sleep = philips_europa_analog, + .request_firmware = NULL, +}; + +/* ------------------------------------------------------------------ */ static int philips_fmd1216_pll_init(struct dvb_frontend *fe) { @@ -382,7 +480,6 @@ static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ return 0; } -#ifdef HAVE_TDA1004X static struct tda1004x_config medion_cardbus = { .demod_address = 0x08, .invert = 1, @@ -395,7 +492,6 @@ static struct tda1004x_config medion_cardbus = { .pll_sleep = philips_fmd1216_analog, .request_firmware = NULL, }; -#endif /* ------------------------------------------------------------------ */ @@ -558,7 +654,7 @@ static int dvb_init(struct saa7134_dev *dev) &dev->i2c_adap); break; case SAA7134_BOARD_PHILIPS_TOUGH: - dev->dvb.frontend = tda10046_attach(&philips_tu1216_config, + dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, &dev->i2c_adap); break; case SAA7134_BOARD_FLYDVBTDUO: @@ -569,6 +665,18 @@ static int dvb_init(struct saa7134_dev *dev) dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, &dev->i2c_adap); break; + case SAA7134_BOARD_PHILIPS_EUROPA: + dev->dvb.frontend = tda10046_attach(&philips_europa_config, + &dev->i2c_adap); + break; + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + dev->dvb.frontend = tda10046_attach(&philips_europa_config, + &dev->i2c_adap); + break; + case SAA7134_BOARD_VIDEOMATE_DVBT_200: + dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, + &dev->i2c_adap); + break; #endif default: printk("%s: Huh? unknown DVB card?\n",dev->name); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 291c2e8d1086..69a2cebe8860 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -189,6 +189,9 @@ struct saa7134_format { #define SAA7134_BOARD_YUAN_TUN900 66 #define SAA7134_BOARD_BEHOLD_409FM 67 #define SAA7134_BOARD_GOTVIEW_7135 68 +#define SAA7134_BOARD_PHILIPS_EUROPA 69 +#define SAA7134_BOARD_VIDEOMATE_DVBT_300 70 +#define SAA7134_BOARD_VIDEOMATE_DVBT_200 71 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- 2.39.2