aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-streams.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index de4288cc1889..9ecacab4b89b 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -618,12 +618,17 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
618 struct ivtv *itv = s->itv; 618 struct ivtv *itv = s->itv;
619 struct cx2341x_mpeg_params *p = &itv->params; 619 struct cx2341x_mpeg_params *p = &itv->params;
620 int datatype; 620 int datatype;
621 u16 width;
622 u16 height;
621 623
622 if (s->vdev == NULL) 624 if (s->vdev == NULL)
623 return -EINVAL; 625 return -EINVAL;
624 626
625 IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); 627 IVTV_DEBUG_INFO("Setting some initial decoder settings\n");
626 628
629 width = p->width;
630 height = p->height;
631
627 /* set audio mode to left/stereo for dual/stereo mode. */ 632 /* set audio mode to left/stereo for dual/stereo mode. */
628 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); 633 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
629 634
@@ -646,7 +651,14 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
646 2 = yuv_from_host */ 651 2 = yuv_from_host */
647 switch (s->type) { 652 switch (s->type) {
648 case IVTV_DEC_STREAM_TYPE_YUV: 653 case IVTV_DEC_STREAM_TYPE_YUV:
649 datatype = itv->output_mode == OUT_PASSTHROUGH ? 1 : 2; 654 if (itv->output_mode == OUT_PASSTHROUGH) {
655 datatype = 1;
656 } else {
657 /* Fake size to avoid switching video standard */
658 datatype = 2;
659 width = 720;
660 height = itv->is_out_50hz ? 576 : 480;
661 }
650 IVTV_DEBUG_INFO("Setup DEC YUV Stream data[0] = %d\n", datatype); 662 IVTV_DEBUG_INFO("Setup DEC YUV Stream data[0] = %d\n", datatype);
651 break; 663 break;
652 case IVTV_DEC_STREAM_TYPE_MPG: 664 case IVTV_DEC_STREAM_TYPE_MPG:
@@ -655,9 +667,13 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
655 break; 667 break;
656 } 668 }
657 if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, 669 if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype,
658 p->width, p->height, p->audio_properties)) { 670 width, height, p->audio_properties)) {
659 IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); 671 IVTV_DEBUG_WARN("Couldn't initialize decoder source\n");
660 } 672 }
673
674 /* Decoder sometimes dies here, so wait a moment */
675 ivtv_msleep_timeout(10, 0);
676
661 return 0; 677 return 0;
662} 678}
663 679
@@ -697,6 +713,9 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset)
697 /* start playback */ 713 /* start playback */
698 ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, gop_offset, 0); 714 ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, gop_offset, 0);
699 715
716 /* Let things settle before we actually start */
717 ivtv_msleep_timeout(10, 0);
718
700 /* Clear the following Interrupt mask bits for decoding */ 719 /* Clear the following Interrupt mask bits for decoding */
701 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_DECODE); 720 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_DECODE);
702 IVTV_DEBUG_IRQ("IRQ Mask is now: 0x%08x\n", itv->irqmask); 721 IVTV_DEBUG_IRQ("IRQ Mask is now: 0x%08x\n", itv->irqmask);