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

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

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

parent 1dbf8539
Loading
Loading
Loading
Loading
+41 −25
Original line number Original line Diff line number Diff line
@@ -891,29 +891,26 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd,
	return 0;
	return 0;
}
}


static int tvp5150_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
{
{
	struct v4l2_sliced_vbi_format *svbi;
	int i;

	/* raw vbi */
	if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
	/* this is for capturing 36 raw vbi lines
	/* this is for capturing 36 raw vbi lines
	   if there's a way to cut off the beginning 2 vbi lines
	   if there's a way to cut off the beginning 2 vbi lines
	   with the tvp5150 then the vbi line count could be lowered
	   with the tvp5150 then the vbi line count could be lowered
	   to 17 lines/field again, although I couldn't find a register
	   to 17 lines/field again, although I couldn't find a register
	   which could do that cropping */
	   which could do that cropping */
		if (fmt->fmt.vbi.sample_format == V4L2_PIX_FMT_GREY)
	if (fmt->sample_format == V4L2_PIX_FMT_GREY)
		tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
		tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
		if (fmt->fmt.vbi.count[0] == 18 && fmt->fmt.vbi.count[1] == 18) {
	if (fmt->count[0] == 18 && fmt->count[1] == 18) {
		tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00);
		tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00);
		tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01);
		tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01);
	}
	}
	return 0;
	return 0;
}
}
	if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)

		return -EINVAL;
static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
	svbi = &fmt->fmt.sliced;
{
	int i;

	if (svbi->service_set != 0) {
	if (svbi->service_set != 0) {
		for (i = 0; i <= 23; i++) {
		for (i = 0; i <= 23; i++) {
			svbi->service_lines[1][i] = 0;
			svbi->service_lines[1][i] = 0;
@@ -937,14 +934,24 @@ static int tvp5150_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
	return 0;
	return 0;
}
}


static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
static int tvp5150_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
{
{
	struct v4l2_sliced_vbi_format *svbi;
	switch (fmt->type) {
	int i, mask = 0;
	case V4L2_BUF_TYPE_VBI_CAPTURE:
		return tvp5150_s_raw_fmt(sd, &fmt->fmt.vbi);


	if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
		return tvp5150_s_sliced_fmt(sd, &fmt->fmt.sliced);

	default:
		return -EINVAL;
		return -EINVAL;
	svbi = &fmt->fmt.sliced;
	}
}

static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{
	int i, mask = 0;

	memset(svbi, 0, sizeof(*svbi));
	memset(svbi, 0, sizeof(*svbi));


	for (i = 0; i <= 23; i++) {
	for (i = 0; i <= 23; i++) {
@@ -956,6 +963,12 @@ static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
	return 0;
	return 0;
}
}


static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
{
	if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
		return -EINVAL;
	return tvp5150_g_sliced_fmt(sd, &fmt->fmt.sliced);
}


static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
				struct v4l2_dbg_chip_ident *chip)
				struct v4l2_dbg_chip_ident *chip)
@@ -1050,6 +1063,9 @@ static const struct v4l2_subdev_video_ops tvp5150_video_ops = {


static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
	.g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
	.g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
	.g_sliced_fmt = tvp5150_g_sliced_fmt,
	.s_sliced_fmt = tvp5150_s_sliced_fmt,
	.s_raw_fmt = tvp5150_s_raw_fmt,
};
};


static const struct v4l2_subdev_ops tvp5150_ops = {
static const struct v4l2_subdev_ops tvp5150_ops = {