diff options
author | Mike Isely <isely@pobox.com> | 2006-06-25 19:04:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-26 23:17:18 -0400 |
commit | eacbe7c51f0fe770252e03ef2433a1ed4c990a17 (patch) | |
tree | 26d360b470bcba63a25a0d5c936ddb821477a4a7 /drivers | |
parent | b2bbaa93940627aec1d92191cf28a36e6048de6e (diff) |
V4L/DVB (4232): Rearrange things in pvrusb2-encoder in preparation for use of cx2341x module
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-encoder.c | 224 |
1 files changed, 138 insertions, 86 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 0917fe315f3c..f3d2c2b4d512 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c | |||
@@ -65,7 +65,7 @@ static u32 pvr_tbl_audiobitrate[] = { | |||
65 | #define IVTV_MBOX_DRIVER_BUSY 0x00000001 | 65 | #define IVTV_MBOX_DRIVER_BUSY 0x00000001 |
66 | 66 | ||
67 | 67 | ||
68 | static int pvr2_write_encoder_words(struct pvr2_hdw *hdw, | 68 | static int pvr2_encoder_write_words(struct pvr2_hdw *hdw, |
69 | const u32 *data, unsigned int dlen) | 69 | const u32 *data, unsigned int dlen) |
70 | { | 70 | { |
71 | unsigned int idx; | 71 | unsigned int idx; |
@@ -106,7 +106,7 @@ static int pvr2_write_encoder_words(struct pvr2_hdw *hdw, | |||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | static int pvr2_read_encoder_words(struct pvr2_hdw *hdw,int statusFl, | 109 | static int pvr2_encoder_read_words(struct pvr2_hdw *hdw,int statusFl, |
110 | u32 *data, unsigned int dlen) | 110 | u32 *data, unsigned int dlen) |
111 | { | 111 | { |
112 | unsigned int idx; | 112 | unsigned int idx; |
@@ -147,15 +147,24 @@ static int pvr2_read_encoder_words(struct pvr2_hdw *hdw,int statusFl, | |||
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | 150 | /* This prototype is set up to be compatible with the |
151 | int args, ...) | 151 | cx2341x_mbox_func prototype in cx2341x.h, which should be in |
152 | kernels 2.6.18 or later. We do this so that we can enable | ||
153 | cx2341x.ko to write to our encoder (by handing it a pointer to this | ||
154 | function). For earlier kernels this doesn't really matter. */ | ||
155 | static int pvr2_encoder_cmd(void *ctxt, | ||
156 | int cmd, | ||
157 | int arg_cnt_send, | ||
158 | int arg_cnt_recv, | ||
159 | u32 *argp) | ||
152 | { | 160 | { |
153 | unsigned int poll_count; | 161 | unsigned int poll_count; |
154 | int ret = 0; | 162 | int ret = 0; |
155 | va_list vl; | ||
156 | unsigned int idx; | 163 | unsigned int idx; |
164 | /* These sizes look to be limited by the FX2 firmware implementation */ | ||
157 | u32 wrData[16]; | 165 | u32 wrData[16]; |
158 | u32 rdData[32]; | 166 | u32 rdData[16]; |
167 | struct pvr2_hdw *hdw = (struct pvr2_hdw *)ctxt; | ||
159 | 168 | ||
160 | /* | 169 | /* |
161 | 170 | ||
@@ -189,6 +198,28 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | |||
189 | 198 | ||
190 | */ | 199 | */ |
191 | 200 | ||
201 | if (arg_cnt_send > (sizeof(wrData)/sizeof(wrData[0]))-4) { | ||
202 | pvr2_trace( | ||
203 | PVR2_TRACE_ERROR_LEGS, | ||
204 | "Failed to write cx23416 command" | ||
205 | " - too many input arguments" | ||
206 | " (was given %u limit %u)", | ||
207 | arg_cnt_send, | ||
208 | (sizeof(wrData)/sizeof(wrData[0])) - 4); | ||
209 | return -EINVAL; | ||
210 | } | ||
211 | |||
212 | if (arg_cnt_recv > (sizeof(rdData)/sizeof(rdData[0]))-4) { | ||
213 | pvr2_trace( | ||
214 | PVR2_TRACE_ERROR_LEGS, | ||
215 | "Failed to write cx23416 command" | ||
216 | " - too many return arguments" | ||
217 | " (was given %u limit %u)", | ||
218 | arg_cnt_recv, | ||
219 | (sizeof(rdData)/sizeof(rdData[0])) - 4); | ||
220 | return -EINVAL; | ||
221 | } | ||
222 | |||
192 | 223 | ||
193 | LOCK_TAKE(hdw->ctl_lock); do { | 224 | LOCK_TAKE(hdw->ctl_lock); do { |
194 | 225 | ||
@@ -196,25 +227,22 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | |||
196 | wrData[1] = cmd; | 227 | wrData[1] = cmd; |
197 | wrData[2] = 0; | 228 | wrData[2] = 0; |
198 | wrData[3] = 0x00060000; | 229 | wrData[3] = 0x00060000; |
199 | va_start(vl, args); | 230 | for (idx = 0; idx < arg_cnt_send; idx++) { |
200 | for (idx = 0; idx < args; idx++) { | 231 | wrData[idx+4] = argp[idx]; |
201 | wrData[idx+4] = va_arg(vl, u32); | ||
202 | } | 232 | } |
203 | va_end(vl); | 233 | for (; idx < (sizeof(wrData)/sizeof(wrData[0]))-4; idx++) { |
204 | args += 4; | 234 | wrData[idx+4] = 0; |
205 | while (args < sizeof(wrData)/sizeof(wrData[0])) { | ||
206 | wrData[args++] = 0; | ||
207 | } | 235 | } |
208 | 236 | ||
209 | ret = pvr2_write_encoder_words(hdw,wrData,args); | 237 | ret = pvr2_encoder_write_words(hdw,wrData,idx); |
210 | if (ret) break; | 238 | if (ret) break; |
211 | wrData[0] = IVTV_MBOX_DRIVER_DONE|IVTV_MBOX_DRIVER_BUSY; | 239 | wrData[0] = IVTV_MBOX_DRIVER_DONE|IVTV_MBOX_DRIVER_BUSY; |
212 | ret = pvr2_write_encoder_words(hdw,wrData,1); | 240 | ret = pvr2_encoder_write_words(hdw,wrData,1); |
213 | if (ret) break; | 241 | if (ret) break; |
214 | poll_count = 0; | 242 | poll_count = 0; |
215 | while (1) { | 243 | while (1) { |
216 | if (poll_count < 10000000) poll_count++; | 244 | if (poll_count < 10000000) poll_count++; |
217 | ret = pvr2_read_encoder_words(hdw,!0,rdData,1); | 245 | ret = pvr2_encoder_read_words(hdw,!0,rdData,1); |
218 | if (ret) break; | 246 | if (ret) break; |
219 | if (rdData[0] & IVTV_MBOX_FIRMWARE_DONE) { | 247 | if (rdData[0] & IVTV_MBOX_FIRMWARE_DONE) { |
220 | break; | 248 | break; |
@@ -228,7 +256,7 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | |||
228 | pvr2_trace( | 256 | pvr2_trace( |
229 | PVR2_TRACE_ERROR_LEGS, | 257 | PVR2_TRACE_ERROR_LEGS, |
230 | "Encoder command: 0x%02x",cmd); | 258 | "Encoder command: 0x%02x",cmd); |
231 | for (idx = 4; idx < args; idx++) { | 259 | for (idx = 4; idx < arg_cnt_send; idx++) { |
232 | pvr2_trace( | 260 | pvr2_trace( |
233 | PVR2_TRACE_ERROR_LEGS, | 261 | PVR2_TRACE_ERROR_LEGS, |
234 | "Encoder arg%d: 0x%08x", | 262 | "Encoder arg%d: 0x%08x", |
@@ -245,20 +273,16 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | |||
245 | } | 273 | } |
246 | if (ret) break; | 274 | if (ret) break; |
247 | wrData[0] = 0x7; | 275 | wrData[0] = 0x7; |
248 | ret = pvr2_read_encoder_words(hdw,0,rdData,16); | 276 | ret = pvr2_encoder_read_words( |
277 | hdw,0,rdData, | ||
278 | sizeof(rdData)/sizeof(rdData[0])); | ||
249 | if (ret) break; | 279 | if (ret) break; |
250 | for (idx = 0; idx < args; idx++) { | 280 | for (idx = 0; idx < arg_cnt_recv; idx++) { |
251 | if (rdData[idx] != wrData[idx]) { | 281 | argp[idx] = rdData[idx+4]; |
252 | pvr2_trace( | ||
253 | PVR2_TRACE_DEBUG, | ||
254 | "pvr2_encoder idx %02x mismatch exp:" | ||
255 | " %08x got: %08x", | ||
256 | idx,wrData[idx],rdData[idx]); | ||
257 | } | ||
258 | } | 282 | } |
259 | 283 | ||
260 | wrData[0] = 0x0; | 284 | wrData[0] = 0x0; |
261 | ret = pvr2_write_encoder_words(hdw,wrData,1); | 285 | ret = pvr2_encoder_write_words(hdw,wrData,1); |
262 | if (ret) break; | 286 | if (ret) break; |
263 | 287 | ||
264 | } while(0); LOCK_GIVE(hdw->ctl_lock); | 288 | } while(0); LOCK_GIVE(hdw->ctl_lock); |
@@ -266,6 +290,34 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, | |||
266 | return ret; | 290 | return ret; |
267 | } | 291 | } |
268 | 292 | ||
293 | |||
294 | static int pvr2_encoder_vcmd(struct pvr2_hdw *hdw, int cmd, | ||
295 | int args, ...) | ||
296 | { | ||
297 | va_list vl; | ||
298 | unsigned int idx; | ||
299 | u32 data[12]; | ||
300 | |||
301 | if (args > sizeof(data)/sizeof(data[0])) { | ||
302 | pvr2_trace( | ||
303 | PVR2_TRACE_ERROR_LEGS, | ||
304 | "Failed to write cx23416 command" | ||
305 | " - too many arguments" | ||
306 | " (was given %u limit %u)", | ||
307 | args,sizeof(data)/sizeof(data[0])); | ||
308 | return -EINVAL; | ||
309 | } | ||
310 | |||
311 | va_start(vl, args); | ||
312 | for (idx = 0; idx < args; idx++) { | ||
313 | data[idx] = va_arg(vl, u32); | ||
314 | } | ||
315 | va_end(vl); | ||
316 | |||
317 | return pvr2_encoder_cmd(hdw,cmd,args,0,data); | ||
318 | } | ||
319 | |||
320 | |||
269 | int pvr2_encoder_configure(struct pvr2_hdw *hdw) | 321 | int pvr2_encoder_configure(struct pvr2_hdw *hdw) |
270 | { | 322 | { |
271 | int ret = 0, audio, i; | 323 | int ret = 0, audio, i; |
@@ -305,12 +357,12 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) | |||
305 | also been determined that sending 0x00 as this mystery | 357 | also been determined that sending 0x00 as this mystery |
306 | second argument seems to work on both hardware models AND | 358 | second argument seems to work on both hardware models AND |
307 | xawtv works again. So we're going to send 0x00. */ | 359 | xawtv works again. So we're going to send 0x00. */ |
308 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_OUTPUT_PORT, 2, | 360 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_OUTPUT_PORT, 2, |
309 | 0x01, 0x00); | 361 | 0x01, 0x00); |
310 | 362 | ||
311 | /* set the Program Index Information. We want I,P,B frames (max 400) */ | 363 | /* set the Program Index Information. We want I,P,B frames (max 400) */ |
312 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_PGM_INDEX_INFO, 2, | 364 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_PGM_INDEX_INFO, 2, |
313 | 0x07, 0x0190); | 365 | 0x07, 0x0190); |
314 | 366 | ||
315 | /* NOTE : windows driver sends these */ | 367 | /* NOTE : windows driver sends these */ |
316 | /* Mike Isely <isely@pobox.com> 7-Mar-2006 The windows driver | 368 | /* Mike Isely <isely@pobox.com> 7-Mar-2006 The windows driver |
@@ -319,79 +371,79 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) | |||
319 | Leaving these out seems to do no harm at all, so they're | 371 | Leaving these out seems to do no harm at all, so they're |
320 | commented out for that reason. */ | 372 | commented out for that reason. */ |
321 | #ifdef notdef | 373 | #ifdef notdef |
322 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 5,0,0,0); | 374 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 5,0,0,0); |
323 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3,1,0,0); | 375 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3,1,0,0); |
324 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 8,0,0,0); | 376 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 8,0,0,0); |
325 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 4,1,0,0); | 377 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 4,1,0,0); |
326 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0); | 378 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0); |
327 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0); | 379 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0); |
328 | #endif | 380 | #endif |
329 | 381 | ||
330 | /* Strange compared to ivtv data. */ | 382 | /* Strange compared to ivtv data. */ |
331 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, | 383 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, |
332 | 0xf0, 0xf0); | 384 | 0xf0, 0xf0); |
333 | 385 | ||
334 | /* setup firmware to notify us about some events (don't know why...) */ | 386 | /* setup firmware to notify us about some events (don't know why...) */ |
335 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_EVENT_NOTIFICATION, 4, | 387 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_EVENT_NOTIFICATION, 4, |
336 | 0, 0, 0x10000000, 0xffffffff); | 388 | 0, 0, 0x10000000, 0xffffffff); |
337 | 389 | ||
338 | /* set fps to 25 or 30 (1 or 0)*/ | 390 | /* set fps to 25 or 30 (1 or 0)*/ |
339 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_RATE, 1, | 391 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_RATE, 1, |
340 | is_30fps ? 0 : 1); | 392 | is_30fps ? 0 : 1); |
341 | 393 | ||
342 | /* set encoding resolution */ | 394 | /* set encoding resolution */ |
343 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_SIZE, 2, | 395 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_SIZE, 2, |
344 | (height_full ? height : (height / 2)), | 396 | (height_full ? height : (height / 2)), |
345 | width); | 397 | width); |
346 | /* set encoding aspect ratio to 4:3 */ | 398 | /* set encoding aspect ratio to 4:3 */ |
347 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_ASPECT_RATIO, 1, | 399 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_ASPECT_RATIO, 1, |
348 | 0x02); | 400 | 0x02); |
349 | 401 | ||
350 | /* VBI */ | 402 | /* VBI */ |
351 | 403 | ||
352 | if (hdw->config == pvr2_config_vbi) { | 404 | if (hdw->config == pvr2_config_vbi) { |
353 | int lines = 2 * (is_30fps ? 12 : 18); | 405 | int lines = 2 * (is_30fps ? 12 : 18); |
354 | int size = (4*((lines*1443+3)/4)) / lines; | 406 | int size = (4*((lines*1443+3)/4)) / lines; |
355 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_VBI_CONFIG, 7, | 407 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_VBI_CONFIG, 7, |
356 | 0xbd05, 1, 4, | 408 | 0xbd05, 1, 4, |
357 | 0x25256262, 0x387f7f7f, | 409 | 0x25256262, 0x387f7f7f, |
358 | lines , size); | 410 | lines , size); |
359 | // 0x25256262, 0x13135454, lines , size); | 411 | // 0x25256262, 0x13135454, lines , size); |
360 | /* select vbi lines */ | 412 | /* select vbi lines */ |
361 | #define line_used(l) (is_30fps ? (l >= 10 && l <= 21) : (l >= 6 && l <= 23)) | 413 | #define line_used(l) (is_30fps ? (l >= 10 && l <= 21) : (l >= 6 && l <= 23)) |
362 | for (i = 2 ; i <= 24 ; i++){ | 414 | for (i = 2 ; i <= 24 ; i++){ |
363 | ret |= pvr2_write_encoder_vcmd( | 415 | ret |= pvr2_encoder_vcmd( |
364 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, | 416 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, |
365 | i-1,line_used(i), 0, 0, 0); | 417 | i-1,line_used(i), 0, 0, 0); |
366 | ret |= pvr2_write_encoder_vcmd( | 418 | ret |= pvr2_encoder_vcmd( |
367 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, | 419 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, |
368 | (i-1) | (1 << 31), | 420 | (i-1) | (1 << 31), |
369 | line_used(i), 0, 0, 0); | 421 | line_used(i), 0, 0, 0); |
370 | } | 422 | } |
371 | } else { | 423 | } else { |
372 | ret |= pvr2_write_encoder_vcmd( | 424 | ret |= pvr2_encoder_vcmd( |
373 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, | 425 | hdw,CX2341X_ENC_SET_VBI_LINE, 5, |
374 | 0xffffffff,0,0,0,0); | 426 | 0xffffffff,0,0,0,0); |
375 | } | 427 | } |
376 | 428 | ||
377 | /* set stream type, depending on resolution. */ | 429 | /* set stream type, depending on resolution. */ |
378 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_STREAM_TYPE, 1, | 430 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_STREAM_TYPE, 1, |
379 | height_full ? 0x0a : 0x0b); | 431 | height_full ? 0x0a : 0x0b); |
380 | /* set video bitrate */ | 432 | /* set video bitrate */ |
381 | ret |= pvr2_write_encoder_vcmd( | 433 | ret |= pvr2_encoder_vcmd( |
382 | hdw, CX2341X_ENC_SET_BIT_RATE, 3, | 434 | hdw, CX2341X_ENC_SET_BIT_RATE, 3, |
383 | (hdw->vbr_val ? 1 : 0), | 435 | (hdw->vbr_val ? 1 : 0), |
384 | hdw->videobitrate_val, | 436 | hdw->videobitrate_val, |
385 | hdw->videopeak_val / 400); | 437 | hdw->videopeak_val / 400); |
386 | /* setup GOP structure (GOP size = 0f or 0c, 3-1 = 2 B-frames) */ | 438 | /* setup GOP structure (GOP size = 0f or 0c, 3-1 = 2 B-frames) */ |
387 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_GOP_PROPERTIES, 2, | 439 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_GOP_PROPERTIES, 2, |
388 | is_30fps ? 0x0f : 0x0c, 0x03); | 440 | is_30fps ? 0x0f : 0x0c, 0x03); |
389 | 441 | ||
390 | /* enable 3:2 pulldown */ | 442 | /* enable 3:2 pulldown */ |
391 | ret |= pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_SET_3_2_PULLDOWN,1,0); | 443 | ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_3_2_PULLDOWN,1,0); |
392 | 444 | ||
393 | /* set GOP open/close property (open) */ | 445 | /* set GOP open/close property (open) */ |
394 | ret |= pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_SET_GOP_CLOSURE,1,0); | 446 | ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_GOP_CLOSURE,1,0); |
395 | 447 | ||
396 | /* set audio stream properties 0x40b9? 0100 0000 1011 1001 */ | 448 | /* set audio stream properties 0x40b9? 0100 0000 1011 1001 */ |
397 | audio = (pvr_tbl_audiobitrate[hdw->audiobitrate_val] | | 449 | audio = (pvr_tbl_audiobitrate[hdw->audiobitrate_val] | |
@@ -400,28 +452,28 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) | |||
400 | (hdw->audiocrc_val ? 1 << 14 : 0) | | 452 | (hdw->audiocrc_val ? 1 << 14 : 0) | |
401 | pvr_tbl_emphasis[hdw->audioemphasis_val]); | 453 | pvr_tbl_emphasis[hdw->audioemphasis_val]); |
402 | 454 | ||
403 | ret |= pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_SET_AUDIO_PROPERTIES,1, | 455 | ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_AUDIO_PROPERTIES,1, |
404 | audio); | 456 | audio); |
405 | 457 | ||
406 | /* set dynamic noise reduction filter to manual, Horiz/Vert */ | 458 | /* set dynamic noise reduction filter to manual, Horiz/Vert */ |
407 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, | 459 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, |
408 | 0, 0x03); | 460 | 0, 0x03); |
409 | 461 | ||
410 | /* dynamic noise reduction filter param */ | 462 | /* dynamic noise reduction filter param */ |
411 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2 | 463 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2 |
412 | , 0, 0); | 464 | , 0, 0); |
413 | 465 | ||
414 | /* dynamic noise reduction median filter */ | 466 | /* dynamic noise reduction median filter */ |
415 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_SET_CORING_LEVELS, 4, | 467 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_CORING_LEVELS, 4, |
416 | 0, 0xff, 0, 0xff); | 468 | 0, 0xff, 0, 0xff); |
417 | 469 | ||
418 | /* spacial prefiler parameter */ | 470 | /* spacial prefiler parameter */ |
419 | ret |= pvr2_write_encoder_vcmd(hdw, | 471 | ret |= pvr2_encoder_vcmd(hdw, |
420 | CX2341X_ENC_SET_SPATIAL_FILTER_TYPE, 2, | 472 | CX2341X_ENC_SET_SPATIAL_FILTER_TYPE, 2, |
421 | 0x01, 0x01); | 473 | 0x01, 0x01); |
422 | 474 | ||
423 | /* initialize video input */ | 475 | /* initialize video input */ |
424 | ret |= pvr2_write_encoder_vcmd(hdw, CX2341X_ENC_INITIALIZE_INPUT, 0); | 476 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_INITIALIZE_INPUT, 0); |
425 | 477 | ||
426 | if (!ret) { | 478 | if (!ret) { |
427 | hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); | 479 | hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); |
@@ -442,14 +494,14 @@ int pvr2_encoder_start(struct pvr2_hdw *hdw) | |||
442 | pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000); | 494 | pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000); |
443 | 495 | ||
444 | if (hdw->config == pvr2_config_vbi) { | 496 | if (hdw->config == pvr2_config_vbi) { |
445 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, | 497 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, |
446 | 0x01,0x14); | 498 | 0x01,0x14); |
447 | } else if (hdw->config == pvr2_config_mpeg) { | 499 | } else if (hdw->config == pvr2_config_mpeg) { |
448 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, | 500 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, |
449 | 0,0x13); | 501 | 0,0x13); |
450 | } else { | 502 | } else { |
451 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, | 503 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2, |
452 | 0,0x13); | 504 | 0,0x13); |
453 | } | 505 | } |
454 | if (!status) { | 506 | if (!status) { |
455 | hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_RUN); | 507 | hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_RUN); |
@@ -465,14 +517,14 @@ int pvr2_encoder_stop(struct pvr2_hdw *hdw) | |||
465 | pvr2_write_register(hdw, 0x0048, 0xffffffff); | 517 | pvr2_write_register(hdw, 0x0048, 0xffffffff); |
466 | 518 | ||
467 | if (hdw->config == pvr2_config_vbi) { | 519 | if (hdw->config == pvr2_config_vbi) { |
468 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, | 520 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, |
469 | 0x01,0x01,0x14); | 521 | 0x01,0x01,0x14); |
470 | } else if (hdw->config == pvr2_config_mpeg) { | 522 | } else if (hdw->config == pvr2_config_mpeg) { |
471 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, | 523 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, |
472 | 0x01,0,0x13); | 524 | 0x01,0,0x13); |
473 | } else { | 525 | } else { |
474 | status = pvr2_write_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, | 526 | status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3, |
475 | 0x01,0,0x13); | 527 | 0x01,0,0x13); |
476 | } | 528 | } |
477 | 529 | ||
478 | /* change some GPIO data */ | 530 | /* change some GPIO data */ |