diff options
author | Jamie Honan <devnull@localhost> | 2003-10-28 02:33:54 +0000 |
---|---|---|
committer | Jamie Honan <devnull@localhost> | 2003-10-28 02:33:54 +0000 |
commit | 9b0f2f531601da08a7e4d942038c0a38cecdb0fe (patch) | |
tree | 3dbffcba745abd5621ac867259d1f1e3cefadd14 /linux/drivers/media/dvb/bt8xx/bt878.c | |
parent | 153c77c86087e28cb4b4830a2475dea6f1468238 (diff) | |
download | mediapointer-dvb-s2-9b0f2f531601da08a7e4d942038c0a38cecdb0fe.tar.gz mediapointer-dvb-s2-9b0f2f531601da08a7e4d942038c0a38cecdb0fe.tar.bz2 |
- reworked i2c / gpio so not so hackerish and more in line with
what Gerd is moving to
- allowed multiple instances of dst frontend.
- should handle terrestial cards correctly. Can mix and match
ts204, new tuner packets, symbol rate types in tuner packets
- has more DST strings on i2c asic discovery (in dst_check_ci)
- can override card PCI id using card=0x68 for bttv driver. bt878
audio dma still hogs all cards it finds, but this is an interim
release to work towards fixing this
- put in rudimentary signal strength / snr. The scale factors
are not right. Should work for terrestial / satellite.
- Put in Dimitri's fix of not doing dst_enable after reciept of
the 0xFF ack, but allowing the asic to do this itself.
Diffstat (limited to 'linux/drivers/media/dvb/bt8xx/bt878.c')
-rw-r--r-- | linux/drivers/media/dvb/bt8xx/bt878.c | 112 |
1 files changed, 101 insertions, 11 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/bt878.c b/linux/drivers/media/dvb/bt8xx/bt878.c index 6d8939782..32b0c53a1 100644 --- a/linux/drivers/media/dvb/bt8xx/bt878.c +++ b/linux/drivers/media/dvb/bt8xx/bt878.c @@ -41,7 +41,15 @@ #include <linux/vmalloc.h> #include <linux/init.h> +#include "dmxdev.h" +#include "dvbdev.h" #include "bt878.h" +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#include "dst-bt878.h" +#else +#include "../frontends/dst-bt878.h" +#endif + #include "dvb_functions.h" /**************************************/ @@ -60,10 +68,10 @@ MODULE_LICENSE("GPL"); int bt878_num; struct bt878 bt878[BT878_MAX]; -EXPORT_SYMBOL_GPL(bt878_debug); -EXPORT_SYMBOL_GPL(bt878_verbose); -EXPORT_SYMBOL_GPL(bt878_num); -EXPORT_SYMBOL_GPL(bt878); +EXPORT_SYMBOL(bt878_debug); +EXPORT_SYMBOL(bt878_verbose); +EXPORT_SYMBOL(bt878_num); +EXPORT_SYMBOL(bt878); #define btwrite(dat,adr) bmtwrite((dat), (bt->bt878_mem+(adr))) #define btread(adr) bmtread(bt->bt878_mem+(adr)) @@ -213,8 +221,8 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin, * the card specifics */ bt878_risc_program(bt, op_sync_orin); - controlreg &= ~0x13; - controlreg |= 0x1B; + controlreg &= ~0x1f; + controlreg |= 0x1b; btwrite(cpu_to_le32(bt->risc_dma), BT878_ARISC_START); @@ -258,8 +266,8 @@ void bt878_stop(struct bt878 *bt) bt->nr, i, stat); } -EXPORT_SYMBOL_GPL(bt878_start); -EXPORT_SYMBOL_GPL(bt878_stop); +EXPORT_SYMBOL(bt878_start); +EXPORT_SYMBOL(bt878_stop); /*****************************/ /* Interrupt service routine */ @@ -335,6 +343,68 @@ static irqreturn_t bt878_irq(int irq, void *dev_id, struct pt_regs *regs) return IRQ_HANDLED; } +extern int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data); +extern int bttv_read_gpio(unsigned int card, unsigned long *data); +extern int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data); + +int +bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *mp) +{ + int retval; + + retval = 0; + if (down_interruptible (&bt->gpio_lock)) + return -ERESTARTSYS; + /* special gpio signal */ + switch (cmd) { + case DST_IG_ENABLE: + // dprintk("dvb_bt8xx: dst enable mask 0x%02x enb 0x%02x \n", mp->dstg.enb.mask, mp->dstg.enb.enable); + retval = bttv_gpio_enable(bt->bttv_nr, + mp->enb.mask, + mp->enb.enable); + break; + case DST_IG_WRITE: + // dprintk("dvb_bt8xx: dst write gpio mask 0x%02x out 0x%02x\n", mp->dstg.outp.mask, mp->dstg.outp.highvals); + retval = bttv_write_gpio(bt->bttv_nr, + mp->outp.mask, + mp->outp.highvals); + + break; + case DST_IG_READ: + /* read */ + retval = bttv_read_gpio(bt->bttv_nr, &mp->rd.value); + // dprintk("dvb_bt8xx: dst read gpio 0x%02x\n", (unsigned)mp->dstg.rd.value); + break; + case DST_IG_TS: + /* Set packet size */ + bt->TS_Size = mp->psize; + break; + + default: + retval = -EINVAL; + break; + } + up(&bt->gpio_lock); + return retval; +} + +EXPORT_SYMBOL(bt878_device_control); + +struct bt878 *bt878_find_by_dvb_adap(struct dvb_adapter *adap) +{ + unsigned int card_nr; + + printk("bt878 find by dvb adap: checking \"%s\"\n",adap->name); + for (card_nr = 0; card_nr < bt878_num; card_nr++) { + if (bt878[card_nr].adap_ptr == adap) + return &bt878[card_nr]; + } + printk("bt878 find by dvb adap: NOT found \"%s\"\n",adap->name); + return NULL; +} + +EXPORT_SYMBOL(bt878_find_by_dvb_adap); + /***********************/ /* PCI device handling */ /***********************/ @@ -492,6 +562,19 @@ static struct pci_driver bt878_pci_driver = { .remove = bt878_remove, }; +static int bt878_pci_driver_registered = 0; + +/* This will be used later by dvb-bt8xx to only use the audio + * dma of certain cards */ +int bt878_find_audio_dma(void) +{ + // pci_register_driver(&bt878_pci_driver); + bt878_pci_driver_registered = 1; + return 0; +} + +EXPORT_SYMBOL(bt878_find_audio_dma); + /*******************************/ /* Module management functions */ /*******************************/ @@ -499,6 +582,7 @@ static struct pci_driver bt878_pci_driver = { int bt878_init_module(void) { bt878_num = 0; + bt878_pci_driver_registered = 0; printk(KERN_INFO "bt878: AUDIO driver version %d.%d.%d loaded\n", (BT878_VERSION_CODE >> 16) & 0xff, @@ -507,17 +591,23 @@ int bt878_init_module(void) /* bt878_check_chipset(); */ + /* later we register inside of bt878_find_audio_dma + * because we may want to ignore certain cards */ + bt878_pci_driver_registered = 1; return pci_module_init(&bt878_pci_driver); } void bt878_cleanup_module(void) { - pci_unregister_driver(&bt878_pci_driver); + if (bt878_pci_driver_registered) { + bt878_pci_driver_registered = 0; + pci_unregister_driver(&bt878_pci_driver); + } return; } -EXPORT_SYMBOL_GPL(bt878_init_module); -EXPORT_SYMBOL_GPL(bt878_cleanup_module); +EXPORT_SYMBOL(bt878_init_module); +EXPORT_SYMBOL(bt878_cleanup_module); module_init(bt878_init_module); module_exit(bt878_cleanup_module); |