summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/bt8xx
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-11-13 20:57:41 +0000
committerAndrew de Quincy <devnull@localhost>2004-11-13 20:57:41 +0000
commit151736b9d8e24ef07b38c73900f7c179f18e9ffd (patch)
treeb47be2268e3a394527f3537a8610724393b2e41b /linux/drivers/media/dvb/bt8xx
parent8a325281bffaeda980f6d11cd22cd1be38a4a166 (diff)
downloadmediapointer-dvb-s2-151736b9d8e24ef07b38c73900f7c179f18e9ffd.tar.gz
mediapointer-dvb-s2-151736b9d8e24ef07b38c73900f7c179f18e9ffd.tar.bz2
Implemented vp3021 support
Diffstat (limited to 'linux/drivers/media/dvb/bt8xx')
-rw-r--r--linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c82
-rw-r--r--linux/drivers/media/dvb/bt8xx/dvb-bt8xx.h3
2 files changed, 68 insertions, 17 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index a71a464c7..de05c28e1 100644
--- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -1,5 +1,5 @@
/*
- * Bt8xx based DVB adapter driver
+ * Bt8xx based DVB adapter driver
*
* Copyright (C) 2002,2003 Florian Schirmer <jolt@tuxbox.org>
*
@@ -71,7 +71,7 @@ static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
int rc;
dprintk("dvb_bt8xx: start_feed\n");
-
+
if (!dvbdmx->dmx.frontend)
return -EINVAL;
@@ -91,7 +91,7 @@ static int dvb_bt8xx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
struct dvb_bt8xx_card *card = dvbdmx->priv;
dprintk("dvb_bt8xx: stop_feed\n");
-
+
if (!dvbdmx->dmx.frontend)
return -EINVAL;
@@ -117,7 +117,7 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
{
unsigned int card_nr;
-
+
/* Hmm, n squared. Hope n is small */
for (card_nr = 0; card_nr < bt878_num; card_nr++) {
if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev))
@@ -199,7 +199,7 @@ static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_front
else if (params->frequency < 470000000) cpump = 2;
else if (params->frequency < 750000000) cpump = 2;
else cpump = 3;
-
+
if (params->frequency < 175000000) band_select = 0x0e;
else if (params->frequency < 470000000) band_select = 0x05;
else band_select = 0x03;
@@ -238,7 +238,7 @@ static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe)
0x00, 0xFF, 0x00, 0x40, 0x40 };
static u8 mt352_av771_extra[] = { 0xB5, 0x7A };
static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
-
+
mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
udelay(2000);
@@ -305,6 +305,40 @@ static struct dst_config dst_config = {
};
+static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+{
+ struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
+ u8 buf[4];
+ u32 div;
+ struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = buf, .len = sizeof(buf) };
+
+ div = (params->frequency + 36166667) / 166667;
+
+ buf[0] = (div >> 8) & 0x7F;
+ buf[1] = div & 0xFF;
+ buf[2] = 0x85;
+ if ((params->frequency >= 47000000) && (params->frequency < 153000000))
+ buf[3] = 0x01;
+ else if ((params->frequency >= 153000000) && (params->frequency < 430000000))
+ buf[3] = 0x02;
+ else if ((params->frequency >= 430000000) && (params->frequency < 824000000))
+ buf[3] = 0x0C;
+ else if ((params->frequency >= 824000000) && (params->frequency < 863000000))
+ buf[3] = 0x8C;
+ else
+ return -EINVAL;
+
+ i2c_transfer(card->i2c_adapter, &msg, 1);
+ return 0;
+}
+
+static struct nxt6000_config vp3021_alps_tded4_config = {
+
+ .demod_address = 0x14,
+ .clock_inversion = 1,
+ .pll_set = vp3021_alps_tded4_pll_set,
+};
+
static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
{
@@ -320,6 +354,17 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
break;
#endif
+#ifdef BTTV_TWINHAN_VP3021
+ case BTTV_TWINHAN_VP3021:
+#else
+ case BTTV_NEBULA_DIGITV:
+#endif
+ card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
+ if (card->fe != NULL) {
+ break;
+ }
+ break;
+
case BTTV_AVDVBT_761:
card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
if (card->fe != NULL) {
@@ -368,7 +413,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
THIS_MODULE)) < 0) {
printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
return result;
-
+
}
card->dvb_adapter->priv = card;
@@ -384,7 +429,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
card->demux.start_feed = dvb_bt8xx_start_feed;
card->demux.stop_feed = dvb_bt8xx_stop_feed;
card->demux.write_to_decoder = NULL;
-
+
if ((result = dvb_dmx_init(&card->demux)) < 0) {
printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
@@ -395,7 +440,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
card->dmxdev.filternum = 256;
card->dmxdev.demux = &card->demux.dmx;
card->dmxdev.capabilities = 0;
-
+
if ((result = dvb_dmxdev_init(&card->dmxdev, card->dvb_adapter)) < 0) {
printk("dvb_bt8xx: dvb_dmxdev_init failed (errno = %d)\n", result);
@@ -414,7 +459,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
dvb_unregister_adapter(card->dvb_adapter);
return result;
}
-
+
card->fe_mem.source = DMX_MEMORY_FE;
if ((result = card->demux.dmx.add_frontend(&card->demux.dmx, &card->fe_mem)) < 0) {
@@ -472,11 +517,16 @@ static int dvb_bt8xx_probe(struct device *dev)
card->gpio_mode = 0x0400C060;
card->op_sync_orin = 0;
card->irq_err_ignore = 0;
- /* 26, 15, 14, 6, 5
- * A_PWRDN DA_DPM DA_SBR DA_IOM_DA
+ /* 26, 15, 14, 6, 5
+ * A_PWRDN DA_DPM DA_SBR DA_IOM_DA
* DA_APP(parallel) */
break;
-/* case BTTV_NEBULA_DIGITV: UNDEFINED HARDWARE */
+
+#ifdef BTTV_TWINHAN_VP3021
+ case BTTV_TWINHAN_VP3021:
+#else
+ case BTTV_NEBULA_DIGITV:
+#endif
case BTTV_AVDVBT_761:
card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
card->op_sync_orin = 0;
@@ -517,7 +567,7 @@ static int dvb_bt8xx_probe(struct device *dev)
}
dprintk("dvb_bt8xx: identified card%d as %s\n", card->bttv_nr, card->card_name);
-
+
if (!(bttv_pci_dev = bttv_get_pcidev(card->bttv_nr))) {
printk("dvb_bt8xx: no pci device for card %d\n", card->bttv_nr);
kfree(card);
@@ -529,10 +579,10 @@ static int dvb_bt8xx_probe(struct device *dev)
card->bttv_nr);
printk("dvb_bt8xx: if you have the ALSA bt87x audio driver "
"installed, try removing it.\n");
-
+
kfree(card);
return -EFAULT;
-
+
}
init_MUTEX(&card->bt->gpio_lock);
diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.h b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.h
index 2869c4909..c09161836 100644
--- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.h
+++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.h
@@ -1,5 +1,5 @@
/*
- * Bt8xx based DVB adapter driver
+ * Bt8xx based DVB adapter driver
*
* Copyright (C) 2002,2003 Florian Schirmer <jolt@tuxbox.org>
* Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de>
@@ -29,6 +29,7 @@
#include "mt352.h"
#include "sp887x.h"
#include "dst.h"
+#include "nxt6000.h"
struct dvb_bt8xx_card {
struct semaphore lock;