]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] cx23885: add vbi buffer formatting, window changes and video core changes
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:11:15 +0000 (17:11 -0300)
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/cx23885/cx23885-vbi.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx23885/cx23885.h

index d42d2251d48604299c0c02c0072e8ea9a4c2f03c..40e68b22015eea4c54ce28babecd2701feb03d1c 100644 (file)
@@ -1214,6 +1214,54 @@ int cx23885_risc_databuffer(struct pci_dev *pci,
        return 0;
 }
 
+int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
+                       struct scatterlist *sglist, unsigned int top_offset,
+                       unsigned int bottom_offset, unsigned int bpl,
+                       unsigned int padding, unsigned int lines)
+{
+       u32 instructions, fields;
+       __le32 *rp;
+       int rc;
+
+       fields = 0;
+       if (UNSET != top_offset)
+               fields++;
+       if (UNSET != bottom_offset)
+               fields++;
+
+       /* estimate risc mem: worst case is one write per page border +
+          one write per scan line + syncs + jump (all 2 dwords).  Padding
+          can cause next bpl to start close to a page border.  First DMA
+          region may be smaller than PAGE_SIZE */
+       /* write and jump need and extra dword */
+       instructions  = fields * (1 + ((bpl + padding) * lines)
+               / PAGE_SIZE + lines);
+       instructions += 2;
+       rc = btcx_riscmem_alloc(pci, risc, instructions*12);
+       if (rc < 0)
+               return rc;
+       /* write risc instructions */
+       rp = risc->cpu;
+
+       /* Sync to line 6, so US CC line 21 will appear in line '12'
+        * in the userland vbi payload */
+       if (UNSET != top_offset)
+               rp = cx23885_risc_field(rp, sglist, top_offset, 6,
+                                       bpl, padding, lines, 0);
+
+       if (UNSET != bottom_offset)
+               rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x207,
+                                       bpl, padding, lines, 0);
+
+
+
+       /* save pointer to jmp instruction address */
+       risc->jmp = rp;
+       BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
+       return 0;
+}
+
+
 int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
                                u32 reg, u32 mask, u32 value)
 {
index 1b3a01c8d1fa2d6342f131597a3b170f0e3d6548..10d8af877f12728f4a8e970feb2928455877e04a 100644 (file)
@@ -56,12 +56,13 @@ int cx23885_vbi_fmt(struct file *file, void *priv,
        if (dev->tvnorm & V4L2_STD_525_60) {
                /* ntsc */
                f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
-               f->fmt.vbi.sampling_rate = 28636363;
+               f->fmt.vbi.sampling_rate = 27000000;
                f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
-               f->fmt.vbi.offset = 64 * 4;
+               f->fmt.vbi.offset = 0;
+               f->fmt.vbi.flags = 0;
                f->fmt.vbi.start[0] = 10;
                f->fmt.vbi.count[0] = 17;
-               f->fmt.vbi.start[1] = 272;
+               f->fmt.vbi.start[1] = 263 + 10 + 1;
                f->fmt.vbi.count[1] = 17;
        } else if (dev->tvnorm & V4L2_STD_625_50) {
                /* pal */
@@ -222,7 +223,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
                rc = videobuf_iolock(q, &buf->vb, NULL);
                if (0 != rc)
                        goto fail;
-               cx23885_risc_buffer(dev->pci, &buf->risc,
+               cx23885_risc_vbibuffer(dev->pci, &buf->risc,
                                 dma->sglist,
                                 0, buf->vb.width * buf->vb.height,
                                 buf->vb.width, 0,
index 53d9f9dd927d520ca2f0ad9a12c7846988673b6d..cb9e05f92febc4dbd9616a74c36e6174cdbc93a6 100644 (file)
@@ -1070,7 +1070,8 @@ static int vidioc_streamon(struct file *file, void *priv,
        struct cx23885_dev *dev = fh->dev;
        dprintk(1, "%s()\n", __func__);
 
-       if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
+       if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
+               (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
                return -EINVAL;
        if (unlikely(i != fh->type))
                return -EINVAL;
@@ -1087,7 +1088,8 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
        int err, res;
        dprintk(1, "%s()\n", __func__);
 
-       if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+       if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
+               (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
                return -EINVAL;
        if (i != fh->type)
                return -EINVAL;
index 718afd8eafc8cf685f8ae3b9e7b7a8beed185692..670281af3361d05216e4417b4fe9b7f7bf78079b 100644 (file)
@@ -509,6 +509,11 @@ extern int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
        unsigned int top_offset, unsigned int bottom_offset,
        unsigned int bpl, unsigned int padding, unsigned int lines);
 
+extern int cx23885_risc_vbibuffer(struct pci_dev *pci,
+       struct btcx_riscmem *risc, struct scatterlist *sglist,
+       unsigned int top_offset, unsigned int bottom_offset,
+       unsigned int bpl, unsigned int padding, unsigned int lines);
+
 void cx23885_cancel_buffers(struct cx23885_tsport *port);
 
 extern int cx23885_restart_queue(struct cx23885_tsport *port,