aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-30 05:26:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:49 -0400
commitdf1d5ed8a81565b78d45fbdffb6561c75c75ec0d (patch)
treed153ca216a5a7633e741a2240ad2391ff61202ed
parent2c26976d726838878eb8dd1bc91f84df38a05143 (diff)
V4L/DVB (11309): cx25840: cleanup: remove intermediate 'ioctl' step
The audio and vbi functions where still called through an ioctl-like interface, even though this is no longer needed with v4l2-subdev. Just change each 'case' into a proper function and call that directly. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx25840/cx25840-audio.c121
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c24
-rw-r--r--drivers/media/video/cx25840/cx25840-core.h8
-rw-r--r--drivers/media/video/cx25840/cx25840-vbi.c314
4 files changed, 219 insertions, 248 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c
index d199d80ea0a3..93d74bee292a 100644
--- a/drivers/media/video/cx25840/cx25840-audio.c
+++ b/drivers/media/video/cx25840/cx25840-audio.c
@@ -363,75 +363,74 @@ static void set_mute(struct i2c_client *client, int mute)
363 } 363 }
364} 364}
365 365
366int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) 366int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq)
367{ 367{
368 struct cx25840_state *state = to_state(i2c_get_clientdata(client)); 368 struct i2c_client *client = v4l2_get_subdevdata(sd);
369 struct v4l2_control *ctrl = arg; 369 struct cx25840_state *state = to_state(sd);
370 int retval; 370 int retval;
371 371
372 switch (cmd) { 372 if (!state->is_cx25836)
373 case VIDIOC_INT_AUDIO_CLOCK_FREQ: 373 cx25840_and_or(client, 0x810, ~0x1, 1);
374 if (!state->is_cx25836) 374 if (state->aud_input != CX25840_AUDIO_SERIAL) {
375 cx25840_and_or(client, 0x810, ~0x1, 1); 375 cx25840_and_or(client, 0x803, ~0x10, 0);
376 if (state->aud_input != CX25840_AUDIO_SERIAL) { 376 cx25840_write(client, 0x8d3, 0x1f);
377 cx25840_and_or(client, 0x803, ~0x10, 0); 377 }
378 cx25840_write(client, 0x8d3, 0x1f); 378 retval = set_audclk_freq(client, freq);
379 } 379 if (state->aud_input != CX25840_AUDIO_SERIAL)
380 retval = set_audclk_freq(client, *(u32 *)arg); 380 cx25840_and_or(client, 0x803, ~0x10, 0x10);
381 if (state->aud_input != CX25840_AUDIO_SERIAL) { 381 if (!state->is_cx25836)
382 cx25840_and_or(client, 0x803, ~0x10, 0x10); 382 cx25840_and_or(client, 0x810, ~0x1, 0);
383 } 383 return retval;
384 if (!state->is_cx25836) 384}
385 cx25840_and_or(client, 0x810, ~0x1, 0);
386 return retval;
387
388 case VIDIOC_G_CTRL:
389 switch (ctrl->id) {
390 case V4L2_CID_AUDIO_VOLUME:
391 ctrl->value = get_volume(client);
392 break;
393 case V4L2_CID_AUDIO_BASS:
394 ctrl->value = get_bass(client);
395 break;
396 case V4L2_CID_AUDIO_TREBLE:
397 ctrl->value = get_treble(client);
398 break;
399 case V4L2_CID_AUDIO_BALANCE:
400 ctrl->value = get_balance(client);
401 break;
402 case V4L2_CID_AUDIO_MUTE:
403 ctrl->value = get_mute(client);
404 break;
405 default:
406 return -EINVAL;
407 }
408 break;
409 385
410 case VIDIOC_S_CTRL: 386int cx25840_audio_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
411 switch (ctrl->id) { 387{
412 case V4L2_CID_AUDIO_VOLUME: 388 struct i2c_client *client = v4l2_get_subdevdata(sd);
413 set_volume(client, ctrl->value);
414 break;
415 case V4L2_CID_AUDIO_BASS:
416 set_bass(client, ctrl->value);
417 break;
418 case V4L2_CID_AUDIO_TREBLE:
419 set_treble(client, ctrl->value);
420 break;
421 case V4L2_CID_AUDIO_BALANCE:
422 set_balance(client, ctrl->value);
423 break;
424 case V4L2_CID_AUDIO_MUTE:
425 set_mute(client, ctrl->value);
426 break;
427 default:
428 return -EINVAL;
429 }
430 break;
431 389
390 switch (ctrl->id) {
391 case V4L2_CID_AUDIO_VOLUME:
392 ctrl->value = get_volume(client);
393 break;
394 case V4L2_CID_AUDIO_BASS:
395 ctrl->value = get_bass(client);
396 break;
397 case V4L2_CID_AUDIO_TREBLE:
398 ctrl->value = get_treble(client);
399 break;
400 case V4L2_CID_AUDIO_BALANCE:
401 ctrl->value = get_balance(client);
402 break;
403 case V4L2_CID_AUDIO_MUTE:
404 ctrl->value = get_mute(client);
405 break;
432 default: 406 default:
433 return -EINVAL; 407 return -EINVAL;
434 } 408 }
409 return 0;
410}
435 411
412int cx25840_audio_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
413{
414 struct i2c_client *client = v4l2_get_subdevdata(sd);
415
416 switch (ctrl->id) {
417 case V4L2_CID_AUDIO_VOLUME:
418 set_volume(client, ctrl->value);
419 break;
420 case V4L2_CID_AUDIO_BASS:
421 set_bass(client, ctrl->value);
422 break;
423 case V4L2_CID_AUDIO_TREBLE:
424 set_treble(client, ctrl->value);
425 break;
426 case V4L2_CID_AUDIO_BALANCE:
427 set_balance(client, ctrl->value);
428 break;
429 case V4L2_CID_AUDIO_MUTE:
430 set_mute(client, ctrl->value);
431 break;
432 default:
433 return -EINVAL;
434 }
436 return 0; 435 return 0;
437} 436}
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index a9b8e520ae57..ec67aea0cdb8 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -775,7 +775,7 @@ static int cx25840_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
775 case V4L2_CID_AUDIO_MUTE: 775 case V4L2_CID_AUDIO_MUTE:
776 if (state->is_cx25836) 776 if (state->is_cx25836)
777 return -EINVAL; 777 return -EINVAL;
778 return cx25840_audio(client, VIDIOC_S_CTRL, ctrl); 778 return cx25840_audio_s_ctrl(sd, ctrl);
779 779
780 default: 780 default:
781 return -EINVAL; 781 return -EINVAL;
@@ -812,7 +812,7 @@ static int cx25840_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
812 case V4L2_CID_AUDIO_MUTE: 812 case V4L2_CID_AUDIO_MUTE:
813 if (state->is_cx25836) 813 if (state->is_cx25836)
814 return -EINVAL; 814 return -EINVAL;
815 return cx25840_audio(client, VIDIOC_G_CTRL, ctrl); 815 return cx25840_audio_g_ctrl(sd, ctrl);
816 default: 816 default:
817 return -EINVAL; 817 return -EINVAL;
818 } 818 }
@@ -828,7 +828,7 @@ static int cx25840_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
828 828
829 switch (fmt->type) { 829 switch (fmt->type) {
830 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 830 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
831 return cx25840_vbi(client, VIDIOC_G_FMT, fmt); 831 return cx25840_vbi_g_fmt(sd, fmt);
832 default: 832 default:
833 return -EINVAL; 833 return -EINVAL;
834 } 834 }
@@ -890,10 +890,10 @@ static int cx25840_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
890 break; 890 break;
891 891
892 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 892 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
893 return cx25840_vbi(client, VIDIOC_S_FMT, fmt); 893 return cx25840_vbi_s_fmt(sd, fmt);
894 894
895 case V4L2_BUF_TYPE_VBI_CAPTURE: 895 case V4L2_BUF_TYPE_VBI_CAPTURE:
896 return cx25840_vbi(client, VIDIOC_S_FMT, fmt); 896 return cx25840_vbi_s_fmt(sd, fmt);
897 897
898 default: 898 default:
899 return -EINVAL; 899 return -EINVAL;
@@ -1153,20 +1153,6 @@ static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
1153} 1153}
1154#endif 1154#endif
1155 1155
1156static int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi)
1157{
1158 struct i2c_client *client = v4l2_get_subdevdata(sd);
1159
1160 return cx25840_vbi(client, VIDIOC_INT_DECODE_VBI_LINE, vbi);
1161}
1162
1163static int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq)
1164{
1165 struct i2c_client *client = v4l2_get_subdevdata(sd);
1166
1167 return cx25840_audio(client, VIDIOC_INT_AUDIO_CLOCK_FREQ, &freq);
1168}
1169
1170static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) 1156static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
1171{ 1157{
1172 struct cx25840_state *state = to_state(sd); 1158 struct cx25840_state *state = to_state(sd);
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h
index be0558277ca3..9ad0eb86ecfd 100644
--- a/drivers/media/video/cx25840/cx25840-core.h
+++ b/drivers/media/video/cx25840/cx25840-core.h
@@ -75,11 +75,15 @@ int cx25840_loadfw(struct i2c_client *client);
75 75
76/* ----------------------------------------------------------------------- */ 76/* ----------------------------------------------------------------------- */
77/* cx25850-audio.c */ 77/* cx25850-audio.c */
78int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg);
79void cx25840_audio_set_path(struct i2c_client *client); 78void cx25840_audio_set_path(struct i2c_client *client);
79int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
80int cx25840_audio_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
81int cx25840_audio_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
80 82
81/* ----------------------------------------------------------------------- */ 83/* ----------------------------------------------------------------------- */
82/* cx25850-vbi.c */ 84/* cx25850-vbi.c */
83int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg); 85int cx25840_vbi_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt);
86int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt);
87int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi);
84 88
85#endif 89#endif
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 03f09b288eb8..35f6592f6c47 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -82,199 +82,181 @@ static int decode_vps(u8 * dst, u8 * p)
82 return err & 0xf0; 82 return err & 0xf0;
83} 83}
84 84
85int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) 85int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
86{ 86{
87 struct cx25840_state *state = to_state(i2c_get_clientdata(client)); 87 struct i2c_client *client = v4l2_get_subdevdata(sd);
88 struct v4l2_format *fmt; 88 struct cx25840_state *state = to_state(sd);
89 struct v4l2_sliced_vbi_format *svbi; 89 struct v4l2_sliced_vbi_format *svbi;
90 static const u16 lcr2vbi[] = {
91 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
92 0, V4L2_SLICED_WSS_625, 0, /* 4 */
93 V4L2_SLICED_CAPTION_525, /* 6 */
94 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */
95 0, 0, 0, 0
96 };
97 int is_pal = !(state->std & V4L2_STD_525_60);
98 int i;
90 99
91 switch (cmd) { 100 if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
92 case VIDIOC_G_FMT: 101 return -EINVAL;
93 { 102 svbi = &fmt->fmt.sliced;
94 static u16 lcr2vbi[] = { 103 memset(svbi, 0, sizeof(*svbi));
95 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ 104 /* we're done if raw VBI is active */
96 0, V4L2_SLICED_WSS_625, 0, /* 4 */ 105 if ((cx25840_read(client, 0x404) & 0x10) == 0)
97 V4L2_SLICED_CAPTION_525, /* 6 */ 106 return 0;
98 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */
99 0, 0, 0, 0
100 };
101 int is_pal = !(state->std & V4L2_STD_525_60);
102 int i;
103
104 fmt = arg;
105 if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
106 return -EINVAL;
107 svbi = &fmt->fmt.sliced;
108 memset(svbi, 0, sizeof(*svbi));
109 /* we're done if raw VBI is active */
110 if ((cx25840_read(client, 0x404) & 0x10) == 0)
111 break;
112 107
113 if (is_pal) { 108 if (is_pal) {
114 for (i = 7; i <= 23; i++) { 109 for (i = 7; i <= 23; i++) {
115 u8 v = cx25840_read(client, 0x424 + i - 7); 110 u8 v = cx25840_read(client, 0x424 + i - 7);
116 111
117 svbi->service_lines[0][i] = lcr2vbi[v >> 4]; 112 svbi->service_lines[0][i] = lcr2vbi[v >> 4];
118 svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; 113 svbi->service_lines[1][i] = lcr2vbi[v & 0xf];
119 svbi->service_set |= 114 svbi->service_set |= svbi->service_lines[0][i] |
120 svbi->service_lines[0][i] | svbi->service_lines[1][i]; 115 svbi->service_lines[1][i];
121 }
122 } 116 }
123 else { 117 } else {
124 for (i = 10; i <= 21; i++) { 118 for (i = 10; i <= 21; i++) {
125 u8 v = cx25840_read(client, 0x424 + i - 10); 119 u8 v = cx25840_read(client, 0x424 + i - 10);
126 120
127 svbi->service_lines[0][i] = lcr2vbi[v >> 4]; 121 svbi->service_lines[0][i] = lcr2vbi[v >> 4];
128 svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; 122 svbi->service_lines[1][i] = lcr2vbi[v & 0xf];
129 svbi->service_set |= 123 svbi->service_set |= svbi->service_lines[0][i] |
130 svbi->service_lines[0][i] | svbi->service_lines[1][i]; 124 svbi->service_lines[1][i];
131 }
132 } 125 }
133 break;
134 } 126 }
127 return 0;
128}
135 129
136 case VIDIOC_S_FMT: 130int cx25840_vbi_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
137 { 131{
138 int is_pal = !(state->std & V4L2_STD_525_60); 132 struct i2c_client *client = v4l2_get_subdevdata(sd);
139 int vbi_offset = is_pal ? 1 : 0; 133 struct cx25840_state *state = to_state(sd);
140 int i, x; 134 struct v4l2_sliced_vbi_format *svbi;
141 u8 lcr[24]; 135 int is_pal = !(state->std & V4L2_STD_525_60);
142 136 int vbi_offset = is_pal ? 1 : 0;
143 fmt = arg; 137 int i, x;
144 if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE && 138 u8 lcr[24];
145 fmt->type != V4L2_BUF_TYPE_VBI_CAPTURE) 139
146 return -EINVAL; 140 if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE &&
147 svbi = &fmt->fmt.sliced; 141 fmt->type != V4L2_BUF_TYPE_VBI_CAPTURE)
148 if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 142 return -EINVAL;
149 /* raw VBI */ 143 svbi = &fmt->fmt.sliced;
150 memset(svbi, 0, sizeof(*svbi)); 144 if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
151 145 /* raw VBI */
152 /* Setup standard */ 146 memset(svbi, 0, sizeof(*svbi));
153 cx25840_std_setup(client);
154
155 /* VBI Offset */
156 cx25840_write(client, 0x47f, vbi_offset);
157 cx25840_write(client, 0x404, 0x2e);
158 break;
159 }
160
161 for (x = 0; x <= 23; x++)
162 lcr[x] = 0x00;
163 147
164 /* Setup standard */ 148 /* Setup standard */
165 cx25840_std_setup(client); 149 cx25840_std_setup(client);
166 150
167 /* Sliced VBI */ 151 /* VBI Offset */
168 cx25840_write(client, 0x404, 0x32); /* Ancillary data */
169 cx25840_write(client, 0x406, 0x13);
170 cx25840_write(client, 0x47f, vbi_offset); 152 cx25840_write(client, 0x47f, vbi_offset);
153 cx25840_write(client, 0x404, 0x2e);
154 return 0;
155 }
171 156
172 if (is_pal) { 157 for (x = 0; x <= 23; x++)
173 for (i = 0; i <= 6; i++) 158 lcr[x] = 0x00;
174 svbi->service_lines[0][i] = 159
175 svbi->service_lines[1][i] = 0; 160 /* Setup standard */
176 } else { 161 cx25840_std_setup(client);
177 for (i = 0; i <= 9; i++) 162
178 svbi->service_lines[0][i] = 163 /* Sliced VBI */
179 svbi->service_lines[1][i] = 0; 164 cx25840_write(client, 0x404, 0x32); /* Ancillary data */
180 165 cx25840_write(client, 0x406, 0x13);
181 for (i = 22; i <= 23; i++) 166 cx25840_write(client, 0x47f, vbi_offset);
182 svbi->service_lines[0][i] = 167
183 svbi->service_lines[1][i] = 0; 168 if (is_pal) {
184 } 169 for (i = 0; i <= 6; i++)
185 170 svbi->service_lines[0][i] =
186 for (i = 7; i <= 23; i++) { 171 svbi->service_lines[1][i] = 0;
187 for (x = 0; x <= 1; x++) { 172 } else {
188 switch (svbi->service_lines[1-x][i]) { 173 for (i = 0; i <= 9; i++)
189 case V4L2_SLICED_TELETEXT_B: 174 svbi->service_lines[0][i] =
190 lcr[i] |= 1 << (4 * x); 175 svbi->service_lines[1][i] = 0;
191 break; 176
192 case V4L2_SLICED_WSS_625: 177 for (i = 22; i <= 23; i++)
193 lcr[i] |= 4 << (4 * x); 178 svbi->service_lines[0][i] =
194 break; 179 svbi->service_lines[1][i] = 0;
195 case V4L2_SLICED_CAPTION_525: 180 }
196 lcr[i] |= 6 << (4 * x);
197 break;
198 case V4L2_SLICED_VPS:
199 lcr[i] |= 9 << (4 * x);
200 break;
201 }
202 }
203 }
204 181
205 if (is_pal) { 182 for (i = 7; i <= 23; i++) {
206 for (x = 1, i = 0x424; i <= 0x434; i++, x++) { 183 for (x = 0; x <= 1; x++) {
207 cx25840_write(client, i, lcr[6 + x]); 184 switch (svbi->service_lines[1-x][i]) {
208 } 185 case V4L2_SLICED_TELETEXT_B:
209 } 186 lcr[i] |= 1 << (4 * x);
210 else { 187 break;
211 for (x = 1, i = 0x424; i <= 0x430; i++, x++) { 188 case V4L2_SLICED_WSS_625:
212 cx25840_write(client, i, lcr[9 + x]); 189 lcr[i] |= 4 << (4 * x);
213 } 190 break;
214 for (i = 0x431; i <= 0x434; i++) { 191 case V4L2_SLICED_CAPTION_525:
215 cx25840_write(client, i, 0); 192 lcr[i] |= 6 << (4 * x);
193 break;
194 case V4L2_SLICED_VPS:
195 lcr[i] |= 9 << (4 * x);
196 break;
216 } 197 }
217 } 198 }
199 }
218 200
219 cx25840_write(client, 0x43c, 0x16); 201 if (is_pal) {
220 202 for (x = 1, i = 0x424; i <= 0x434; i++, x++)
221 if (is_pal) { 203 cx25840_write(client, i, lcr[6 + x]);
222 cx25840_write(client, 0x474, 0x2a); 204 } else {
223 } else { 205 for (x = 1, i = 0x424; i <= 0x430; i++, x++)
224 cx25840_write(client, 0x474, 0x22); 206 cx25840_write(client, i, lcr[9 + x]);
225 } 207 for (i = 0x431; i <= 0x434; i++)
226 break; 208 cx25840_write(client, i, 0);
227 } 209 }
228 210
229 case VIDIOC_INT_DECODE_VBI_LINE: 211 cx25840_write(client, 0x43c, 0x16);
230 { 212 cx25840_write(client, 0x474, is_pal ? 0x2a : 0x22);
231 struct v4l2_decode_vbi_line *vbi = arg; 213 return 0;
232 u8 *p = vbi->p; 214}
233 int id1, id2, l, err = 0;
234 215
235 if (p[0] || p[1] != 0xff || p[2] != 0xff || 216int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi)
236 (p[3] != 0x55 && p[3] != 0x91)) { 217{
237 vbi->line = vbi->type = 0; 218 struct cx25840_state *state = to_state(sd);
238 break; 219 u8 *p = vbi->p;
239 } 220 int id1, id2, l, err = 0;
221
222 if (p[0] || p[1] != 0xff || p[2] != 0xff ||
223 (p[3] != 0x55 && p[3] != 0x91)) {
224 vbi->line = vbi->type = 0;
225 return 0;
226 }
240 227
241 p += 4; 228 p += 4;
242 id1 = p[-1]; 229 id1 = p[-1];
243 id2 = p[0] & 0xf; 230 id2 = p[0] & 0xf;
244 l = p[2] & 0x3f; 231 l = p[2] & 0x3f;
245 l += state->vbi_line_offset; 232 l += state->vbi_line_offset;
246 p += 4; 233 p += 4;
247 234
248 switch (id2) { 235 switch (id2) {
249 case 1: 236 case 1:
250 id2 = V4L2_SLICED_TELETEXT_B; 237 id2 = V4L2_SLICED_TELETEXT_B;
251 break; 238 break;
252 case 4: 239 case 4:
253 id2 = V4L2_SLICED_WSS_625; 240 id2 = V4L2_SLICED_WSS_625;
254 break; 241 break;
255 case 6: 242 case 6:
256 id2 = V4L2_SLICED_CAPTION_525; 243 id2 = V4L2_SLICED_CAPTION_525;
257 err = !odd_parity(p[0]) || !odd_parity(p[1]); 244 err = !odd_parity(p[0]) || !odd_parity(p[1]);
258 break; 245 break;
259 case 9: 246 case 9:
260 id2 = V4L2_SLICED_VPS; 247 id2 = V4L2_SLICED_VPS;
261 if (decode_vps(p, p) != 0) { 248 if (decode_vps(p, p) != 0)
262 err = 1;
263 }
264 break;
265 default:
266 id2 = 0;
267 err = 1; 249 err = 1;
268 break;
269 }
270
271 vbi->type = err ? 0 : id2;
272 vbi->line = err ? 0 : l;
273 vbi->is_second_field = err ? 0 : (id1 == 0x55);
274 vbi->p = p;
275 break; 250 break;
276 } 251 default:
252 id2 = 0;
253 err = 1;
254 break;
277 } 255 }
278 256
257 vbi->type = err ? 0 : id2;
258 vbi->line = err ? 0 : l;
259 vbi->is_second_field = err ? 0 : (id1 == 0x55);
260 vbi->p = p;
279 return 0; 261 return 0;
280} 262}