Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63d8adcc authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB: saa7115: support new vbi ops to set/get VBI format

parent 54aefafb
Loading
Loading
Loading
Loading
+27 −12
Original line number Original line Diff line number Diff line
@@ -1091,7 +1091,7 @@ static void saa711x_set_lcr(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_forma
				saa7115_cfg_vbi_off);
				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[] = {
	static u16 lcr2vbi[] = {
		0, V4L2_SLICED_TELETEXT_B, 0,	/* 1 */
		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 */
		V4L2_SLICED_VPS, 0, 0, 0, 0,	/* 7 */
		0, 0, 0, 0
		0, 0, 0, 0
	};
	};
	struct v4l2_sliced_vbi_format *sliced = &fmt->fmt.sliced;
	int i;
	int i;


	if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
		return -EINVAL;
	memset(sliced, 0, sizeof(*sliced));
	memset(sliced, 0, sizeof(*sliced));
	/* done if using raw VBI */
	/* done if using raw VBI */
	if (saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10)
	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;
	return 0;
}
}


static int saa711x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
{
{
	if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) {
	if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
		saa711x_set_lcr(sd, &fmt->fmt.sliced);
		return -EINVAL;
		return 0;
	return saa711x_g_sliced_fmt(sd, &fmt->fmt.sliced);
}
}
	if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {

static int saa711x_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
{
	saa711x_set_lcr(sd, NULL);
	saa711x_set_lcr(sd, NULL);
	return 0;
	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)
		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)
	if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
		return -EINVAL;
		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 = {
static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = {
	.g_vbi_data = saa711x_g_vbi_data,
	.g_vbi_data = saa711x_g_vbi_data,
	.decode_vbi_line = saa711x_decode_vbi_line,
	.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 = {
static const struct v4l2_subdev_ops saa711x_ops = {