Commit faeb4ab3 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (5183): Fix CC handling in VIDIOC_INT_G_VBI_DATA

When capturing a 60 Hz input the internal field ID is inverted. The
VIDIOC_INT_G_VBI_DATA didn't take that into account and so returned
XDS instead of CC and vice versa.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 2675f7a8
...@@ -1388,6 +1388,9 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar ...@@ -1388,6 +1388,9 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar
{ {
struct v4l2_sliced_vbi_data *data = arg; struct v4l2_sliced_vbi_data *data = arg;
/* Note: the internal field ID is inverted for NTSC,
so data->field 0 maps to the saa7115 even field,
whereas for PAL it maps to the saa7115 odd field. */
switch (data->id) { switch (data->id) {
case V4L2_SLICED_WSS_625: case V4L2_SLICED_WSS_625:
if (saa711x_read(client, 0x6b) & 0xc0) if (saa711x_read(client, 0x6b) & 0xc0)
...@@ -1398,17 +1401,17 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar ...@@ -1398,17 +1401,17 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar
case V4L2_SLICED_CAPTION_525: case V4L2_SLICED_CAPTION_525:
if (data->field == 0) { if (data->field == 0) {
/* CC */ /* CC */
if (saa711x_read(client, 0x66) & 0xc0) if (saa711x_read(client, 0x66) & 0x30)
return -EIO; return -EIO;
data->data[0] = saa711x_read(client, 0x67); data->data[0] = saa711x_read(client, 0x69);
data->data[1] = saa711x_read(client, 0x68); data->data[1] = saa711x_read(client, 0x6a);
return 0; return 0;
} }
/* XDS */ /* XDS */
if (saa711x_read(client, 0x66) & 0x30) if (saa711x_read(client, 0x66) & 0xc0)
return -EIO; return -EIO;
data->data[0] = saa711x_read(client, 0x69); data->data[0] = saa711x_read(client, 0x67);
data->data[1] = saa711x_read(client, 0x6a); data->data[1] = saa711x_read(client, 0x68);
return 0; return 0;
default: default:
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment