diff options
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-dvb.c')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-dvb.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 598b0e601..fa5cb5eb6 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.9 2004/09/15 16:15:24 kraxel Exp $ + * $Id: cx88-dvb.c,v 1.10 2004/09/23 13:58:19 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -30,6 +30,7 @@ #include <linux/file.h> #include "cx88.h" +#include "cx22702.h" MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); @@ -45,9 +46,9 @@ MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); /* ------------------------------------------------------------------ */ -static int dvb_buf_setup(struct file *file, unsigned int *count, unsigned int *size) +static int dvb_buf_setup(void *priv, unsigned int *count, unsigned int *size) { - struct cx8802_dev *dev = file->private_data; + struct cx8802_dev *dev = priv; dev->ts_packet_size = 188 * 4; dev->ts_packet_count = 32; @@ -57,22 +58,22 @@ static int dvb_buf_setup(struct file *file, unsigned int *count, unsigned int *s return 0; } -static int dvb_buf_prepare(struct file *file, struct videobuf_buffer *vb, +static int dvb_buf_prepare(void *priv, struct videobuf_buffer *vb, enum v4l2_field field) { - struct cx8802_dev *dev = file->private_data; + struct cx8802_dev *dev = priv; return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb); } -static void dvb_buf_queue(struct file *file, struct videobuf_buffer *vb) +static void dvb_buf_queue(void *priv, struct videobuf_buffer *vb) { - struct cx8802_dev *dev = file->private_data; + struct cx8802_dev *dev = priv; cx8802_buf_queue(dev, (struct cx88_buffer*)vb); } -static void dvb_buf_release(struct file *file, struct videobuf_buffer *vb) +static void dvb_buf_release(void *priv, struct videobuf_buffer *vb) { - struct cx8802_dev *dev = file->private_data; + struct cx8802_dev *dev = priv; cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb); } @@ -87,14 +88,11 @@ static int dvb_thread(void *data) { struct cx8802_dev *dev = data; struct videobuf_buffer *buf; - struct file *file; unsigned long flags; int err; dprintk(1,"dvb thread started\n"); - file = get_empty_filp(); - file->private_data = dev; - videobuf_read_start(file, &dev->dvbq); + videobuf_read_start(dev, &dev->dvbq); for (;;) { /* fetch next buffer */ @@ -118,7 +116,7 @@ static int dvb_thread(void *data) /* requeue buffer */ list_add_tail(&buf->stream,&dev->dvbq.stream); spin_lock_irqsave(dev->dvbq.irqlock,flags); - dev->dvbq.ops->buf_queue(file,buf); + dev->dvbq.ops->buf_queue(dev,buf); spin_unlock_irqrestore(dev->dvbq.irqlock,flags); /* log errors if any */ @@ -136,8 +134,7 @@ static int dvb_thread(void *data) } } - videobuf_read_stop(file, &dev->dvbq); - put_filp(file); + videobuf_read_stop(dev, &dev->dvbq); dprintk(1,"dvb thread stopped\n"); /* Hmm, linux becomes *very* unhappy without this ... */ @@ -212,9 +209,9 @@ static void dvb_unregister(struct cx8802_dev *dev) dev->demux.dmx.remove_frontend(&dev->demux.dmx, &dev->fe_hw); dvb_dmxdev_release(&dev->dmxdev); dvb_dmx_release(&dev->demux); - cx88_call_i2c_clients(dev->core, FE_UNREGISTER, dev->core->dvb_adapter); - dvb_unregister_adapter(dev->core->dvb_adapter); - dev->core->dvb_adapter = NULL; + if (dev->fe_handle) + dev->fe_release(dev->fe_handle); + dvb_unregister_adapter(dev->dvb_adapter); return; } @@ -222,15 +219,33 @@ static int dvb_register(struct cx8802_dev *dev) { int result; - result = dvb_register_adapter(&dev->core->dvb_adapter, dev->core->name, + /* adapter */ + result = dvb_register_adapter(&dev->dvb_adapter, dev->core->name, THIS_MODULE); if (result < 0) { printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n", dev->core->name, result); goto fail1; } - cx88_call_i2c_clients(dev->core, FE_REGISTER, dev->core->dvb_adapter); + /* frontend */ + switch (dev->core->board) { + case CX88_BOARD_HAUPPAUGE_DVB_T1: + case CX88_BOARD_CONEXANT_DVB_T1: + dev->fe_handle = cx22702_create(&dev->core->i2c_adap, + dev->dvb_adapter, + dev->core->pll_addr, + dev->core->pll_type, + dev->core->demod_addr); + dev->fe_release = cx22702_destroy; + break; + default: + printk("%s: FIXME: frontend handing not here yet ...\n", + dev->core->name); + break; + } + + /* demux */ dev->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; @@ -249,7 +264,7 @@ static int dvb_register(struct cx8802_dev *dev) dev->dmxdev.filternum = 256; dev->dmxdev.demux = &dev->demux.dmx; dev->dmxdev.capabilities = 0; - result = dvb_dmxdev_init(&dev->dmxdev, dev->core->dvb_adapter); + result = dvb_dmxdev_init(&dev->dmxdev, dev->dvb_adapter); if (result < 0) { printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n", dev->core->name, result); @@ -279,7 +294,7 @@ static int dvb_register(struct cx8802_dev *dev) goto fail6; } - dvb_net_init(dev->core->dvb_adapter, &dev->dvbnet, &dev->demux.dmx); + dvb_net_init(dev->dvb_adapter, &dev->dvbnet, &dev->demux.dmx); return 0; fail6: @@ -291,8 +306,7 @@ fail4: fail3: dvb_dmx_release(&dev->demux); fail2: - cx88_call_i2c_clients(dev->core, FE_UNREGISTER, dev->core->dvb_adapter); - dvb_unregister_adapter(dev->core->dvb_adapter); + dvb_unregister_adapter(dev->dvb_adapter); fail1: return result; } |