summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cx88')
-rw-r--r--linux/drivers/media/video/cx88/cx88-cards.c24
-rw-r--r--linux/drivers/media/video/cx88/cx88-dvb.c113
-rw-r--r--linux/drivers/media/video/cx88/cx88.h3
3 files changed, 123 insertions, 17 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c
index 8478d28b2..01413b045 100644
--- a/linux/drivers/media/video/cx88/cx88-cards.c
+++ b/linux/drivers/media/video/cx88/cx88-cards.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-cards.c,v 1.46 2004/10/19 16:02:04 kraxel Exp $
+ * $Id: cx88-cards.c,v 1.47 2004/11/03 09:04:50 kraxel Exp $
*
* device driver for Conexant 2388x based TV cards
* card-specific stuff.
@@ -336,11 +336,11 @@ struct cx88_board cx88_boards[] = {
.tuner_type = TUNER_ABSENT, /* No analog tuner */
.input = {{
.type = CX88_VMUX_COMPOSITE1,
- .vmux = 0,
+ .vmux = 1,
.gpio0 = 0x000027df,
},{
.type = CX88_VMUX_SVIDEO,
- .vmux = 1,
+ .vmux = 2,
.gpio0 = 0x000027df,
}},
.dvb = 1,
@@ -438,6 +438,20 @@ struct cx88_board cx88_boards[] = {
}},
.blackbird = 1,
},
+ [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
+ .name = "DVICO FusionHDTV DVB-T Plus",
+ .tuner_type = TUNER_ABSENT, /* No analog tuner */
+ .input = {{
+ .type = CX88_VMUX_COMPOSITE1,
+ .vmux = 1,
+ .gpio0 = 0x000027df,
+ },{
+ .type = CX88_VMUX_SVIDEO,
+ .vmux = 2,
+ .gpio0 = 0x000027df,
+ }},
+ .dvb = 1,
+ },
};
const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
@@ -525,6 +539,10 @@ struct cx88_subid cx88_subids[] = {
.subvendor = 0x1540,
.subdevice = 0x2580,
.card = CX88_BOARD_PROVIDEO_PV259,
+ },{
+ .subvendor = 0x18AC,
+ .subdevice = 0xDB10,
+ .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
}
};
const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c
index 87c800399..6a85830f3 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.15 2004/10/20 17:44:24 kraxel Exp $
+ * $Id: cx88-dvb.c,v 1.16 2004/11/03 09:04:51 kraxel Exp $
*
* device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines
@@ -33,6 +33,7 @@
#include "cx88.h"
#include "cx22702.h"
#include "mt352.h"
+#include "mt352_priv.h" /* FIXME */
MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
@@ -88,24 +89,93 @@ struct videobuf_queue_ops dvb_qops = {
/* ------------------------------------------------------------------ */
-static int dvico_fusionhdtv_init(struct dvb_frontend* fe)
+static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
{
- printk("FIXME: %s\n",__FUNCTION__);
+ static u8 mt352_clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
+ static u8 mt352_reset [] = { RESET, 0x80 };
+ static u8 mt352_adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
+ static u8 mt352_agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
+ static u8 mt352_gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
+ static u8 mt352_capt_range_cfg[] = { CAPT_RANGE, 0x32 };
+
+ mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
+ udelay(200);
+ mt352_write(fe, mt352_reset, sizeof(mt352_reset));
+ mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
+
+ mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg));
+ mt352_write(fe, mt352_gpp_ctl_cfg, sizeof(mt352_gpp_ctl_cfg));
+ mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg));
+
+ return 0;
+}
+
+static int lg_z201_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params, u8* pllbuf)
+{
+ u32 div;
+ unsigned char cp = 0;
+ unsigned char bs = 0;
+
+ #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
+ div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+
+ if (params->frequency < 542000000) cp = 0xbc;
+ else if (params->frequency < 830000000) cp = 0xf4;
+ else cp = 0xfc;
+
+ if (params->frequency == 0) bs = 0x03;
+ else if (params->frequency < 157500000) bs = 0x01;
+ else if (params->frequency < 443250000) bs = 0x02;
+ else bs = 0x04;
+
+ 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 int dvico_fusionhdtv_pll_set(struct dvb_frontend* fe,
- struct dvb_frontend_parameters* params,
- u8* pllbuf)
+static int thomson_dtt7579_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params,
+ u8* pllbuf)
{
- printk("FIXME: %s\n",__FUNCTION__);
+ u32 div;
+ unsigned char cp = 0;
+ unsigned char bs = 0;
+
+ #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
+ div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+
+ if (params->frequency < 542000000) cp = 0xb4;
+ else if (params->frequency < 771000000) cp = 0xbc;
+ else cp = 0xf4;
+
+ if (params->frequency == 0) bs = 0x03;
+ else if (params->frequency < 443250000) bs = 0x02;
+ else bs = 0x08;
+
+ pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address
+ pllbuf[1] = div >> 8;
+ pllbuf[2] = div & 0xff;
+ pllbuf[3] = cp;
+ pllbuf[4] = bs;
+
return 0;
}
-struct mt352_config dvico_fusionhdtv = {
- .demod_address = 42,
- .demod_init = dvico_fusionhdtv_init,
- .pll_set = dvico_fusionhdtv_pll_set,
+struct mt352_config dvico_fusionhdtv_dvbt1 = {
+ .demod_address = 0x0F,
+ .demod_init = dvico_fusionhdtv_demod_init,
+ .pll_set = lg_z201_pll_set,
+};
+
+struct mt352_config dvico_fusionhdtv_dvbt_plus = {
+ .demod_address = 0x0F,
+ .demod_init = dvico_fusionhdtv_demod_init,
+ .pll_set = thomson_dtt7579_pll_set,
};
static int dvb_register(struct cx8802_dev *dev)
@@ -124,17 +194,34 @@ static int dvb_register(struct cx8802_dev *dev)
dev->core->demod_addr);
break;
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
- dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv,
+ dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt1,
+ &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;
+ case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
+ dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt_plus,
&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 handing not here yet ...\n",
+ printk("%s: FIXME: frontend handling not here yet ...\n",
dev->core->name);
break;
}
if (NULL == dev->dvb.frontend)
return -1;
+ /* Copy the board name into the DVB structure */
+ strlcpy(dev->dvb.frontend->ops->info.name,
+ cx88_boards[dev->core->board].name,
+ sizeof(dev->dvb.frontend->ops->info.name));
+
/* register everything */
return videobuf_dvb_register(&dev->dvb);
}
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h
index 8dcb768c8..8100f5d4d 100644
--- a/linux/drivers/media/video/cx88/cx88.h
+++ b/linux/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
/*
- * $Id: cx88.h,v 1.39 2004/10/25 11:26:36 kraxel Exp $
+ * $Id: cx88.h,v 1.40 2004/11/03 09:04:51 kraxel Exp $
*
* v4l2 device driver for cx2388x based TV cards
*
@@ -156,6 +156,7 @@ extern struct sram_channel cx88_sram_channels[];
#define CX88_BOARD_HAUPPAUGE_DVB_T1 18
#define CX88_BOARD_CONEXANT_DVB_T1 19
#define CX88_BOARD_PROVIDEO_PV259 20
+#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21
enum cx88_itype {
CX88_VMUX_COMPOSITE1 = 1,