summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88/cx88-dvb.c')
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c104
1 files changed, 69 insertions, 35 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 6ad1458..78d2232 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-dvb.c,v 1.42 2005/07/12 15:44:55 mkrufky Exp $
+ * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $
*
* device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines
@@ -29,27 +29,23 @@
#include <linux/kthread.h>
#include <linux/file.h>
#include <linux/suspend.h>
-
-#define CONFIG_DVB_MT352 1
-#define CONFIG_DVB_CX22702 1
-#define CONFIG_DVB_OR51132 1
-#define CONFIG_DVB_LGDT3302 1
+#include <linux/config.h>
#include "cx88.h"
#include "dvb-pll.h"
-#if CONFIG_DVB_MT352
+#ifdef HAVE_MT352
# include "mt352.h"
# include "mt352_priv.h"
#endif
-#if CONFIG_DVB_CX22702
+#ifdef HAVE_CX22702
# include "cx22702.h"
#endif
-#if CONFIG_DVB_OR51132
+#ifdef HAVE_OR51132
# include "or51132.h"
#endif
-#if CONFIG_DVB_LGDT3302
-# include "lgdt3302.h"
+#ifdef HAVE_LGDT330X
+# include "lgdt330x.h"
#endif
MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
@@ -107,7 +103,7 @@ static struct videobuf_queue_ops dvb_qops = {
/* ------------------------------------------------------------------ */
-#if CONFIG_DVB_MT352
+#ifdef HAVE_MT352
static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
{
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
@@ -177,7 +173,7 @@ static struct mt352_config dntv_live_dvbt_config = {
};
#endif
-#if CONFIG_DVB_CX22702
+#ifdef HAVE_CX22702
static struct cx22702_config connexant_refboard_config = {
.demod_address = 0x43,
.output_mode = CX22702_SERIAL_OUTPUT,
@@ -193,7 +189,7 @@ static struct cx22702_config hauppauge_novat_config = {
};
#endif
-#if CONFIG_DVB_OR51132
+#ifdef HAVE_OR51132
static int or51132_set_ts_param(struct dvb_frontend* fe,
int is_punctured)
{
@@ -210,8 +206,45 @@ static struct or51132_config pchdtv_hd3000 = {
};
#endif
-#if CONFIG_DVB_LGDT3302
-static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
+#ifdef HAVE_LGDT330X
+static int lgdt330x_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params)
+{
+ struct cx8802_dev *dev= fe->dvb->priv;
+ u8 buf[4];
+ struct i2c_msg msg =
+ { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 };
+ int err;
+
+ dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0);
+ dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
+ if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
+ printk(KERN_WARNING "cx88-dvb: %s error "
+ "(addr %02x <- %02x, err = %i)\n",
+ __FUNCTION__, buf[0], buf[1], err);
+ if (err < 0)
+ return err;
+ else
+ return -EREMOTEIO;
+ }
+ return 0;
+}
+
+static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
+{
+ struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx88_core *core = dev->core;
+
+ dprintk(1, "%s: index = %d\n", __FUNCTION__, index);
+ if (index == 0)
+ cx_clear(MO_GP0_IO, 8);
+ else
+ cx_set(MO_GP0_IO, 8);
+ return 0;
+}
+
+static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
{
struct cx8802_dev *dev= fe->dvb->priv;
if (is_punctured)
@@ -221,18 +254,12 @@ static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
return 0;
}
-static struct lgdt3302_config fusionhdtv_3_gold_q = {
- .demod_address = 0x0e,
- .pll_address = 0x61,
- .pll_desc = &dvb_pll_microtune_4042,
- .set_ts_params = lgdt3302_set_ts_param,
-};
-
-static struct lgdt3302_config fusionhdtv_3_gold_t = {
+static struct lgdt330x_config fusionhdtv_3_gold = {
.demod_address = 0x0e,
- .pll_address = 0x61,
- .pll_desc = &dvb_pll_thomson_dtt7611,
- .set_ts_params = lgdt3302_set_ts_param,
+ .demod_chip = LGDT3302,
+ .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
+ .pll_set = lgdt330x_pll_set,
+ .set_ts_params = lgdt330x_set_ts_param,
};
#endif
@@ -244,7 +271,7 @@ static int dvb_register(struct cx8802_dev *dev)
/* init frontend */
switch (dev->core->board) {
-#if CONFIG_DVB_CX22702
+#ifdef HAVE_CX22702
case CX88_BOARD_HAUPPAUGE_DVB_T1:
dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
&dev->core->i2c_adap);
@@ -255,7 +282,7 @@ static int dvb_register(struct cx8802_dev *dev)
&dev->core->i2c_adap);
break;
#endif
-#if CONFIG_DVB_MT352
+#ifdef HAVE_MT352
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
dev->core->pll_addr = 0x61;
dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -277,13 +304,13 @@ static int dvb_register(struct cx8802_dev *dev)
&dev->core->i2c_adap);
break;
#endif
-#if CONFIG_DVB_OR51132
+#ifdef HAVE_OR51132
case CX88_BOARD_PCHDTV_HD3000:
dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
&dev->core->i2c_adap);
break;
#endif
-#if CONFIG_DVB_LGDT3302
+#ifdef HAVE_LGDT330X
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
dev->ts_gen_cntrl = 0x08;
{
@@ -292,9 +319,14 @@ static int dvb_register(struct cx8802_dev *dev)
cx_clear(MO_GP0_IO, 1);
mdelay(100);
- cx_set(MO_GP0_IO, 9); // ANT connector too FIXME
+ cx_set(MO_GP0_IO, 1);
mdelay(200);
- dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_q,
+
+ /* Select RF connector callback */
+ fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
+ dev->core->pll_addr = 0x61;
+ dev->core->pll_desc = &dvb_pll_microtune_4042;
+ dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
&dev->core->i2c_adap);
}
break;
@@ -306,9 +338,11 @@ static int dvb_register(struct cx8802_dev *dev)
cx_clear(MO_GP0_IO, 1);
mdelay(100);
- cx_set(MO_GP0_IO, 9); /* ANT connector too FIXME */
+ cx_set(MO_GP0_IO, 9);
mdelay(200);
- dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_t,
+ dev->core->pll_addr = 0x61;
+ dev->core->pll_desc = &dvb_pll_thomson_dtt7611;
+ dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
&dev->core->i2c_adap);
}
break;
OpenPOWER on IntegriCloud