diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-03-14 09:10:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:46 -0400 |
commit | 63d8adccecd404badcdbbf892765995fd028b3d0 (patch) | |
tree | c0570fc2dc43e9a186b1c8c7fe69c6998f6729b5 /drivers/media/video/saa7115.c | |
parent | 54aefafbf312ee54a2d70fe3ef0ca89c079ead6e (diff) |
V4L/DVB: saa7115: support new vbi ops to set/get VBI format
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r-- | drivers/media/video/saa7115.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index cfee323d9c2c..cf77318ede43 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1091,7 +1091,7 @@ static void saa711x_set_lcr(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_forma | |||
1091 | saa7115_cfg_vbi_off); | 1091 | saa7115_cfg_vbi_off); |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 1094 | static int saa711x_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *sliced) |
1095 | { | 1095 | { |
1096 | static u16 lcr2vbi[] = { | 1096 | static u16 lcr2vbi[] = { |
1097 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ | 1097 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ |
@@ -1100,11 +1100,8 @@ static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
1100 | V4L2_SLICED_VPS, 0, 0, 0, 0, /* 7 */ | 1100 | V4L2_SLICED_VPS, 0, 0, 0, 0, /* 7 */ |
1101 | 0, 0, 0, 0 | 1101 | 0, 0, 0, 0 |
1102 | }; | 1102 | }; |
1103 | struct v4l2_sliced_vbi_format *sliced = &fmt->fmt.sliced; | ||
1104 | int i; | 1103 | int i; |
1105 | 1104 | ||
1106 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
1107 | return -EINVAL; | ||
1108 | memset(sliced, 0, sizeof(*sliced)); | 1105 | memset(sliced, 0, sizeof(*sliced)); |
1109 | /* done if using raw VBI */ | 1106 | /* done if using raw VBI */ |
1110 | if (saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10) | 1107 | if (saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10) |
@@ -1120,16 +1117,31 @@ static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
1120 | return 0; | 1117 | return 0; |
1121 | } | 1118 | } |
1122 | 1119 | ||
1120 | static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | ||
1121 | { | ||
1122 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
1123 | return -EINVAL; | ||
1124 | return saa711x_g_sliced_fmt(sd, &fmt->fmt.sliced); | ||
1125 | } | ||
1126 | |||
1127 | static int saa711x_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) | ||
1128 | { | ||
1129 | saa711x_set_lcr(sd, NULL); | ||
1130 | return 0; | ||
1131 | } | ||
1132 | |||
1133 | static int saa711x_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt) | ||
1134 | { | ||
1135 | saa711x_set_lcr(sd, fmt); | ||
1136 | return 0; | ||
1137 | } | ||
1138 | |||
1123 | static int saa711x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 1139 | static int saa711x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) |
1124 | { | 1140 | { |
1125 | if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { | 1141 | if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) |
1126 | saa711x_set_lcr(sd, &fmt->fmt.sliced); | 1142 | return saa711x_s_sliced_fmt(sd, &fmt->fmt.sliced); |
1127 | return 0; | 1143 | if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) |
1128 | } | 1144 | return saa711x_s_raw_fmt(sd, &fmt->fmt.vbi); |
1129 | if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | ||
1130 | saa711x_set_lcr(sd, NULL); | ||
1131 | return 0; | ||
1132 | } | ||
1133 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1145 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1134 | return -EINVAL; | 1146 | return -EINVAL; |
1135 | 1147 | ||
@@ -1558,6 +1570,9 @@ static const struct v4l2_subdev_video_ops saa711x_video_ops = { | |||
1558 | static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = { | 1570 | static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = { |
1559 | .g_vbi_data = saa711x_g_vbi_data, | 1571 | .g_vbi_data = saa711x_g_vbi_data, |
1560 | .decode_vbi_line = saa711x_decode_vbi_line, | 1572 | .decode_vbi_line = saa711x_decode_vbi_line, |
1573 | .g_sliced_fmt = saa711x_g_sliced_fmt, | ||
1574 | .s_sliced_fmt = saa711x_s_sliced_fmt, | ||
1575 | .s_raw_fmt = saa711x_s_raw_fmt, | ||
1561 | }; | 1576 | }; |
1562 | 1577 | ||
1563 | static const struct v4l2_subdev_ops saa711x_ops = { | 1578 | static const struct v4l2_subdev_ops saa711x_ops = { |