[media] cx23885: initial support for VBI with the cx23885
authorSteven Toth <stoth@kernellabs.com>
Mon, 10 Oct 2011 14:09:54 +0000 (11:09 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 14 Oct 2011 20:08:46 +0000 (17:08 -0300)
A handlful of coding style issue cleaned up in the following patches.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-alsa.c
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/cx23885/cx23885-vbi.c
drivers/media/video/cx23885/cx23885.h

index 668776d0e98df178ff31f887163dea0a7b10c4f7..795169237e70aa3298763c34d393ae7c75b463d1 100644 (file)
 #define AUDIO_SRAM_CHANNEL     SRAM_CH07
 
 #define dprintk(level, fmt, arg...)    if (audio_debug >= level) \
-       printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg)
+       printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg)
 
 #define dprintk_core(level, fmt, arg...)       if (audio_debug >= level) \
-       printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg)
+       printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg)
 
 /****************************************************************************
                        Module global static vars
index a50b5cf2b6beee5839831f1daab0a1f77396a9d9..d42d2251d48604299c0c02c0072e8ea9a4c2f03c 100644 (file)
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(card, "card type");
 
 #define dprintk(level, fmt, arg...)\
        do { if (debug >= level)\
-               printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\
+               printk(KERN_DEBUG "%s: " fmt, dev->name, ## arg);\
        } while (0)
 
 static unsigned int cx23885_devcount;
index c0b60382ad13602ff9c2fc512cf92fe531568cc2..23ff098773950daf3cc8001f7a236a84b01fc572 100644 (file)
@@ -62,30 +62,65 @@ int cx23885_vbi_fmt(struct file *file, void *priv,
        return 0;
 }
 
+/* We're given the Video Interrupt status register.
+ * The cx23885_video_irq() func has already validated
+ * the potential error bits, we just need to
+ * deal with vbi payload and return indication if
+ * we actually processed any payload.
+ */
+int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status)
+{
+       u32 count;
+       int handled = 0;
+
+       if (status & VID_BC_MSK_VBI_RISCI1) {
+               dprintk(1, "%s() VID_BC_MSK_VBI_RISCI1\n", __func__);
+               spin_lock(&dev->slock);
+               count = cx_read(VID_A_GPCNT);
+               cx23885_video_wakeup(dev, &dev->vbiq, count);
+               spin_unlock(&dev->slock);
+               handled++;
+       }
+
+       if (status & VID_BC_MSK_VBI_RISCI2) {
+               dprintk(1, "%s() VID_BC_MSK_VBI_RISCI2\n", __func__);
+               dprintk(2, "stopper vbi\n");
+               spin_lock(&dev->slock);
+               cx23885_restart_vbi_queue(dev, &dev->vbiq);
+               spin_unlock(&dev->slock);
+               handled++;
+       }
+
+       return handled;
+}
+
 static int cx23885_start_vbi_dma(struct cx23885_dev    *dev,
                         struct cx23885_dmaqueue *q,
                         struct cx23885_buffer   *buf)
 {
+       dprintk(1, "%s()\n", __func__);
+
        /* setup fifo + format */
        cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH02],
                                buf->vb.width, buf->risc.dma);
 
        /* reset counter */
+       cx_write(VID_A_GPCNT_CTL, 3);
        q->count = 1;
 
-       /* enable irqs */
+       /* enable irq */
        cx23885_irq_add_enable(dev, 0x01);
        cx_set(VID_A_INT_MSK, 0x000022);
 
        /* start dma */
        cx_set(DEV_CNTRL2, (1<<5));
-       cx_set(VID_A_DMA_CTL, 0x00000022);
+       cx_set(VID_A_DMA_CTL, 0x22); /* FIFO and RISC enable */
 
        return 0;
 }
 
 
-static int cx23885_restart_vbi_queue(struct cx23885_dev    *dev,
+int cx23885_restart_vbi_queue(struct cx23885_dev    *dev,
                             struct cx23885_dmaqueue *q)
 {
        struct cx23885_buffer *buf;
@@ -115,6 +150,7 @@ void cx23885_vbi_timeout(unsigned long data)
 
        cx23885_sram_channel_dump(dev, &dev->sram_channels[SRAM_CH02]);
 
+       /* Stop the VBI engine */
        cx_clear(VID_A_DMA_CTL, 0x22);
 
        spin_lock_irqsave(&dev->slock, flags);
index 892d971361a9e8048a81bd3c3dc4a92cf0b1c022..718afd8eafc8cf685f8ae3b9e7b7a8beed185692 100644 (file)
@@ -564,6 +564,8 @@ extern void cx23885_free_buffer(struct videobuf_queue *q,
 extern int cx23885_video_register(struct cx23885_dev *dev);
 extern void cx23885_video_unregister(struct cx23885_dev *dev);
 extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status);
+extern void cx23885_video_wakeup(struct cx23885_dev *dev,
+       struct cx23885_dmaqueue *q, u32 count);
 
 /* ----------------------------------------------------------- */
 /* cx23885-vbi.c                                               */
@@ -571,6 +573,9 @@ extern int cx23885_vbi_fmt(struct file *file, void *priv,
        struct v4l2_format *f);
 extern void cx23885_vbi_timeout(unsigned long data);
 extern struct videobuf_queue_ops cx23885_vbi_qops;
+extern int cx23885_restart_vbi_queue(struct cx23885_dev *dev,
+       struct cx23885_dmaqueue *q);
+extern int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status);
 
 /* cx23885-i2c.c                                                */
 extern int cx23885_i2c_register(struct cx23885_i2c *bus);