diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-03-14 14:10:14 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 17:58:46 +0200 |
commit | 63d8adccecd404badcdbbf892765995fd028b3d0 (patch) | |
tree | c0570fc2dc43e9a186b1c8c7fe69c6998f6729b5 /drivers/media/video/saa7115.c | |
parent | V4L/DVB: v4l: add new subdev vbi ops to handle raw and sliced vbi (diff) | |
download | linux-63d8adccecd404badcdbbf892765995fd028b3d0.tar.xz linux-63d8adccecd404badcdbbf892765995fd028b3d0.zip |
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 saa7115_cfg_vbi_off); } -static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) +static int saa711x_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *sliced) { static u16 lcr2vbi[] = { 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ @@ -1100,11 +1100,8 @@ static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) V4L2_SLICED_VPS, 0, 0, 0, 0, /* 7 */ 0, 0, 0, 0 }; - struct v4l2_sliced_vbi_format *sliced = &fmt->fmt.sliced; int i; - if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) - return -EINVAL; memset(sliced, 0, sizeof(*sliced)); /* done if using raw VBI */ 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) return 0; } +static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) +{ + if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) + return -EINVAL; + return saa711x_g_sliced_fmt(sd, &fmt->fmt.sliced); +} + +static int saa711x_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) +{ + saa711x_set_lcr(sd, NULL); + return 0; +} + +static int saa711x_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt) +{ + saa711x_set_lcr(sd, fmt); + return 0; +} + static int saa711x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) { - if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { - saa711x_set_lcr(sd, &fmt->fmt.sliced); - return 0; - } - if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { - saa711x_set_lcr(sd, NULL); - return 0; - } + if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) + return saa711x_s_sliced_fmt(sd, &fmt->fmt.sliced); + if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) + return saa711x_s_raw_fmt(sd, &fmt->fmt.vbi); if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -1558,6 +1570,9 @@ static const struct v4l2_subdev_video_ops saa711x_video_ops = { static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = { .g_vbi_data = saa711x_g_vbi_data, .decode_vbi_line = saa711x_decode_vbi_line, + .g_sliced_fmt = saa711x_g_sliced_fmt, + .s_sliced_fmt = saa711x_s_sliced_fmt, + .s_raw_fmt = saa711x_s_raw_fmt, }; static const struct v4l2_subdev_ops saa711x_ops = { |