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/dvb-bt8xx.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/dvb-bt8xx.c')
-rw-r--r-- | linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c | 143 |
1 files changed, 48 insertions, 95 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c index a36a00e90..ddbd8c690 100644 --- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -34,12 +34,6 @@ #include "dvb-bt8xx.h" #include "bt878.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#include "dst.h" -#else -#include "../frontends/dst.h" -#endif - /* ID THAT MUST GO INTO i2c ids */ #ifndef I2C_DRIVERID_DVB_BT878A @@ -51,10 +45,6 @@ extern int bttv_get_cardinfo(unsigned int card, int *type, int *cardid); extern struct pci_dev* bttv_get_pcidev(unsigned int card); -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); - static LIST_HEAD(card_list); static int debug = 0; @@ -66,7 +56,7 @@ static void dvb_bt8xx_task(unsigned long data) //printk("%d ", finished_block); while (card->bt->last_block != card->bt->finished_block) { - (card->TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)(&card->demux, &card->bt->buf_cpu[card->bt->last_block * card->bt->block_bytes], card->bt->block_bytes); + (card->bt->TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)(&card->demux, &card->bt->buf_cpu[card->bt->last_block * card->bt->block_bytes], card->bt->block_bytes); card->bt->last_block = (card->bt->last_block + 1) % card->bt->block_count; } } @@ -115,71 +105,15 @@ static int master_xfer (struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], in { struct dvb_bt8xx_card *card = i2c->data; int retval; - int i; - struct dst_gpio_packet *mp; - if (down_interruptible (&card->i2c_lock)) + if (down_interruptible (&card->bt->gpio_lock)) return -ERESTARTSYS; - retval = 0; - for (i = 0 ; i < num; i++) { - - if (msgs[i].addr != DST_IG_ADDR) { - retval = i2c_transfer(card->i2c_adapter, &msgs[i], 1); - if (retval < 0) { - break; - } - continue; - } - if (msgs[i].len < sizeof(struct dst_gpio_packet)) { - retval = -EINVAL; - break; - } - mp = (struct dst_gpio_packet *)(msgs[i].buf); - /* special gpio signal */ - switch (mp->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(card->bttv_nr, - mp->dstg.enb.mask, - mp->dstg.enb.enable); - if (retval < 0) - break; - continue; - 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(card->bttv_nr, - mp->dstg.outp.mask, - mp->dstg.outp.highvals); - if (retval < 0) - break; - continue; - case DST_IG_READ: - /* read */ - retval = bttv_read_gpio(card->bttv_nr, &mp->dstg.rd.value); - if (retval < 0) - break; - // dprintk("dvb_bt8xx: dst read gpio 0x%02x\n", (unsigned)mp->dstg.rd.value); - continue; - case DST_IG_TS: - /* Set packet size */ - card->TS_Size = 1; - continue; + retval = i2c_transfer(card->i2c_adapter, msgs, num); - default: - retval = -EINVAL; - break; - } - break; - } - up(&card->i2c_lock); - if (retval < 0) - return retval; - if (i < num) { - dprintk("%s: i %d less than num %d\n", __FUNCTION__, i, num); - return -EIO; - } - return num; + up(&card->bt->gpio_lock); + + return retval; } static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev) @@ -231,7 +165,8 @@ static int __init dvb_bt8xx_card_match(unsigned int bttv_nr, char *card_name, u3 return -EFAULT; } - + init_MUTEX(&card->bt->gpio_lock); + card->bt->bttv_nr = bttv_nr; card->gpio_mode = gpio_mode; card->op_sync_orin = op_sync_orin; card->irq_err_ignore = irq_err_ignore; @@ -259,11 +194,10 @@ static void __init dvb_bt8xx_get_adaps(void) list_del(&card->list); kfree(card); } - init_MUTEX(&card->i2c_lock); } } -static void dvb_bt8xx_adap_free(struct i2c_adapter *adap) +static void dvb_bt8xx_i2c_adap_free(struct i2c_adapter *adap) { } @@ -275,12 +209,12 @@ static void __exit dvb_bt8xx_exit_adaps(void) /* More complicated. but cleaner better */ -static struct dvb_bt8xx_card *dvb_bt8xx_find_by_adap(struct i2c_adapter *adap) +static struct dvb_bt8xx_card *dvb_bt8xx_find_by_i2c_adap(struct i2c_adapter *adap) { struct dvb_bt8xx_card *card; struct list_head *item; - printk("find by adap: checking \"%s\"\n",adap->name); + printk("find by i2c adap: checking \"%s\"\n",adap->name); list_for_each(item, &card_list) { card = list_entry(item, struct dvb_bt8xx_card, list); if (card->i2c_adapter == adap) @@ -326,7 +260,6 @@ static int dvb_bt8xx_attach(struct i2c_adapter *adap) if (!card) return 0; card->i2c_adapter = adap; - init_MUTEX(&card->i2c_lock); printk("attach: \"%s\", to card %d\n", adap->name, card->bttv_nr); try_module_get(adap->owner); @@ -334,7 +267,7 @@ static int dvb_bt8xx_attach(struct i2c_adapter *adap) return 0; } -static void dvb_bt8xx_adap_free(struct i2c_adapter *adap) +static void dvb_bt8xx_i2c_adap_free(struct i2c_adapter *adap) { module_put(adap->owner); } @@ -343,7 +276,7 @@ static int dvb_bt8xx_detach(struct i2c_adapter *adap) { struct dvb_bt8xx_card *card; - card = dvb_bt8xx_find_by_adap(adap); + card = dvb_bt8xx_find_by_i2c_adap(adap); if (!card) return 0; @@ -384,22 +317,21 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) } - bttv_gpio_enable(card->bttv_nr, ~0, 0); - if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name)) < 0) { printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } + card->bt->adap_ptr = card->dvb_adapter; if (!(dvb_register_i2c_bus(master_xfer, card, card->dvb_adapter, 0))) { printk("dvb_bt8xx: dvb_register_i2c_bus of card%d failed\n", card->bttv_nr); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return -EFAULT; } @@ -420,7 +352,7 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } @@ -435,7 +367,7 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) dvb_dmx_release(&card->demux); dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } @@ -449,7 +381,7 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) dvb_dmx_release(&card->demux); dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } @@ -464,7 +396,7 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) dvb_dmx_release(&card->demux); dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } @@ -478,7 +410,7 @@ static int __init dvb_bt8xx_load_card( struct dvb_bt8xx_card *card) dvb_dmx_release(&card->demux); dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); return result; } @@ -509,6 +441,9 @@ static int __init dvb_bt8xx_load_all(void) } +#define BT878_NEBULA 0x68 +#define BT878_TWINHAN_DST 0x71 + static int __init dvb_bt8xx_init(void) { unsigned int card_nr = 0; @@ -527,6 +462,7 @@ static int __init dvb_bt8xx_init(void) * DA_APP(parallel) */ break; case 0x01010071: +nebula: dvb_bt8xx_card_match(card_nr, "Nebula DigiTV DVB-T", (1 << 26) | (1 << 14) | (1 << 5), 0, 0); @@ -539,6 +475,13 @@ static int __init dvb_bt8xx_init(void) /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; case 0x0: + if (card_type == BT878_NEBULA || + card_type == BT878_TWINHAN_DST) + goto dst; + goto unknown_card; + case 0x2611BD: + case 0x11822: +dst: dvb_bt8xx_card_match(card_nr, "DST DVB-S", 0x2204f2c, BT878_RISC_SYNC_MASK, BT878_APABORT | BT878_ARIPERR | BT878_APPERR | BT878_AFBUS); @@ -555,12 +498,23 @@ static int __init dvb_bt8xx_init(void) * RISC+FIFO ENABLE */ break; default: - dprintk("%s: unknown card_nr found %0X\n", - __FUNCTION__, card_nr); - dprintk("%s: unknown card_id found %0X\n", +unknown_card: + printk("%s: unknown card_id found %0X\n", __FUNCTION__, card_id); - dprintk("%s: unknown card_type found %0X\n", + if (card_type == BT878_NEBULA) { + printk("%s: bttv type set to nebula\n", + __FUNCTION__); + goto nebula; + } + if (card_type == BT878_TWINHAN_DST) { + printk("%s: bttv type set to Twinhan DST\n", + __FUNCTION__); + goto dst; + } + printk("%s: unknown card_type found %0X, NOT LOADED\n", __FUNCTION__, card_type); + printk("%s: unknown card_nr found %0X\n", + __FUNCTION__, card_nr); } card_nr++; } @@ -583,7 +537,6 @@ static void __exit dvb_bt8xx_exit(void) dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); bt878_stop(card->bt); - tasklet_kill(&card->bt->tasklet); dvb_net_release(&card->dvbnet); card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_mem); @@ -591,8 +544,8 @@ static void __exit dvb_bt8xx_exit(void) dvb_dmxdev_release(&card->dmxdev); dvb_dmx_release(&card->demux); dvb_unregister_i2c_bus(master_xfer, card->dvb_adapter, 0); + dvb_bt8xx_i2c_adap_free(card->i2c_adapter); dvb_unregister_adapter(card->dvb_adapter); - dvb_bt8xx_adap_free(card->i2c_adapter); list_del(&card->list); kfree(card); |