summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-dvb.c')
-rw-r--r--linux/drivers/media/video/cx88/cx88-dvb.c78
1 files changed, 77 insertions, 1 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c
index 277a6d6e0..25632897c 100644
--- a/linux/drivers/media/video/cx88/cx88-dvb.c
+++ b/linux/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-dvb.c,v 1.19 2004/11/07 14:44:59 kraxel Exp $
+ * $Id: cx88-dvb.c,v 1.20 2004/11/30 17:00:13 kraxel Exp $
*
* device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines
@@ -178,6 +178,74 @@ struct mt352_config dvico_fusionhdtv_dvbt_plus = {
.pll_set = thomson_dtt7579_pll_set,
};
+static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
+{
+ static u8 clock_config [] = { 0x89, 0x38, 0x39 };
+ static u8 reset [] = { 0x50, 0x80 };
+ static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
+ static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
+ 0x00, 0xFF, 0x00, 0x40, 0x40 };
+ static u8 dntv_extra[] = { 0xB5, 0x7A };
+ static u8 capt_range_cfg[] = { 0x75, 0x32 };
+
+ mt352_write(fe, clock_config, sizeof(clock_config));
+ udelay(2000);
+ mt352_write(fe, reset, sizeof(reset));
+ mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
+
+ mt352_write(fe, agc_cfg, sizeof(agc_cfg));
+ udelay(2000);
+ mt352_write(fe, dntv_extra, sizeof(dntv_extra));
+ mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
+
+ return 0;
+}
+
+static int dntv_live_dvbt_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params,
+ u8* pllbuf)
+{
+ u32 div;
+ unsigned char bs = 0;
+ unsigned char cp = 0;
+
+ div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+
+ if (params->frequency < 150000000) cp = 0xB4;
+ else if (params->frequency < 173000000) cp = 0xBC;
+ else if (params->frequency < 250000000) cp = 0xB4;
+ else if (params->frequency < 400000000) cp = 0xBC;
+ else if (params->frequency < 420000000) cp = 0xF4;
+ else if (params->frequency < 470000000) cp = 0xFC;
+ else if (params->frequency < 600000000) cp = 0xBC;
+ else if (params->frequency < 730000000) cp = 0xF4;
+ else cp = 0xFC;
+
+ if (params->frequency < 150000000) bs = 0x01;
+ else if (params->frequency < 173000000) bs = 0x01;
+ else if (params->frequency < 250000000) bs = 0x02;
+ else if (params->frequency < 400000000) bs = 0x02;
+ else if (params->frequency < 420000000) bs = 0x02;
+ else if (params->frequency < 470000000) bs = 0x02;
+ else if (params->frequency < 600000000) bs = 0x08;
+ else if (params->frequency < 730000000) bs = 0x08;
+ else bs = 0x08;
+
+ pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address
+ pllbuf[1] = div >> 8;
+ pllbuf[2] = div & 0xff;
+ pllbuf[3] = cp;
+ pllbuf[4] = bs;
+
+ return 0;
+}
+
+static struct mt352_config dntv_live_dvbt_config = {
+ .demod_address = 0x0f,
+ .demod_init = dntv_live_dvbt_demod_init,
+ .pll_set = dntv_live_dvbt_pll_set,
+};
+
static int dvb_register(struct cx8802_dev *dev)
{
/* init struct videobuf_dvb */
@@ -208,6 +276,14 @@ static int dvb_register(struct cx8802_dev *dev)
dev->dvb.frontend->ops->info.frequency_max = 862000000;
}
break;
+ case CX88_BOARD_DNTV_LIVE_DVB_T:
+ dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
+ &dev->core->i2c_adap);
+ if (dev->dvb.frontend) {
+ dev->dvb.frontend->ops->info.frequency_min = 174000000;
+ dev->dvb.frontend->ops->info.frequency_max = 862000000;
+ }
+ break;
default:
printk("%s: FIXME: frontend handling not here yet ...\n",
dev->core->name);