aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-03-14 08:57:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:58:45 -0400
commit32cd527f59f8aa8549067a2c5f989b736f7da79a (patch)
tree2552bd0efffc5bd21011e1f139c1b7a5c9a27390
parentb26d6e21788864039bfb24840a668f2cb0848930 (diff)
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: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c6
-rw-r--r--drivers/media/video/cx18/cx18-vbi.c2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c6
-rw-r--r--drivers/media/video/ivtv/ivtv-vbi.c16
-rw-r--r--drivers/media/video/saa7115.c8
-rw-r--r--drivers/media/video/saa7127.c6
-rw-r--r--drivers/media/video/tvp5150.c4
-rw-r--r--include/media/v4l2-subdev.h57
8 files changed, 65 insertions, 40 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 3ce45297e56a..4454997c1bf4 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -1403,17 +1403,21 @@ static const struct v4l2_subdev_audio_ops cx18_av_audio_ops = {
1403 1403
1404static const struct v4l2_subdev_video_ops cx18_av_video_ops = { 1404static const struct v4l2_subdev_video_ops cx18_av_video_ops = {
1405 .s_routing = cx18_av_s_video_routing, 1405 .s_routing = cx18_av_s_video_routing,
1406 .decode_vbi_line = cx18_av_decode_vbi_line,
1407 .s_stream = cx18_av_s_stream, 1406 .s_stream = cx18_av_s_stream,
1408 .g_fmt = cx18_av_g_fmt, 1407 .g_fmt = cx18_av_g_fmt,
1409 .s_fmt = cx18_av_s_fmt, 1408 .s_fmt = cx18_av_s_fmt,
1410}; 1409};
1411 1410
1411static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
1412 .decode_vbi_line = cx18_av_decode_vbi_line,
1413};
1414
1412static const struct v4l2_subdev_ops cx18_av_ops = { 1415static const struct v4l2_subdev_ops cx18_av_ops = {
1413 .core = &cx18_av_general_ops, 1416 .core = &cx18_av_general_ops,
1414 .tuner = &cx18_av_tuner_ops, 1417 .tuner = &cx18_av_tuner_ops,
1415 .audio = &cx18_av_audio_ops, 1418 .audio = &cx18_av_audio_ops,
1416 .video = &cx18_av_video_ops, 1419 .video = &cx18_av_video_ops,
1420 .vbi = &cx18_av_vbi_ops,
1417}; 1421};
1418 1422
1419int cx18_av_probe(struct cx18 *cx) 1423int cx18_av_probe(struct cx18 *cx)
diff --git a/drivers/media/video/cx18/cx18-vbi.c b/drivers/media/video/cx18/cx18-vbi.c
index 574c1c6974f8..582227522cf0 100644
--- a/drivers/media/video/cx18/cx18-vbi.c
+++ b/drivers/media/video/cx18/cx18-vbi.c
@@ -174,7 +174,7 @@ static u32 compress_sliced_buf(struct cx18 *cx, u8 *buf, u32 size,
174 p[3] != sliced_vbi_eav_rp[1])) 174 p[3] != sliced_vbi_eav_rp[1]))
175 continue; 175 continue;
176 vbi.p = p + 4; 176 vbi.p = p + 4;
177 v4l2_subdev_call(cx->sd_av, video, decode_vbi_line, &vbi); 177 v4l2_subdev_call(cx->sd_av, vbi, decode_vbi_line, &vbi);
178 if (vbi.type) { 178 if (vbi.type) {
179 cx->vbi.sliced_data[line].id = vbi.type; 179 cx->vbi.sliced_data[line].id = vbi.type;
180 cx->vbi.sliced_data[line].field = vbi.is_second_field; 180 cx->vbi.sliced_data[line].field = vbi.is_second_field;
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index f2461cd3de5a..a0f6f82993bc 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1635,15 +1635,19 @@ static const struct v4l2_subdev_video_ops cx25840_video_ops = {
1635 .s_routing = cx25840_s_video_routing, 1635 .s_routing = cx25840_s_video_routing,
1636 .g_fmt = cx25840_g_fmt, 1636 .g_fmt = cx25840_g_fmt,
1637 .s_fmt = cx25840_s_fmt, 1637 .s_fmt = cx25840_s_fmt,
1638 .decode_vbi_line = cx25840_decode_vbi_line,
1639 .s_stream = cx25840_s_stream, 1638 .s_stream = cx25840_s_stream,
1640}; 1639};
1641 1640
1641static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = {
1642 .decode_vbi_line = cx25840_decode_vbi_line,
1643};
1644
1642static const struct v4l2_subdev_ops cx25840_ops = { 1645static const struct v4l2_subdev_ops cx25840_ops = {
1643 .core = &cx25840_core_ops, 1646 .core = &cx25840_core_ops,
1644 .tuner = &cx25840_tuner_ops, 1647 .tuner = &cx25840_tuner_ops,
1645 .audio = &cx25840_audio_ops, 1648 .audio = &cx25840_audio_ops,
1646 .video = &cx25840_video_ops, 1649 .video = &cx25840_video_ops,
1650 .vbi = &cx25840_vbi_ops,
1647}; 1651};
1648 1652
1649/* ----------------------------------------------------------------------- */ 1653/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c
index d73af45dede6..e1c347e5ebd8 100644
--- a/drivers/media/video/ivtv/ivtv-vbi.c
+++ b/drivers/media/video/ivtv/ivtv-vbi.c
@@ -38,7 +38,7 @@ static void ivtv_set_vps(struct ivtv *itv, int enabled)
38 data.data[9] = itv->vbi.vps_payload.data[2]; 38 data.data[9] = itv->vbi.vps_payload.data[2];
39 data.data[10] = itv->vbi.vps_payload.data[3]; 39 data.data[10] = itv->vbi.vps_payload.data[3];
40 data.data[11] = itv->vbi.vps_payload.data[4]; 40 data.data[11] = itv->vbi.vps_payload.data[4];
41 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data); 41 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
42} 42}
43 43
44static void ivtv_set_cc(struct ivtv *itv, int mode, const struct vbi_cc *cc) 44static 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)
52 data.line = (mode & 1) ? 21 : 0; 52 data.line = (mode & 1) ? 21 : 0;
53 data.data[0] = cc->odd[0]; 53 data.data[0] = cc->odd[0];
54 data.data[1] = cc->odd[1]; 54 data.data[1] = cc->odd[1];
55 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data); 55 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
56 data.field = 1; 56 data.field = 1;
57 data.line = (mode & 2) ? 21 : 0; 57 data.line = (mode & 2) ? 21 : 0;
58 data.data[0] = cc->even[0]; 58 data.data[0] = cc->even[0];
59 data.data[1] = cc->even[1]; 59 data.data[1] = cc->even[1];
60 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data); 60 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
61} 61}
62 62
63static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) 63static 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)
80 data.line = enabled ? 23 : 0; 80 data.line = enabled ? 23 : 0;
81 data.data[0] = mode & 0xff; 81 data.data[0] = mode & 0xff;
82 data.data[1] = (mode >> 8) & 0xff; 82 data.data[1] = (mode >> 8) & 0xff;
83 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_vbi_data, &data); 83 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
84} 84}
85 85
86static int odd_parity(u8 c) 86static int odd_parity(u8 c)
@@ -316,7 +316,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8
316 continue; 316 continue;
317 } 317 }
318 vbi.p = p + 4; 318 vbi.p = p + 4;
319 v4l2_subdev_call(itv->sd_video, video, decode_vbi_line, &vbi); 319 v4l2_subdev_call(itv->sd_video, vbi, decode_vbi_line, &vbi);
320 if (vbi.type && !(lines & (1 << vbi.line))) { 320 if (vbi.type && !(lines & (1 << vbi.line))) {
321 lines |= 1 << vbi.line; 321 lines |= 1 << vbi.line;
322 itv->vbi.sliced_data[line].id = vbi.type; 322 itv->vbi.sliced_data[line].id = vbi.type;
@@ -440,7 +440,7 @@ void ivtv_vbi_work_handler(struct ivtv *itv)
440 data.id = V4L2_SLICED_WSS_625; 440 data.id = V4L2_SLICED_WSS_625;
441 data.field = 0; 441 data.field = 0;
442 442
443 if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) { 443 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
444 ivtv_set_wss(itv, 1, data.data[0] & 0xf); 444 ivtv_set_wss(itv, 1, data.data[0] & 0xf);
445 vi->wss_missing_cnt = 0; 445 vi->wss_missing_cnt = 0;
446 } else if (vi->wss_missing_cnt == 4) { 446 } else if (vi->wss_missing_cnt == 4) {
@@ -454,13 +454,13 @@ void ivtv_vbi_work_handler(struct ivtv *itv)
454 454
455 data.id = V4L2_SLICED_CAPTION_525; 455 data.id = V4L2_SLICED_CAPTION_525;
456 data.field = 0; 456 data.field = 0;
457 if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) { 457 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
458 mode |= 1; 458 mode |= 1;
459 cc.odd[0] = data.data[0]; 459 cc.odd[0] = data.data[0];
460 cc.odd[1] = data.data[1]; 460 cc.odd[1] = data.data[1];
461 } 461 }
462 data.field = 1; 462 data.field = 1;
463 if (v4l2_subdev_call(itv->sd_video, video, g_vbi_data, &data) == 0) { 463 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) {
464 mode |= 2; 464 mode |= 2;
465 cc.even[0] = data.data[0]; 465 cc.even[0] = data.data[0];
466 cc.even[1] = data.data[1]; 466 cc.even[1] = data.data[1];
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 72eaa662b66f..cfee323d9c2c 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1550,18 +1550,22 @@ static const struct v4l2_subdev_video_ops saa711x_video_ops = {
1550 .s_crystal_freq = saa711x_s_crystal_freq, 1550 .s_crystal_freq = saa711x_s_crystal_freq,
1551 .g_fmt = saa711x_g_fmt, 1551 .g_fmt = saa711x_g_fmt,
1552 .s_fmt = saa711x_s_fmt, 1552 .s_fmt = saa711x_s_fmt,
1553 .g_vbi_data = saa711x_g_vbi_data,
1554 .decode_vbi_line = saa711x_decode_vbi_line,
1555 .s_stream = saa711x_s_stream, 1553 .s_stream = saa711x_s_stream,
1556 .querystd = saa711x_querystd, 1554 .querystd = saa711x_querystd,
1557 .g_input_status = saa711x_g_input_status, 1555 .g_input_status = saa711x_g_input_status,
1558}; 1556};
1559 1557
1558static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = {
1559 .g_vbi_data = saa711x_g_vbi_data,
1560 .decode_vbi_line = saa711x_decode_vbi_line,
1561};
1562
1560static const struct v4l2_subdev_ops saa711x_ops = { 1563static const struct v4l2_subdev_ops saa711x_ops = {
1561 .core = &saa711x_core_ops, 1564 .core = &saa711x_core_ops,
1562 .tuner = &saa711x_tuner_ops, 1565 .tuner = &saa711x_tuner_ops,
1563 .audio = &saa711x_audio_ops, 1566 .audio = &saa711x_audio_ops,
1564 .video = &saa711x_video_ops, 1567 .video = &saa711x_video_ops,
1568 .vbi = &saa711x_vbi_ops,
1565}; 1569};
1566 1570
1567/* ----------------------------------------------------------------------- */ 1571/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 250ef84cf5ca..32e11fc9c85c 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -727,16 +727,20 @@ static const struct v4l2_subdev_core_ops saa7127_core_ops = {
727}; 727};
728 728
729static const struct v4l2_subdev_video_ops saa7127_video_ops = { 729static const struct v4l2_subdev_video_ops saa7127_video_ops = {
730 .s_vbi_data = saa7127_s_vbi_data,
731 .g_fmt = saa7127_g_fmt, 730 .g_fmt = saa7127_g_fmt,
732 .s_std_output = saa7127_s_std_output, 731 .s_std_output = saa7127_s_std_output,
733 .s_routing = saa7127_s_routing, 732 .s_routing = saa7127_s_routing,
734 .s_stream = saa7127_s_stream, 733 .s_stream = saa7127_s_stream,
735}; 734};
736 735
736static const struct v4l2_subdev_vbi_ops saa7127_vbi_ops = {
737 .s_vbi_data = saa7127_s_vbi_data,
738};
739
737static const struct v4l2_subdev_ops saa7127_ops = { 740static const struct v4l2_subdev_ops saa7127_ops = {
738 .core = &saa7127_core_ops, 741 .core = &saa7127_core_ops,
739 .video = &saa7127_video_ops, 742 .video = &saa7127_video_ops,
743 .vbi = &saa7127_vbi_ops,
740}; 744};
741 745
742/* ----------------------------------------------------------------------- */ 746/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 908ffb68e926..caf0a708542e 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -1046,6 +1046,9 @@ static const struct v4l2_subdev_video_ops tvp5150_video_ops = {
1046 .s_routing = tvp5150_s_routing, 1046 .s_routing = tvp5150_s_routing,
1047 .g_fmt = tvp5150_g_fmt, 1047 .g_fmt = tvp5150_g_fmt,
1048 .s_fmt = tvp5150_s_fmt, 1048 .s_fmt = tvp5150_s_fmt,
1049};
1050
1051static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
1049 .g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap, 1052 .g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
1050}; 1053};
1051 1054
@@ -1053,6 +1056,7 @@ static const struct v4l2_subdev_ops tvp5150_ops = {
1053 .core = &tvp5150_core_ops, 1056 .core = &tvp5150_core_ops,
1054 .tuner = &tvp5150_tuner_ops, 1057 .tuner = &tvp5150_tuner_ops,
1055 .video = &tvp5150_video_ops, 1058 .video = &tvp5150_video_ops,
1059 .vbi = &tvp5150_vbi_ops,
1056}; 1060};
1057 1061
1058 1062
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 09758789be02..433cd2b06267 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -184,28 +184,6 @@ struct v4l2_subdev_audio_ops {
184}; 184};
185 185
186/* 186/*
187 decode_vbi_line: video decoders that support sliced VBI need to implement
188 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
189 start of the VBI data that was generated by the decoder. The driver
190 then parses the sliced VBI data and sets the other fields in the
191 struct accordingly. The pointer p is updated to point to the start of
192 the payload which can be copied verbatim into the data field of the
193 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
194 type field is set to 0 on return.
195
196 s_vbi_data: used to generate VBI signals on a video signal.
197 v4l2_sliced_vbi_data is filled with the data packets that should be
198 output. Note that if you set the line field to 0, then that VBI signal
199 is disabled. If no valid VBI data was found, then the type field is
200 set to 0 on return.
201
202 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
203 Not all video decoders support this. If no data is available because
204 the readback register contains invalid or erroneous data -EIO is
205 returned. Note that you must fill in the 'id' member and the 'field'
206 member (to determine whether CC data from the first or second field
207 should be obtained).
208
209 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 187 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
210 video input devices. 188 video input devices.
211 189
@@ -243,10 +221,6 @@ struct v4l2_subdev_audio_ops {
243struct v4l2_subdev_video_ops { 221struct v4l2_subdev_video_ops {
244 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 222 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
245 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); 223 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
246 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
247 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
248 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
249 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
250 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 224 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
251 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); 225 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
252 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); 226 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
@@ -280,6 +254,36 @@ struct v4l2_subdev_video_ops {
280 struct v4l2_mbus_framefmt *fmt); 254 struct v4l2_mbus_framefmt *fmt);
281}; 255};
282 256
257/*
258 decode_vbi_line: video decoders that support sliced VBI need to implement
259 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
260 start of the VBI data that was generated by the decoder. The driver
261 then parses the sliced VBI data and sets the other fields in the
262 struct accordingly. The pointer p is updated to point to the start of
263 the payload which can be copied verbatim into the data field of the
264 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
265 type field is set to 0 on return.
266
267 s_vbi_data: used to generate VBI signals on a video signal.
268 v4l2_sliced_vbi_data is filled with the data packets that should be
269 output. Note that if you set the line field to 0, then that VBI signal
270 is disabled. If no valid VBI data was found, then the type field is
271 set to 0 on return.
272
273 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
274 Not all video decoders support this. If no data is available because
275 the readback register contains invalid or erroneous data -EIO is
276 returned. Note that you must fill in the 'id' member and the 'field'
277 member (to determine whether CC data from the first or second field
278 should be obtained).
279 */
280struct v4l2_subdev_vbi_ops {
281 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
282 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
283 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
284 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
285};
286
283/** 287/**
284 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations 288 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
285 * @g_skip_top_lines: number of lines at the top of the image to be skipped. 289 * @g_skip_top_lines: number of lines at the top of the image to be skipped.
@@ -379,6 +383,7 @@ struct v4l2_subdev_ops {
379 const struct v4l2_subdev_tuner_ops *tuner; 383 const struct v4l2_subdev_tuner_ops *tuner;
380 const struct v4l2_subdev_audio_ops *audio; 384 const struct v4l2_subdev_audio_ops *audio;
381 const struct v4l2_subdev_video_ops *video; 385 const struct v4l2_subdev_video_ops *video;
386 const struct v4l2_subdev_vbi_ops *vbi;
382 const struct v4l2_subdev_ir_ops *ir; 387 const struct v4l2_subdev_ir_ops *ir;
383 const struct v4l2_subdev_sensor_ops *sensor; 388 const struct v4l2_subdev_sensor_ops *sensor;
384}; 389};