|
@@ -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 = {
|