X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fbt8xx%2Fbttv-vbi.c;fp=drivers%2Fmedia%2Fvideo%2Fbttv-vbi.c;h=63676e7bd635f6b403a69be86e0e24d602c56337;hb=a2f44b27303a5353859d77a3e96a1d3f33f56ab7;hp=72afdd64b8821f217d0f713ea6c9e07028053dae;hpb=134734d875a0a48d994ef20b9905209b4b8b6f75;p=linux-2.6.git diff --git a/drivers/media/video/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c similarity index 88% rename from drivers/media/video/bttv-vbi.c rename to drivers/media/video/bt8xx/bttv-vbi.c index 72afdd64b..63676e7bd 100644 --- a/drivers/media/video/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c @@ -31,11 +31,16 @@ #include #include "bttvp.h" -/* Offset from line sync pulse leading edge (0H) in 1 / sampling_rate: - bt8x8 /HRESET pulse starts at 0H and has length 64 / fCLKx1 (E|O_VTC - HSFMT = 0). VBI_HDELAY (always 0) is an offset from the trailing edge - of /HRESET in 1 / fCLKx1, and the sampling_rate tvnorm->Fsc is fCLKx2. */ -#define VBI_OFFSET ((64 + 0) * 2) +/* Offset from line sync pulse leading edge (0H) to start of VBI capture, + in fCLKx2 pixels. According to the datasheet, VBI capture starts + VBI_HDELAY fCLKx1 pixels from the tailing edgeof /HRESET, and /HRESET + is 64 fCLKx1 pixels wide. VBI_HDELAY is set to 0, so this should be + (64 + 0) * 2 = 128 fCLKx2 pixels. But it's not! The datasheet is + Just Plain Wrong. The real value appears to be different for + different revisions of the bt8x8 chips, and to be affected by the + horizontal scaling factor. Experimentally, the value is measured + to be about 244. */ +#define VBI_OFFSET 244 #define VBI_DEFLINES 16 #define VBI_MAXLINES 32 @@ -96,7 +101,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, return -EINVAL; if (STATE_NEEDS_INIT == buf->vb.state) { - if (0 != (rc = videobuf_iolock(btv->c.pci, &buf->vb, NULL))) + if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) goto fail; if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) goto fail; @@ -109,7 +114,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, return 0; fail: - bttv_dma_free(btv,buf); + bttv_dma_free(q,btv,buf); return rc; } @@ -136,7 +141,7 @@ static void vbi_buffer_release(struct videobuf_queue *q, struct videobuf_buffer struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); dprintk("free %p\n",vb); - bttv_dma_free(fh->btv,buf); + bttv_dma_free(&fh->cap,fh->btv,buf); } struct videobuf_queue_ops bttv_vbi_qops = { @@ -184,7 +189,7 @@ void bttv_vbi_try_fmt(struct bttv_fh *fh, struct v4l2_format *f) - tvnorm->vbistart[0]; count1 = (s64) f->fmt.vbi.start[1] + f->fmt.vbi.count[1] - tvnorm->vbistart[1]; - count = clamp (max (count0, count1), 1LL, (s64) VBI_MAXLINES); + count = clamp (max (count0, count1), (s64) 1, (s64) VBI_MAXLINES); f->fmt.vbi.start[0] = tvnorm->vbistart[0]; f->fmt.vbi.start[1] = tvnorm->vbistart[1];