aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2011-10-10 10:09:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-10-14 16:11:15 -0400
commit5ab27e6d31be4a794a44477b94aa56dd625eb0f2 (patch)
tree4fe86021ecf03bd6ed4bcc9ae2a4d216a1a18589 /drivers/media/video
parent4f9c41439c495b4685393cf865418f7e6425fe60 (diff)
[media] cx23885: add vbi buffer formatting, window changes and video core changes
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c48
-rw-r--r--drivers/media/video/cx23885/cx23885-vbi.c9
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c6
-rw-r--r--drivers/media/video/cx23885/cx23885.h5
4 files changed, 62 insertions, 6 deletions
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index d42d2251d486..40e68b22015e 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1214,6 +1214,54 @@ int cx23885_risc_databuffer(struct pci_dev *pci,
1214 return 0; 1214 return 0;
1215} 1215}
1216 1216
1217int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
1218 struct scatterlist *sglist, unsigned int top_offset,
1219 unsigned int bottom_offset, unsigned int bpl,
1220 unsigned int padding, unsigned int lines)
1221{
1222 u32 instructions, fields;
1223 __le32 *rp;
1224 int rc;
1225
1226 fields = 0;
1227 if (UNSET != top_offset)
1228 fields++;
1229 if (UNSET != bottom_offset)
1230 fields++;
1231
1232 /* estimate risc mem: worst case is one write per page border +
1233 one write per scan line + syncs + jump (all 2 dwords). Padding
1234 can cause next bpl to start close to a page border. First DMA
1235 region may be smaller than PAGE_SIZE */
1236 /* write and jump need and extra dword */
1237 instructions = fields * (1 + ((bpl + padding) * lines)
1238 / PAGE_SIZE + lines);
1239 instructions += 2;
1240 rc = btcx_riscmem_alloc(pci, risc, instructions*12);
1241 if (rc < 0)
1242 return rc;
1243 /* write risc instructions */
1244 rp = risc->cpu;
1245
1246 /* Sync to line 6, so US CC line 21 will appear in line '12'
1247 * in the userland vbi payload */
1248 if (UNSET != top_offset)
1249 rp = cx23885_risc_field(rp, sglist, top_offset, 6,
1250 bpl, padding, lines, 0);
1251
1252 if (UNSET != bottom_offset)
1253 rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x207,
1254 bpl, padding, lines, 0);
1255
1256
1257
1258 /* save pointer to jmp instruction address */
1259 risc->jmp = rp;
1260 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
1261 return 0;
1262}
1263
1264
1217int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 1265int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
1218 u32 reg, u32 mask, u32 value) 1266 u32 reg, u32 mask, u32 value)
1219{ 1267{
diff --git a/drivers/media/video/cx23885/cx23885-vbi.c b/drivers/media/video/cx23885/cx23885-vbi.c
index 1b3a01c8d1fa..10d8af877f12 100644
--- a/drivers/media/video/cx23885/cx23885-vbi.c
+++ b/drivers/media/video/cx23885/cx23885-vbi.c
@@ -56,12 +56,13 @@ int cx23885_vbi_fmt(struct file *file, void *priv,
56 if (dev->tvnorm & V4L2_STD_525_60) { 56 if (dev->tvnorm & V4L2_STD_525_60) {
57 /* ntsc */ 57 /* ntsc */
58 f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH; 58 f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
59 f->fmt.vbi.sampling_rate = 28636363; 59 f->fmt.vbi.sampling_rate = 27000000;
60 f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; 60 f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
61 f->fmt.vbi.offset = 64 * 4; 61 f->fmt.vbi.offset = 0;
62 f->fmt.vbi.flags = 0;
62 f->fmt.vbi.start[0] = 10; 63 f->fmt.vbi.start[0] = 10;
63 f->fmt.vbi.count[0] = 17; 64 f->fmt.vbi.count[0] = 17;
64 f->fmt.vbi.start[1] = 272; 65 f->fmt.vbi.start[1] = 263 + 10 + 1;
65 f->fmt.vbi.count[1] = 17; 66 f->fmt.vbi.count[1] = 17;
66 } else if (dev->tvnorm & V4L2_STD_625_50) { 67 } else if (dev->tvnorm & V4L2_STD_625_50) {
67 /* pal */ 68 /* pal */
@@ -222,7 +223,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
222 rc = videobuf_iolock(q, &buf->vb, NULL); 223 rc = videobuf_iolock(q, &buf->vb, NULL);
223 if (0 != rc) 224 if (0 != rc)
224 goto fail; 225 goto fail;
225 cx23885_risc_buffer(dev->pci, &buf->risc, 226 cx23885_risc_vbibuffer(dev->pci, &buf->risc,
226 dma->sglist, 227 dma->sglist,
227 0, buf->vb.width * buf->vb.height, 228 0, buf->vb.width * buf->vb.height,
228 buf->vb.width, 0, 229 buf->vb.width, 0,
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 53d9f9dd927d..cb9e05f92feb 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1070,7 +1070,8 @@ static int vidioc_streamon(struct file *file, void *priv,
1070 struct cx23885_dev *dev = fh->dev; 1070 struct cx23885_dev *dev = fh->dev;
1071 dprintk(1, "%s()\n", __func__); 1071 dprintk(1, "%s()\n", __func__);
1072 1072
1073 if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) 1073 if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
1074 (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
1074 return -EINVAL; 1075 return -EINVAL;
1075 if (unlikely(i != fh->type)) 1076 if (unlikely(i != fh->type))
1076 return -EINVAL; 1077 return -EINVAL;
@@ -1087,7 +1088,8 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
1087 int err, res; 1088 int err, res;
1088 dprintk(1, "%s()\n", __func__); 1089 dprintk(1, "%s()\n", __func__);
1089 1090
1090 if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1091 if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
1092 (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
1091 return -EINVAL; 1093 return -EINVAL;
1092 if (i != fh->type) 1094 if (i != fh->type)
1093 return -EINVAL; 1095 return -EINVAL;
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 718afd8eafc8..670281af3361 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -509,6 +509,11 @@ extern int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
509 unsigned int top_offset, unsigned int bottom_offset, 509 unsigned int top_offset, unsigned int bottom_offset,
510 unsigned int bpl, unsigned int padding, unsigned int lines); 510 unsigned int bpl, unsigned int padding, unsigned int lines);
511 511
512extern int cx23885_risc_vbibuffer(struct pci_dev *pci,
513 struct btcx_riscmem *risc, struct scatterlist *sglist,
514 unsigned int top_offset, unsigned int bottom_offset,
515 unsigned int bpl, unsigned int padding, unsigned int lines);
516
512void cx23885_cancel_buffers(struct cx23885_tsport *port); 517void cx23885_cancel_buffers(struct cx23885_tsport *port);
513 518
514extern int cx23885_restart_queue(struct cx23885_tsport *port, 519extern int cx23885_restart_queue(struct cx23885_tsport *port,