diff options
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-i2c.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-video.c | 24 | ||||
-rw-r--r-- | linux/drivers/media/video/ir-kbd-gpio.c | 13 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-core.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-oss.c | 50 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 3 | ||||
-rw-r--r-- | linux/drivers/media/video/v4l1-compat.c | 1 | ||||
-rw-r--r-- | linux/drivers/media/video/video-buf.c | 27 |
9 files changed, 95 insertions, 31 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index df990c859..9fd1e5b58 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -404,13 +404,13 @@ void __devinit cx88_card_setup(struct cx8800_dev *dev) switch (dev->board) { case CX88_BOARD_HAUPPAUGE: - printk("cx88_card_setup: Hauppauge\n") + printk("cx88_card_setup: Hauppauge\n"); if (0 == dev->i2c_rc) i2c_eeprom(&dev->i2c_client,eeprom,sizeof(eeprom)); hauppauge_eeprom(dev,eeprom+8); break; case CX88_BOARD_GDI: - printk("cx88_card_setup: GDI\n") + printk("cx88_card_setup: GDI\n"); if (0 == dev->i2c_rc) i2c_eeprom(&dev->i2c_client,eeprom,sizeof(eeprom)); gdi_eeprom(dev,eeprom); diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index 2de607e1f..8bbf4bef5 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -164,6 +164,8 @@ int __devinit cx8800_i2c_init(struct cx8800_dev *dev) cx8800_bit_setsda(dev,1); dev->i2c_rc = i2c_bit_add_bus(&dev->i2c_adap); + printk("%s: i2c register %s\n", dev->name, + (0 == dev->i2c_rc) ? "ok" : "FAILED"); return dev->i2c_rc; } diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index e831b1c0d..56b72e44d 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -1757,6 +1757,30 @@ static int video_do_ioctl(struct inode *inode, struct file *file, } /* --- streaming capture ------------------------------------- */ + case VIDIOCGMBUF: + { + struct video_mbuf *mbuf = arg; + struct videobuf_queue *q; + struct v4l2_requestbuffers req; + unsigned int i; + + q = get_queue(fh); + memset(&req,0,sizeof(req)); + req.type = q->type; + req.count = 8; + req.memory = V4L2_MEMORY_MMAP; + err = videobuf_reqbufs(file,q,&req); + if (err < 0) + return err; + memset(mbuf,0,sizeof(*mbuf)); + mbuf->frames = req.count; + mbuf->size = 0; + for (i = 0; i < mbuf->frames; i++) { + mbuf->offsets[i] = q->bufs[i]->boff; + mbuf->size += q->bufs[i]->bsize; + } + return 0; + } case VIDIOC_REQBUFS: return videobuf_reqbufs(file, get_queue(fh), arg); diff --git a/linux/drivers/media/video/ir-kbd-gpio.c b/linux/drivers/media/video/ir-kbd-gpio.c index 550632d29..869ac05ed 100644 --- a/linux/drivers/media/video/ir-kbd-gpio.c +++ b/linux/drivers/media/video/ir-kbd-gpio.c @@ -279,14 +279,12 @@ static int ir_probe(struct device *dev) switch (sub->core->type) { case BTTV_AVERMEDIA: case BTTV_AVPHONE98: + case BTTV_AVERMEDIA98: ir_codes = ir_codes_avermedia; ir->mask_keycode = 0xf80000; ir->mask_keydown = 0x010000; break; - case BTTV_WINFAST2000: - ir_codes = winfast_codes; - ir->mask_keycode = 0x8f8; - break; + case BTTV_PXELVWPLTVPAK: ir_codes = ir_codes_pixelview; ir->mask_keycode = 0x003e00; @@ -300,9 +298,14 @@ static int ir_probe(struct device *dev) ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; + + case BTTV_WINFAST2000: + ir_codes = winfast_codes; + ir->mask_keycode = 0x8f8; + break; case BTTV_MAGICTVIEW061: case BTTV_MAGICTVIEW063: - ir_codes = ir_codes_empty; + ir_codes = winfast_codes; ir->mask_keycode = 0x0008e000; ir->mask_keydown = 0x00200000; break; diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index a35839c5b..d1ee34e29 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -466,7 +466,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev) } /* audio capture -- dma 3 */ - if (dev->oss.recording) { + if (dev->oss.dma_running) { ctrl |= SAA7134_MAIN_CTRL_TE6; irq |= SAA7134_IRQ1_INTE_RA3_1 | SAA7134_IRQ1_INTE_RA3_0; diff --git a/linux/drivers/media/video/saa7134/saa7134-oss.c b/linux/drivers/media/video/saa7134/saa7134-oss.c index 398e62438..b9081e027 100644 --- a/linux/drivers/media/video/saa7134/saa7134-oss.c +++ b/linux/drivers/media/video/saa7134/saa7134-oss.c @@ -92,6 +92,20 @@ static int dsp_buffer_free(struct saa7134_dev *dev) return 0; } +static void dsp_dma_start(struct saa7134_dev *dev) +{ + dev->oss.dma_blk = 0; + dev->oss.dma_running = 1; + saa7134_set_dmabits(dev); +} + +static void dsp_dma_stop(struct saa7134_dev *dev) +{ + dev->oss.dma_blk = -1; + dev->oss.dma_running = 0; + saa7134_set_dmabits(dev); +} + static int dsp_rec_start(struct saa7134_dev *dev) { int err, bswap, sign; @@ -178,10 +192,9 @@ static int dsp_rec_start(struct saa7134_dev *dev) saa_writel(SAA7134_RS_CONTROL(6),control); /* start dma */ + dev->oss.recording_on = 1; spin_lock_irqsave(&dev->slock,flags); - dev->oss.recording = 1; - dev->oss.dma_blk = 0; - saa7134_set_dmabits(dev); + dsp_dma_start(dev); spin_unlock_irqrestore(&dev->slock,flags); return 0; @@ -199,10 +212,9 @@ static int dsp_rec_stop(struct saa7134_dev *dev) dprintk("rec_stop dma_blk=%d\n",dev->oss.dma_blk); /* stop dma */ + dev->oss.recording_on = 0; spin_lock_irqsave(&dev->slock,flags); - dev->oss.dma_blk = -1; - dev->oss.recording = 0; - saa7134_set_dmabits(dev); + dsp_dma_stop(dev); spin_unlock_irqrestore(&dev->slock,flags); /* unlock buffer */ @@ -259,7 +271,7 @@ static int dsp_release(struct inode *inode, struct file *file) struct saa7134_dev *dev = file->private_data; down(&dev->oss.lock); - if (dev->oss.recording) + if (dev->oss.recording_on) dsp_rec_stop(dev); dsp_buffer_free(dev); dev->oss.users_dsp--; @@ -274,6 +286,7 @@ static ssize_t dsp_read(struct file *file, char *buffer, struct saa7134_dev *dev = file->private_data; DECLARE_WAITQUEUE(wait, current); unsigned int bytes; + unsigned long flags; int err,ret = 0; add_wait_queue(&dev->oss.wq, &wait); @@ -281,7 +294,7 @@ static ssize_t dsp_read(struct file *file, char *buffer, while (count > 0) { /* wait for data if needed */ if (0 == dev->oss.read_count) { - if (!dev->oss.recording) { + if (!dev->oss.recording_on) { err = dsp_rec_start(dev); if (err < 0) { if (0 == ret) @@ -289,6 +302,13 @@ static ssize_t dsp_read(struct file *file, char *buffer, break; } } + if (dev->oss.recording_on && + !dev->oss.dma_running) { + /* recover from overruns */ + spin_lock_irqsave(&dev->slock,flags); + dsp_dma_start(dev); + spin_unlock_irqrestore(&dev->slock,flags); + } if (file->f_flags & O_NONBLOCK) { if (0 == ret) ret = -EAGAIN; @@ -365,7 +385,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return -EFAULT; down(&dev->oss.lock); dev->oss.channels = val ? 2 : 1; - if (dev->oss.recording) { + if (dev->oss.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } @@ -379,7 +399,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return -EINVAL; down(&dev->oss.lock); dev->oss.channels = val; - if (dev->oss.recording) { + if (dev->oss.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } @@ -408,7 +428,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, case AFMT_S16_BE: down(&dev->oss.lock); dev->oss.afmt = val; - if (dev->oss.recording) { + if (dev->oss.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } @@ -438,7 +458,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_RESET: down(&dev->oss.lock); - if (dev->oss.recording) + if (dev->oss.recording_on) dsp_rec_stop(dev); up(&dev->oss.lock); return 0; @@ -448,7 +468,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_SETFRAGMENT: if (get_user(val, (int*)arg)) return -EFAULT; - if (dev->oss.recording) + if (dev->oss.recording_on) return -EBUSY; dsp_buffer_free(dev); dsp_buffer_conf(dev,1 << (val & 0xffff), (arg >> 16) & 0xffff); @@ -484,7 +504,7 @@ static unsigned int dsp_poll(struct file *file, struct poll_table_struct *wait) if (0 == dev->oss.read_count) { down(&dev->oss.lock); - if (!dev->oss.recording) + if (!dev->oss.recording_on) dsp_rec_start(dev); up(&dev->oss.lock); } else @@ -800,7 +820,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) if (dev->oss.read_count >= dev->oss.blksize * (dev->oss.blocks-2)) { dprintk("irq: overrun [full=%d/%d]\n",dev->oss.read_count, dev->oss.bufsize); - dsp_rec_stop(dev); + dsp_dma_stop(dev); goto done; } diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index df720a8f1..a0da01a82 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -329,7 +329,8 @@ struct saa7134_oss { unsigned int afmt; unsigned int rate; unsigned int channels; - unsigned int recording; + unsigned int recording_on; + unsigned int dma_running; unsigned int blocks; unsigned int blksize; unsigned int bufsize; diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c index c2c2e91a5..ba27685b7 100644 --- a/linux/drivers/media/video/v4l1-compat.c +++ b/linux/drivers/media/video/v4l1-compat.c @@ -477,6 +477,7 @@ v4l_compat_translate_ioctl(struct inode *inode, fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); memset(fmt2,0,sizeof(*fmt2)); fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); if (err1 < 0) dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n",err); diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c index 433255bbc..bf132faef 100644 --- a/linux/drivers/media/video/video-buf.c +++ b/linux/drivers/media/video/video-buf.c @@ -33,6 +33,11 @@ #include <media/video-buf.h> #endif +#define MAGIC_DMABUF 0x19721112 +#define MAGIC_BUFFER 0x20040302 +#define MAGIC_CHECK(is,should) if (unlikely((is) != (should))) \ + { printk(KERN_ERR "magic mismatch: %x (expected %x)\n",is,should); BUG(); } + static int debug = 0; MODULE_DESCRIPTION("helper module to manage video4linux pci dma buffers"); @@ -175,7 +180,7 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma->direction = direction; if (0 == addr) return -EINVAL; - + dma->bus_addr = addr; dma->nr_pages = nr_pages; return 0; @@ -183,8 +188,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) { - if (0 == dma->nr_pages) - BUG(); + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); + BUG_ON(0 == dma->nr_pages); if (dma->pages) { dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, @@ -216,8 +221,8 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma) { - if (!dma->sglen) - BUG(); + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); + BUG_ON(!dma->sglen); if (!dma->bus_addr) pci_dma_sync_sg(dev,dma->sglist,dma->nr_pages,dma->direction); @@ -226,6 +231,7 @@ int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma) int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma) { + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); if (!dma->sglen) return 0; @@ -239,8 +245,8 @@ int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma) int videobuf_dma_free(struct videobuf_dmabuf *dma) { - if (dma->sglen) - BUG(); + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); + BUG_ON(dma->sglen); if (dma->pages) { int i; @@ -270,6 +276,8 @@ void* videobuf_alloc(unsigned int size) if (NULL != vb) { memset(vb,0,size); init_waitqueue_head(&vb->done); + vb->magic = MAGIC_BUFFER; + vb->dma.magic = MAGIC_DMABUF; } return vb; } @@ -279,6 +287,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) int retval = 0; DECLARE_WAITQUEUE(wait, current); + MAGIC_CHECK(vb->magic,MAGIC_BUFFER); add_wait_queue(&vb->done, &wait); while (vb->state == STATE_ACTIVE || vb->state == STATE_QUEUED) { if (non_blocking) { @@ -307,6 +316,7 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, int err,pages; dma_addr_t bus; + MAGIC_CHECK(vb->magic,MAGIC_BUFFER); switch (vb->memory) { case V4L2_MEMORY_MMAP: case V4L2_MEMORY_USERPTR: @@ -458,6 +468,8 @@ void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, enum v4l2_buf_type type) { + MAGIC_CHECK(vb->magic,MAGIC_BUFFER); + b->index = vb->i; b->type = type; @@ -578,6 +590,7 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, buf = q->bufs[b->index]; if (NULL == buf) goto done; + MAGIC_CHECK(buf->magic,MAGIC_BUFFER); if (buf->memory != b->memory) goto done; if (buf->state == STATE_QUEUED || |