aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorIan Armstrong <ian@iarmst.demon.co.uk>2010-05-23 21:27:49 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-06-01 00:24:35 -0400
commit666092c679f7d9eb9f5230087f960a487fda721c (patch)
tree8bb8944e41e86f89f82784168277df74c9c8b179 /drivers/media/video/ivtv
parentbd62307b20ff864c48541e46c3ee2bb9cc330f64 (diff)
V4L/DVB: ivtv: Timing tweaks and code re-order to try and improve stability
Added small delay on device open & close to allow hardware to settle. Move yuv register restore to before the decoder firmware call to stop playback. Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk> Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c11
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c7
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index abf410943cc9..3c2cc270ccd5 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -823,6 +823,12 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
823 823
824 IVTV_DEBUG_FILE("close() of %s\n", s->name); 824 IVTV_DEBUG_FILE("close() of %s\n", s->name);
825 825
826 if (id->type == IVTV_DEC_STREAM_TYPE_YUV &&
827 test_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags)) {
828 /* Restore registers we've changed & clean up any mess */
829 ivtv_yuv_close(itv);
830 }
831
826 /* Stop decoding */ 832 /* Stop decoding */
827 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { 833 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
828 IVTV_DEBUG_INFO("close stopping decode\n"); 834 IVTV_DEBUG_INFO("close stopping decode\n");
@@ -832,10 +838,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
832 } 838 }
833 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); 839 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
834 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); 840 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
835 if (id->type == IVTV_DEC_STREAM_TYPE_YUV && test_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags)) { 841
836 /* Restore registers we've changed & clean up any mess we've made */
837 ivtv_yuv_close(itv);
838 }
839 if (itv->output_mode == OUT_UDMA_YUV && id->yuv_frames) 842 if (itv->output_mode == OUT_UDMA_YUV && id->yuv_frames)
840 itv->output_mode = OUT_NONE; 843 itv->output_mode = OUT_NONE;
841 844
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 5441dc205966..9ecacab4b89b 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -670,6 +670,10 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
670 width, height, p->audio_properties)) { 670 width, height, p->audio_properties)) {
671 IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); 671 IVTV_DEBUG_WARN("Couldn't initialize decoder source\n");
672 } 672 }
673
674 /* Decoder sometimes dies here, so wait a moment */
675 ivtv_msleep_timeout(10, 0);
676
673 return 0; 677 return 0;
674} 678}
675 679
@@ -709,6 +713,9 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset)
709 /* start playback */ 713 /* start playback */
710 ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, gop_offset, 0); 714 ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, gop_offset, 0);
711 715
716 /* Let things settle before we actually start */
717 ivtv_msleep_timeout(10, 0);
718
712 /* Clear the following Interrupt mask bits for decoding */ 719 /* Clear the following Interrupt mask bits for decoding */
713 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_DECODE); 720 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_DECODE);
714 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);