]> err.no Git - linux-2.6/commitdiff
[PATCH] v4l: saa7134 ntsc vbi fix
authorMichael Schimek <mschimek@nusurf.at>
Fri, 24 Jun 2005 05:04:47 +0000 (22:04 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 24 Jun 2005 07:06:37 +0000 (00:06 -0700)
This patch fixes NTSC VBI capturing in the saa7134 driver.

Signed-off-by: Michael H. Schimek <mschimek@gmx.at>
Cc: <video4linux-list@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/media/video/saa7134/saa7134-vbi.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h

index 86954cc7c3776d2e6a69bf2ace01ead6f76243e7..03c350ffb2d8654d8c147bafa502aa2770cdb840 100644 (file)
@@ -60,10 +60,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf,
        saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start     >> 8);
        saa_writeb(SAA7134_VBI_H_STOP1(task),  norm->h_stop      &  0xff);
        saa_writeb(SAA7134_VBI_H_STOP2(task),  norm->h_stop      >> 8);
-       saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start &  0xff);
-       saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start >> 8);
-       saa_writeb(SAA7134_VBI_V_STOP1(task),  norm->vbi_v_stop  &  0xff);
-       saa_writeb(SAA7134_VBI_V_STOP2(task),  norm->vbi_v_stop  >> 8);
+       saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start_0 &  0xff);
+       saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start_0 >> 8);
+       saa_writeb(SAA7134_VBI_V_STOP1(task),  norm->vbi_v_stop_0  &  0xff);
+       saa_writeb(SAA7134_VBI_V_STOP2(task),  norm->vbi_v_stop_0  >> 8);
 
        saa_writeb(SAA7134_VBI_H_SCALE_INC1(task),        VBI_SCALE & 0xff);
        saa_writeb(SAA7134_VBI_H_SCALE_INC2(task),        VBI_SCALE >> 8);
