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

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

V4L/DVB: v4l: move vbi-specific video ops to a new vbi ops struct



Only a relatively small number of video receivers and transmitters actually
support VBI. So start moving the vbi specific ops to an ops struct of their
own.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b26d6e21
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1403,17 +1403,21 @@ static const struct v4l2_subdev_audio_ops cx18_av_audio_ops = {

static const struct v4l2_subdev_video_ops cx18_av_video_ops = {
	.s_routing = cx18_av_s_video_routing,
	.decode_vbi_line = cx18_av_decode_vbi_line,
	.s_stream = cx18_av_s_stream,
	.g_fmt = cx18_av_g_fmt,
	.s_fmt = cx18_av_s_fmt,
};

static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
	.decode_vbi_line = cx18_av_decode_vbi_line,
};

static const struct v4l2_subdev_ops cx18_av_ops = {
	.core = &cx18_av_general_ops,
	.tuner = &cx18_av_tuner_ops,
	.audio = &cx18_av_audio_ops,
	.video = &cx18_av_video_ops,
	.vbi = &cx18_av_vbi_ops,
};

int cx18_av_probe(struct cx18 *cx)
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ static u32 compress_sliced_buf(struct cx18 *cx, u8 *buf, u32 size,
		     p[3] != sliced_vbi_eav_rp[1]))
			continue;
		vbi.p = p + 4;
		v4l2_subdev_call(cx->sd_av, video, decode_vbi_line, &vbi);
		v4l2_subdev_call(cx->sd_av, vbi, decode_vbi_line, &vbi);
		if (vbi.type) {
			cx->vbi.sliced_data[line].id = vbi.type;
			cx->vbi.sliced_data[line].field = vbi.is_second_field;
+5 −1
Original line number Diff line number Diff line
@@ -1635,15 +1635,19 @@ static const struct v4l2_subdev_video_ops cx25840_video_ops = {
	.s_routing = cx25840_s_video_routing,
	.g_fmt = cx25840_g_fmt,
	.s_fmt = cx25840_s_fmt,
	.decode_vbi_line = cx25840_decode_vbi_line,
	.s_stream = cx25840_s_stream,
};

static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = {
	.decode_vbi_line = cx25840_decode_vbi_line,
};

static const struct v4l2_subdev_ops cx25840_ops = {
	.core = &cx25840_core_ops,
	.tuner = &cx25840_tuner_ops,
	.audio = &cx25840_audio_ops,
	.video = &cx25840_video_ops,
	.vbi = &cx25840_vbi_ops,
};

/* ----------------------------------------------------------------------- */
+8 −8
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static void ivtv_set_vps(struct ivtv *itv, int enabled)
	data.data[9] = itv->vbi.vps_payload.data[2];
	data.data[10] = itv->vbi.vps_payload.data[3];
	data.data[11] = itv->vbi.vps_payload.data[4];
	ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data);
	ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
}

static void ivtv_set_cc(struct ivtv *itv, int mode, const struct vbi_cc *cc)
@@ -52,12 +52,12 @@ static void ivtv_set_cc(struct ivtv *itv, int mode, const struct vbi_cc *cc)
	data.line = (mode & 1) ? 21 : 0;
	data.data[0] = cc->odd[0];
	data.data[1] = cc->odd[1];
	ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data);
	ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
	data.field = 1;
	data.line = (mode & 2) ? 21 : 0;
	data.data[0] = cc->even[0];
	data.data[1] = cc->even[1];
	ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data);
	ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
}

static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode)
@@ -80,7 +80,7 @@ static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode)
	data.line = enabled ? 23 : 0;
	data.data[0] = mode & 0xff;
	data.data[1] = (mode >> 8) & 0xff;
	ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data);
	ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
}

static int odd_parity(u8 c)
@@ -316,7 +316,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8
			continue;
		}
		vbi.p = p + 4;
		v4l2_subdev_call(itv->sd_video, video, decode_vbi_line, &vbi);
		v4l2_subdev_call(itv->sd_video, vbi, decode_vbi_line, &vbi);
		if (vbi.type && !(lines & (1 << vbi.line))) {
			lines |= 1 << vbi.line;
			itv->vbi.sliced_data[line].id = vbi.type;
@@ -440,7 +440,7 @@ void ivtv_vbi_work_handler(struct ivtv *itv)
			data.id = V4L2_SLICED_WSS_625;
			data.field = 0;

			if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) {
			if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
				ivtv_set_wss(itv, 1, data.data[0] & 0xf);
				vi->wss_missing_cnt = 0;
			} else if (vi->wss_missing_cnt == 4) {
@@ -454,13 +454,13 @@ void ivtv_vbi_work_handler(struct ivtv *itv)

			data.id = V4L2_SLICED_CAPTION_525;
			data.field = 0;
			if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) {
			if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
				mode |= 1;
				cc.odd[0] = data.data[0];
				cc.odd[1] = data.data[1];
			}
			data.field = 1;
			if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) {
			if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
				mode |= 2;
				cc.even[0] = data.data[0];
				cc.even[1] = data.data[1];
+6 −2
Original line number Diff line number Diff line
@@ -1550,18 +1550,22 @@ static const struct v4l2_subdev_video_ops saa711x_video_ops = {
	.s_crystal_freq = saa711x_s_crystal_freq,
	.g_fmt = saa711x_g_fmt,
	.s_fmt = saa711x_s_fmt,
	.g_vbi_data = saa711x_g_vbi_data,
	.decode_vbi_line = saa711x_decode_vbi_line,
	.s_stream = saa711x_s_stream,
	.querystd = saa711x_querystd,
	.g_input_status = saa711x_g_input_status,
};

static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = {
	.g_vbi_data = saa711x_g_vbi_data,
	.decode_vbi_line = saa711x_decode_vbi_line,
};

static const struct v4l2_subdev_ops saa711x_ops = {
	.core = &saa711x_core_ops,
	.tuner = &saa711x_tuner_ops,
	.audio = &saa711x_audio_ops,
	.video = &saa711x_video_ops,
	.vbi = &saa711x_vbi_ops,
};

/* ----------------------------------------------------------------------- */
Loading