diff options
author | Michael Schimek <mschimek@nusurf.at> | 2005-06-24 01:04:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:37 -0400 |
commit | f246a8172a9e403b78c34568f766990f1506a0ab (patch) | |
tree | 30f25ba91d7c8d7dbe293f5283e0a10de349104b /drivers/media/video/saa7134 | |
parent | 93b43f13b5bfeac09ef5743edf39eeeee3f4eeae (diff) |
[PATCH] v4l: saa7134 ntsc vbi fix
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>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-vbi.c | 12 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 43 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 7 |
3 files changed, 33 insertions, 29 deletions
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 86954cc7c377..03c350ffb2d8 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -60,10 +60,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, | |||
60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); | 60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); |
61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); | 61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); |
62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); | 62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); |
63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start & 0xff); | 63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start_0 & 0xff); |
64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start >> 8); | 64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start_0 >> 8); |
65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop & 0xff); | 65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop_0 & 0xff); |
66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop >> 8); | 66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop_0 >> 8); |
67 | 67 | ||
68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); | 68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); |
69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); | 69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); |
@@ -127,7 +127,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
127 | unsigned int lines, llength, size; | 127 | unsigned int lines, llength, size; |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | lines = norm->vbi_v_stop - norm->vbi_v_start +1; | 130 | lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
131 | if (lines > VBI_LINE_COUNT) | 131 | if (lines > VBI_LINE_COUNT) |
132 | lines = VBI_LINE_COUNT; | 132 | lines = VBI_LINE_COUNT; |
133 | #if 1 | 133 | #if 1 |
@@ -177,7 +177,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) | |||
177 | struct saa7134_dev *dev = fh->dev; | 177 | struct saa7134_dev *dev = fh->dev; |
178 | int llength,lines; | 178 | int llength,lines; |
179 | 179 | ||
180 | lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1; | 180 | lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; |
181 | #if 1 | 181 | #if 1 |
182 | llength = VBI_LINE_LENGTH; | 182 | llength = VBI_LINE_LENGTH; |
183 | #else | 183 | #else |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5d66060026ff..72f86736a795 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -158,18 +158,20 @@ static struct saa7134_format formats[] = { | |||
158 | .h_stop = 719, \ | 158 | .h_stop = 719, \ |
159 | .video_v_start = 24, \ | 159 | .video_v_start = 24, \ |
160 | .video_v_stop = 311, \ | 160 | .video_v_stop = 311, \ |
161 | .vbi_v_start = 7, \ | 161 | .vbi_v_start_0 = 7, \ |
162 | .vbi_v_stop = 22, \ | 162 | .vbi_v_stop_0 = 22, \ |
163 | .vbi_v_start_1 = 319, \ | ||
163 | .src_timing = 4 | 164 | .src_timing = 4 |
164 | 165 | ||
165 | #define NORM_525_60 \ | 166 | #define NORM_525_60 \ |
166 | .h_start = 0, \ | 167 | .h_start = 0, \ |
167 | .h_stop = 703, \ | 168 | .h_stop = 703, \ |
168 | .video_v_start = 22, \ | 169 | .video_v_start = 23, \ |
169 | .video_v_stop = 22+239, \ | 170 | .video_v_stop = 262, \ |
170 | .vbi_v_start = 10, /* FIXME */ \ | 171 | .vbi_v_start_0 = 10, \ |
171 | .vbi_v_stop = 21, /* FIXME */ \ | 172 | .vbi_v_stop_0 = 21, \ |
172 | .src_timing = 1 | 173 | .vbi_v_start_1 = 273, \ |
174 | .src_timing = 7 | ||
173 | 175 | ||
174 | static struct saa7134_tvnorm tvnorms[] = { | 176 | static struct saa7134_tvnorm tvnorms[] = { |
175 | { | 177 | { |
@@ -274,11 +276,12 @@ static struct saa7134_tvnorm tvnorms[] = { | |||
274 | 276 | ||
275 | .h_start = 0, | 277 | .h_start = 0, |
276 | .h_stop = 719, | 278 | .h_stop = 719, |
277 | .video_v_start = 22, | 279 | .video_v_start = 23, |
278 | .video_v_stop = 22+239, | 280 | .video_v_stop = 262, |
279 | .vbi_v_start = 10, /* FIXME */ | 281 | .vbi_v_start_0 = 10, |
280 | .vbi_v_stop = 21, /* FIXME */ | 282 | .vbi_v_stop_0 = 21, |
281 | .src_timing = 1, | 283 | .vbi_v_start_1 = 273, |
284 | .src_timing = 7, | ||
282 | 285 | ||
283 | .sync_control = 0x18, | 286 | .sync_control = 0x18, |
284 | .luma_control = 0x40, | 287 | .luma_control = 0x40, |
@@ -335,8 +338,8 @@ static const struct v4l2_queryctrl video_ctrls[] = { | |||
335 | .default_value = 0, | 338 | .default_value = 0, |
336 | .type = V4L2_CTRL_TYPE_INTEGER, | 339 | .type = V4L2_CTRL_TYPE_INTEGER, |
337 | },{ | 340 | },{ |
338 | .id = V4L2_CID_VFLIP, | 341 | .id = V4L2_CID_HFLIP, |
339 | .name = "vertical flip", | 342 | .name = "Mirror", |
340 | .minimum = 0, | 343 | .minimum = 0, |
341 | .maximum = 1, | 344 | .maximum = 1, |
342 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 345 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -482,7 +485,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
482 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; | 485 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; |
483 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; | 486 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; |
484 | 487 | ||
485 | dev->crop_bounds.top = (norm->vbi_v_stop+1)*2; | 488 | dev->crop_bounds.top = (norm->vbi_v_stop_0+1)*2; |
486 | dev->crop_defrect.top = norm->video_v_start*2; | 489 | dev->crop_defrect.top = norm->video_v_start*2; |
487 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) | 490 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) |
488 | - dev->crop_bounds.top; | 491 | - dev->crop_bounds.top; |
@@ -1064,7 +1067,7 @@ static int get_control(struct saa7134_dev *dev, struct v4l2_control *c) | |||
1064 | case V4L2_CID_PRIVATE_INVERT: | 1067 | case V4L2_CID_PRIVATE_INVERT: |
1065 | c->value = dev->ctl_invert; | 1068 | c->value = dev->ctl_invert; |
1066 | break; | 1069 | break; |
1067 | case V4L2_CID_VFLIP: | 1070 | case V4L2_CID_HFLIP: |
1068 | c->value = dev->ctl_mirror; | 1071 | c->value = dev->ctl_mirror; |
1069 | break; | 1072 | break; |
1070 | case V4L2_CID_PRIVATE_Y_EVEN: | 1073 | case V4L2_CID_PRIVATE_Y_EVEN: |
@@ -1139,7 +1142,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh, | |||
1139 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, | 1142 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, |
1140 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); | 1143 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); |
1141 | break; | 1144 | break; |
1142 | case V4L2_CID_VFLIP: | 1145 | case V4L2_CID_HFLIP: |
1143 | dev->ctl_mirror = c->value; | 1146 | dev->ctl_mirror = c->value; |
1144 | restart_overlay = 1; | 1147 | restart_overlay = 1; |
1145 | break; | 1148 | break; |
@@ -1407,9 +1410,9 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f) | |||
1407 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; | 1410 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; |
1408 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; | 1411 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; |
1409 | f->fmt.vbi.offset = 64 * 4; | 1412 | f->fmt.vbi.offset = 64 * 4; |
1410 | f->fmt.vbi.start[0] = norm->vbi_v_start; | 1413 | f->fmt.vbi.start[0] = norm->vbi_v_start_0; |
1411 | f->fmt.vbi.count[0] = norm->vbi_v_stop - norm->vbi_v_start +1; | 1414 | f->fmt.vbi.count[0] = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
1412 | f->fmt.vbi.start[1] = norm->video_v_stop + norm->vbi_v_start +1; | 1415 | f->fmt.vbi.start[1] = norm->vbi_v_start_1; |
1413 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; | 1416 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; |
1414 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ | 1417 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ |
1415 | 1418 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 1363c3e3f8d3..b808f18890b3 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | 23 | #include <linux/version.h> |
24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,12) | 24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
@@ -91,9 +91,10 @@ struct saa7134_tvnorm { | |||
91 | unsigned int h_stop; | 91 | unsigned int h_stop; |
92 | unsigned int video_v_start; | 92 | unsigned int video_v_start; |
93 | unsigned int video_v_stop; | 93 | unsigned int video_v_stop; |
94 | unsigned int vbi_v_start; | 94 | unsigned int vbi_v_start_0; |
95 | unsigned int vbi_v_stop; | 95 | unsigned int vbi_v_stop_0; |
96 | unsigned int src_timing; | 96 | unsigned int src_timing; |
97 | unsigned int vbi_v_start_1; | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | struct saa7134_tvaudio { | 100 | struct saa7134_tvaudio { |