diff options
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 4ca9d847f1b1..1b921a336092 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -36,12 +36,13 @@ | |||
36 | #define CX18_DSP0_INTERRUPT_MASK 0xd0004C | 36 | #define CX18_DSP0_INTERRUPT_MASK 0xd0004C |
37 | 37 | ||
38 | static struct file_operations cx18_v4l2_enc_fops = { | 38 | static struct file_operations cx18_v4l2_enc_fops = { |
39 | .owner = THIS_MODULE, | 39 | .owner = THIS_MODULE, |
40 | .read = cx18_v4l2_read, | 40 | .read = cx18_v4l2_read, |
41 | .open = cx18_v4l2_open, | 41 | .open = cx18_v4l2_open, |
42 | .ioctl = cx18_v4l2_ioctl, | 42 | .ioctl = cx18_v4l2_ioctl, |
43 | .release = cx18_v4l2_close, | 43 | .compat_ioctl = v4l_compat_ioctl32, |
44 | .poll = cx18_v4l2_enc_poll, | 44 | .release = cx18_v4l2_close, |
45 | .poll = cx18_v4l2_enc_poll, | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | /* offset from 0 to register ts v4l2 minors on */ | 48 | /* offset from 0 to register ts v4l2 minors on */ |
@@ -443,7 +444,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
443 | s->handle = data[0]; | 444 | s->handle = data[0]; |
444 | cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); | 445 | cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); |
445 | 446 | ||
446 | if (atomic_read(&cx->capturing) == 0 && !ts) { | 447 | if (atomic_read(&cx->ana_capturing) == 0 && !ts) { |
447 | /* Stuff from Windows, we don't know what it is */ | 448 | /* Stuff from Windows, we don't know what it is */ |
448 | cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); | 449 | cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); |
449 | cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); | 450 | cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); |
@@ -466,14 +467,14 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
466 | cx2341x_update(cx, cx18_api_func, NULL, &cx->params); | 467 | cx2341x_update(cx, cx18_api_func, NULL, &cx->params); |
467 | } | 468 | } |
468 | 469 | ||
469 | if (atomic_read(&cx->capturing) == 0) { | 470 | if (atomic_read(&cx->tot_capturing) == 0) { |
470 | clear_bit(CX18_F_I_EOS, &cx->i_flags); | 471 | clear_bit(CX18_F_I_EOS, &cx->i_flags); |
471 | write_reg(7, CX18_DSP0_INTERRUPT_MASK); | 472 | write_reg(7, CX18_DSP0_INTERRUPT_MASK); |
472 | } | 473 | } |
473 | 474 | ||
474 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle, | 475 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle, |
475 | (void *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem, | 476 | (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem, |
476 | (void *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem); | 477 | (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem); |
477 | 478 | ||
478 | list_for_each(p, &s->q_free.list) { | 479 | list_for_each(p, &s->q_free.list) { |
479 | struct cx18_buffer *buf = list_entry(p, struct cx18_buffer, list); | 480 | struct cx18_buffer *buf = list_entry(p, struct cx18_buffer, list); |
@@ -481,8 +482,8 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
481 | writel(buf->dma_handle, &cx->scb->cpu_mdl[buf->id].paddr); | 482 | writel(buf->dma_handle, &cx->scb->cpu_mdl[buf->id].paddr); |
482 | writel(s->buf_size, &cx->scb->cpu_mdl[buf->id].length); | 483 | writel(s->buf_size, &cx->scb->cpu_mdl[buf->id].length); |
483 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, | 484 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, |
484 | (void *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, 1, | 485 | (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, |
485 | buf->id, s->buf_size); | 486 | 1, buf->id, s->buf_size); |
486 | } | 487 | } |
487 | /* begin_capture */ | 488 | /* begin_capture */ |
488 | if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { | 489 | if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { |
@@ -492,7 +493,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
492 | } | 493 | } |
493 | 494 | ||
494 | /* you're live! sit back and await interrupts :) */ | 495 | /* you're live! sit back and await interrupts :) */ |
495 | atomic_inc(&cx->capturing); | 496 | if (!ts) |
497 | atomic_inc(&cx->ana_capturing); | ||
498 | atomic_inc(&cx->tot_capturing); | ||
496 | return 0; | 499 | return 0; |
497 | } | 500 | } |
498 | 501 | ||
@@ -523,7 +526,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) | |||
523 | 526 | ||
524 | CX18_DEBUG_INFO("Stop Capture\n"); | 527 | CX18_DEBUG_INFO("Stop Capture\n"); |
525 | 528 | ||
526 | if (atomic_read(&cx->capturing) == 0) | 529 | if (atomic_read(&cx->tot_capturing) == 0) |
527 | return 0; | 530 | return 0; |
528 | 531 | ||
529 | if (s->type == CX18_ENC_STREAM_TYPE_MPG) | 532 | if (s->type == CX18_ENC_STREAM_TYPE_MPG) |
@@ -537,7 +540,9 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) | |||
537 | CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); | 540 | CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); |
538 | } | 541 | } |
539 | 542 | ||
540 | atomic_dec(&cx->capturing); | 543 | if (s->type != CX18_ENC_STREAM_TYPE_TS) |
544 | atomic_dec(&cx->ana_capturing); | ||
545 | atomic_dec(&cx->tot_capturing); | ||
541 | 546 | ||
542 | /* Clear capture and no-read bits */ | 547 | /* Clear capture and no-read bits */ |
543 | clear_bit(CX18_F_S_STREAMING, &s->s_flags); | 548 | clear_bit(CX18_F_S_STREAMING, &s->s_flags); |
@@ -545,7 +550,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) | |||
545 | cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); | 550 | cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); |
546 | s->handle = 0xffffffff; | 551 | s->handle = 0xffffffff; |
547 | 552 | ||
548 | if (atomic_read(&cx->capturing) > 0) | 553 | if (atomic_read(&cx->tot_capturing) > 0) |
549 | return 0; | 554 | return 0; |
550 | 555 | ||
551 | write_reg(5, CX18_DSP0_INTERRUPT_MASK); | 556 | write_reg(5, CX18_DSP0_INTERRUPT_MASK); |