summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx88/cx88-vbi.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-09-20 09:24:58 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-03 08:36:40 -0200
commitc0d5b5fbbe1b13c5d474b58bf89dd7ff2e6eb6e1 (patch)
treebd8367b2b88c773239ade3a6f94f11c9757c66f9 /drivers/media/pci/cx88/cx88-vbi.c
parent98822de9ae22083658104e43d52f2cb0f3df1138 (diff)
downloadlinux-c0d5b5fbbe1b13c5d474b58bf89dd7ff2e6eb6e1.tar.gz
linux-c0d5b5fbbe1b13c5d474b58bf89dd7ff2e6eb6e1.tar.bz2
linux-c0d5b5fbbe1b13c5d474b58bf89dd7ff2e6eb6e1.zip
[media] cx88: fix VBI support
Now works with both NTSC and PAL. Tested with CC/XDS for NTSC and teletext/WSS for PAL. The start lines were wrong, the WSS signal wasn't captured and there was no difference between NTSC and PAL w.r.t. the count[] values so NTSC returned way too many lines. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/cx88/cx88-vbi.c')
-rw-r--r--drivers/media/pci/cx88/cx88-vbi.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c
index 042f54597a9b..6ab6e27648f6 100644
--- a/drivers/media/pci/cx88/cx88-vbi.c
+++ b/drivers/media/pci/cx88/cx88-vbi.c
@@ -23,20 +23,22 @@ int cx8800_vbi_fmt (struct file *file, void *priv,
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
f->fmt.vbi.offset = 244;
- f->fmt.vbi.count[0] = VBI_LINE_COUNT;
- f->fmt.vbi.count[1] = VBI_LINE_COUNT;
if (dev->core->tvnorm & V4L2_STD_525_60) {
/* ntsc */
f->fmt.vbi.sampling_rate = 28636363;
f->fmt.vbi.start[0] = 10;
f->fmt.vbi.start[1] = 273;
+ f->fmt.vbi.count[0] = VBI_LINE_NTSC_COUNT;
+ f->fmt.vbi.count[1] = VBI_LINE_NTSC_COUNT;
} else if (dev->core->tvnorm & V4L2_STD_625_50) {
/* pal */
f->fmt.vbi.sampling_rate = 35468950;
- f->fmt.vbi.start[0] = 7 -1;
- f->fmt.vbi.start[1] = 319 -1;
+ f->fmt.vbi.start[0] = V4L2_VBI_ITU_625_F1_START + 5;
+ f->fmt.vbi.start[1] = V4L2_VBI_ITU_625_F2_START + 5;
+ f->fmt.vbi.count[0] = VBI_LINE_PAL_COUNT;
+ f->fmt.vbi.count[1] = VBI_LINE_PAL_COUNT;
}
return 0;
}
@@ -111,8 +113,13 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], void *alloc_ctxs[])
{
+ struct cx8800_dev *dev = q->drv_priv;
+
*num_planes = 1;
- sizes[0] = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
+ if (dev->core->tvnorm & V4L2_STD_525_60)
+ sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2;
+ else
+ sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2;
return 0;
}
@@ -122,10 +129,15 @@ static int buffer_prepare(struct vb2_buffer *vb)
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
+ unsigned int lines;
unsigned int size;
int rc;
- size = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
+ if (dev->core->tvnorm & V4L2_STD_525_60)
+ lines = VBI_LINE_NTSC_COUNT;
+ else
+ lines = VBI_LINE_PAL_COUNT;
+ size = lines * VBI_LINE_LENGTH * 2;
if (vb2_plane_size(vb, 0) < size)
return -EINVAL;
vb2_set_plane_payload(vb, 0, size);
@@ -135,9 +147,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
return -EIO;
cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl,
- 0, VBI_LINE_LENGTH * VBI_LINE_COUNT,
+ 0, VBI_LINE_LENGTH * lines,
VBI_LINE_LENGTH, 0,
- VBI_LINE_COUNT);
+ lines);
return 0;
}