@@ -127,7 +127,7 @@ static int buffer_prepare(struct videobuf_queue *q,
        unsigned int lines, llength, size;
        int err;
 
-       lines   = norm->vbi_v_stop - norm->vbi_v_start +1;
+       lines   = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
        if (lines > VBI_LINE_COUNT)
                lines = VBI_LINE_COUNT;
 #if 1
@@ -177,7 +177,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
        struct saa7134_dev *dev = fh->dev;
        int llength,lines;
 
-       lines   = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1;
+       lines   = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1;
 #if 1
        llength = VBI_LINE_LENGTH;
 #else
index 5d66060026ff5b460b57ae2d45ac43b54abb3456..72f86736a79539311e3a413306979dfe317f4d33 100644 (file)
@@ -158,18 +158,20 @@ static struct saa7134_format formats[] = {
                .h_stop        = 719,   \
                .video_v_start = 24,    \
                .video_v_stop  = 311,   \
-               .vbi_v_start   = 7,     \
-               .vbi_v_stop    = 22,    \
+               .vbi_v_start_0 = 7,     \
+               .vbi_v_stop_0  = 22,    \
+               .vbi_v_start_1 = 319,   \
                .src_timing    = 4
 
 #define NORM_525_60                    \
                .h_start       = 0,     \
                .h_stop        = 703,   \
-               .video_v_start = 22,    \
-               .video_v_stop  = 22+239, \
-               .vbi_v_start   = 10, /* FIXME */ \
-               .vbi_v_stop    = 21, /* FIXME */ \
-               .src_timing    = 1
+               .video_v_start = 23,    \
+               .video_v_stop  = 262,   \
+               .vbi_v_start_0 = 10,    \
+               .vbi_v_stop_0  = 21,    \
+               .vbi_v_start_1 = 273,   \
+               .src_timing    = 7
 
 static struct saa7134_tvnorm tvnorms[] = {
        {
@@ -274,11 +276,12 @@ static struct saa7134_tvnorm tvnorms[] = {
 
                .h_start       = 0,
                .h_stop        = 719,
-               .video_v_start = 22,
-               .video_v_stop  = 22+239,
-               .vbi_v_start   = 10, /* FIXME */
-               .vbi_v_stop    = 21, /* FIXME */
-               .src_timing    = 1,
+               .video_v_start = 23,
+               .video_v_stop  = 262,
+               .vbi_v_start_0 = 10,
+               .vbi_v_stop_0  = 21,
+               .vbi_v_start_1 = 273,
+               .src_timing    = 7,
 
                .sync_control  = 0x18,
                .luma_control  = 0x40,
@@ -335,8 +338,8 @@ static const struct v4l2_queryctrl video_ctrls[] = {
                .default_value = 0,
                .type          = V4L2_CTRL_TYPE_INTEGER,
        },{
-               .id            = V4L2_CID_VFLIP,
-               .name          = "vertical flip",
+               .id            = V4L2_CID_HFLIP,
+               .name          = "Mirror",
                .minimum       = 0,
                .maximum       = 1,
                .type          = V4L2_CTRL_TYPE_BOOLEAN,
@@ -482,7 +485,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm)
        dev->crop_bounds.width   = norm->h_stop - norm->h_start +1;
        dev->crop_defrect.width  = norm->h_stop - norm->h_start +1;
 
-       dev->crop_bounds.top     = (norm->vbi_v_stop+1)*2;
+       dev->crop_bounds.top     = (norm->vbi_v_stop_0+1)*2;
        dev->crop_defrect.top    = norm->video_v_start*2;
        dev->crop_bounds.height  = ((norm->id & V4L2_STD_525_60) ? 524 : 624)
                - dev->crop_bounds.top;
@@ -1064,7 +1067,7 @@ static int get_control(struct saa7134_dev *dev, struct v4l2_control *c)
        case V4L2_CID_PRIVATE_INVERT:
                c->value = dev->ctl_invert;
                break;
-       case V4L2_CID_VFLIP:
+       case V4L2_CID_HFLIP:
                c->value = dev->ctl_mirror;
                break;
        case V4L2_CID_PRIVATE_Y_EVEN:
@@ -1139,7 +1142,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh,
                saa_writeb(SAA7134_DEC_CHROMA_SATURATION,
                           dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation);
                break;
-       case V4L2_CID_VFLIP:
+       case V4L2_CID_HFLIP:
                dev->ctl_mirror = c->value;
                restart_overlay = 1;
                break;
@@ -1407,9 +1410,9 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
        f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */;
        f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
        f->fmt.vbi.offset = 64 * 4;
-       f->fmt.vbi.start[0] = norm->vbi_v_start;
-       f->fmt.vbi.count[0] = norm->vbi_v_stop - norm->vbi_v_start +1;
-       f->fmt.vbi.start[1] = norm->video_v_stop + norm->vbi_v_start +1;
+       f->fmt.vbi.start[0] = norm->vbi_v_start_0;
+       f->fmt.vbi.count[0] = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
+       f->fmt.vbi.start[1] = norm->vbi_v_start_1;
        f->fmt.vbi.count[1] = f->fmt.vbi.count[0];
        f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */
 
index 1363c3e3f8d3e3dc46d984f78e6e029185898158..b808f18890b3958dbcfad1272940af88faea5ec3 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include <linux/version.h>
-#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,12)
+#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13)
 
 #include <linux/pci.h>
 #include <linux/i2c.h>
@@ -91,9 +91,10 @@ struct saa7134_tvnorm {
        unsigned int  h_stop;
        unsigned int  video_v_start;
        unsigned int  video_v_stop;
-       unsigned int  vbi_v_start;
-       unsigned int  vbi_v_stop;
+       unsigned int  vbi_v_start_0;
+       unsigned int  vbi_v_stop_0;
        unsigned int  src_timing;
+       unsigned int  vbi_v_start_1;
 };
 
 struct saa7134_tvaudio {