diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-03-14 09:49:48 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:48 -0400 |
commit | 1585927de689a3ca033b98ab5df709e0bf2c3ccc (patch) | |
tree | aad3533fb8ef44b1455079d7fa101d7275c75024 /drivers/media | |
parent | 5393db43f46e3228e4f84dd47050aeadaee23c0b (diff) |
V4L/DVB: cx18: support new vbi ops to set/get VBI format
Also removed the bogus zeroing of fmt.sliced when setting up raw VBI.
This should have been removed in ivtv, but it was just copied-and-pasted
into cx18.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.c | 13 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.h | 5 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-vbi.c | 42 |
3 files changed, 29 insertions, 31 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 4454997c1bf4..c02892302094 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c | |||
@@ -1023,9 +1023,9 @@ static int cx18_av_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) | |||
1023 | 1023 | ||
1024 | static int cx18_av_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 1024 | static int cx18_av_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) |
1025 | { | 1025 | { |
1026 | struct cx18 *cx = v4l2_get_subdevdata(sd); | 1026 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) |
1027 | 1027 | return -EINVAL; | |
1028 | return cx18_av_vbi_g_fmt(cx, fmt); | 1028 | return cx18_av_g_sliced_fmt(sd, &fmt->fmt.sliced); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 1031 | static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) |
@@ -1099,10 +1099,10 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
1099 | break; | 1099 | break; |
1100 | 1100 | ||
1101 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 1101 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
1102 | return cx18_av_vbi_s_fmt(cx, fmt); | 1102 | return cx18_av_s_sliced_fmt(sd, &fmt->fmt.sliced); |
1103 | 1103 | ||
1104 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 1104 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
1105 | return cx18_av_vbi_s_fmt(cx, fmt); | 1105 | return cx18_av_s_raw_fmt(sd, &fmt->fmt.vbi); |
1106 | 1106 | ||
1107 | default: | 1107 | default: |
1108 | return -EINVAL; | 1108 | return -EINVAL; |
@@ -1410,6 +1410,9 @@ static const struct v4l2_subdev_video_ops cx18_av_video_ops = { | |||
1410 | 1410 | ||
1411 | static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = { | 1411 | static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = { |
1412 | .decode_vbi_line = cx18_av_decode_vbi_line, | 1412 | .decode_vbi_line = cx18_av_decode_vbi_line, |
1413 | .g_sliced_fmt = cx18_av_g_sliced_fmt, | ||
1414 | .s_sliced_fmt = cx18_av_s_sliced_fmt, | ||
1415 | .s_raw_fmt = cx18_av_s_raw_fmt, | ||
1413 | }; | 1416 | }; |
1414 | 1417 | ||
1415 | static const struct v4l2_subdev_ops cx18_av_ops = { | 1418 | static const struct v4l2_subdev_ops cx18_av_ops = { |
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h index 74546806b03f..c106967bdcc3 100644 --- a/drivers/media/video/cx18/cx18-av-core.h +++ b/drivers/media/video/cx18/cx18-av-core.h | |||
@@ -378,7 +378,8 @@ void cx18_av_audio_set_path(struct cx18 *cx); | |||
378 | /* cx18_av-vbi.c */ | 378 | /* cx18_av-vbi.c */ |
379 | int cx18_av_decode_vbi_line(struct v4l2_subdev *sd, | 379 | int cx18_av_decode_vbi_line(struct v4l2_subdev *sd, |
380 | struct v4l2_decode_vbi_line *vbi); | 380 | struct v4l2_decode_vbi_line *vbi); |
381 | int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt); | 381 | int cx18_av_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt); |
382 | int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt); | 382 | int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); |
383 | int cx18_av_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); | ||
383 | 384 | ||
384 | #endif | 385 | #endif |
diff --git a/drivers/media/video/cx18/cx18-av-vbi.c b/drivers/media/video/cx18/cx18-av-vbi.c index a51732bcca4b..baa36fbcd4d4 100644 --- a/drivers/media/video/cx18/cx18-av-vbi.c +++ b/drivers/media/video/cx18/cx18-av-vbi.c | |||
@@ -129,10 +129,10 @@ static int decode_vps(u8 *dst, u8 *p) | |||
129 | return err & 0xf0; | 129 | return err & 0xf0; |
130 | } | 130 | } |
131 | 131 | ||
132 | int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt) | 132 | int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) |
133 | { | 133 | { |
134 | struct cx18 *cx = v4l2_get_subdevdata(sd); | ||
134 | struct cx18_av_state *state = &cx->av_state; | 135 | struct cx18_av_state *state = &cx->av_state; |
135 | struct v4l2_sliced_vbi_format *svbi; | ||
136 | static const u16 lcr2vbi[] = { | 136 | static const u16 lcr2vbi[] = { |
137 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ | 137 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ |
138 | 0, V4L2_SLICED_WSS_625, 0, /* 4 */ | 138 | 0, V4L2_SLICED_WSS_625, 0, /* 4 */ |
@@ -143,9 +143,6 @@ int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt) | |||
143 | int is_pal = !(state->std & V4L2_STD_525_60); | 143 | int is_pal = !(state->std & V4L2_STD_525_60); |
144 | int i; | 144 | int i; |
145 | 145 | ||
146 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
147 | return -EINVAL; | ||
148 | svbi = &fmt->fmt.sliced; | ||
149 | memset(svbi, 0, sizeof(*svbi)); | 146 | memset(svbi, 0, sizeof(*svbi)); |
150 | /* we're done if raw VBI is active */ | 147 | /* we're done if raw VBI is active */ |
151 | if ((cx18_av_read(cx, 0x404) & 0x10) == 0) | 148 | if ((cx18_av_read(cx, 0x404) & 0x10) == 0) |
@@ -173,30 +170,27 @@ int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt) | |||
173 | return 0; | 170 | return 0; |
174 | } | 171 | } |
175 | 172 | ||
176 | int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt) | 173 | int cx18_av_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) |
177 | { | 174 | { |
175 | struct cx18 *cx = v4l2_get_subdevdata(sd); | ||
178 | struct cx18_av_state *state = &cx->av_state; | 176 | struct cx18_av_state *state = &cx->av_state; |
179 | struct v4l2_sliced_vbi_format *svbi; | ||
180 | int is_pal = !(state->std & V4L2_STD_525_60); | ||
181 | int i, x; | ||
182 | u8 lcr[24]; | ||
183 | 177 | ||
184 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE && | 178 | /* Setup standard */ |
185 | fmt->type != V4L2_BUF_TYPE_VBI_CAPTURE) | 179 | cx18_av_std_setup(cx); |
186 | return -EINVAL; | ||
187 | svbi = &fmt->fmt.sliced; | ||
188 | if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | ||
189 | /* raw VBI */ | ||
190 | memset(svbi, 0, sizeof(*svbi)); | ||
191 | 180 | ||
192 | /* Setup standard */ | 181 | /* VBI Offset */ |
193 | cx18_av_std_setup(cx); | 182 | cx18_av_write(cx, 0x47f, state->slicer_line_delay); |
183 | cx18_av_write(cx, 0x404, 0x2e); | ||
184 | return 0; | ||
185 | } | ||
194 | 186 | ||
195 | /* VBI Offset */ | 187 | int cx18_av_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) |
196 | cx18_av_write(cx, 0x47f, state->slicer_line_delay); | 188 | { |
197 | cx18_av_write(cx, 0x404, 0x2e); | 189 | struct cx18 *cx = v4l2_get_subdevdata(sd); |
198 | return 0; | 190 | struct cx18_av_state *state = &cx->av_state; |
199 | } | 191 | int is_pal = !(state->std & V4L2_STD_525_60); |
192 | int i, x; | ||
193 | u8 lcr[24]; | ||
200 | 194 | ||
201 | for (x = 0; x <= 23; x++) | 195 | for (x = 0; x <= 23; x++) |
202 | lcr[x] = 0x00; | 196 | lcr[x] = 0x00; |