aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-fileops.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-08-18 10:46:05 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:05:31 -0400
commit3562c43be8cfd6e300508d7c33acebf3369eacd3 (patch)
tree3b2aab0d4e078ddf5445d2ab82eea2838bcf01ba /drivers/media/video/ivtv/ivtv-fileops.c
parentda80be21362376443c6ee9918dfff408e83e0c39 (diff)
V4L/DVB (6045): ivtv: fix handling of INITIALIZE_INPUT fw call
The CX2341X_ENC_INITIALIZE_INPUT firmware call requires careful handling, otherwise the computer can freeze or the top-third of the screen can start flickering. This patch ensures that CX2341X_ENC_INITIALIZE_INPUT is called at the right time and in the right way. In addition the stop capture handling was improved so that the last pending DMA transfer is also processed. Otherwise this would be the first data that arrived when a new capture was started which is not what you want. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-fileops.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 9e867b5229d..908e640c274 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -892,12 +892,20 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
892 return -EBUSY; 892 return -EBUSY;
893 } 893 }
894 894
895 if (!test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
896 if (atomic_read(&itv->capturing) > 0) {
897 /* switching to radio while capture is
898 in progress is not polite */
899 kfree(item);
900 return -EBUSY;
901 }
902 }
903 /* Mark that the radio is being used. */
904 set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
895 /* We have the radio */ 905 /* We have the radio */
896 ivtv_mute(itv); 906 ivtv_mute(itv);
897 /* Switch tuner to radio */ 907 /* Switch tuner to radio */
898 ivtv_call_i2c_clients(itv, AUDC_SET_RADIO, NULL); 908 ivtv_call_i2c_clients(itv, AUDC_SET_RADIO, NULL);
899 /* Mark that the radio is being used. */
900 set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
901 /* Select the correct audio input (i.e. radio tuner) */ 909 /* Select the correct audio input (i.e. radio tuner) */
902 ivtv_audio_set_io(itv); 910 ivtv_audio_set_io(itv);
903 if (itv->hw_flags & IVTV_HW_SAA711X) 911 if (itv->hw_flags & IVTV_HW_SAA711X)
@@ -931,13 +939,8 @@ void ivtv_mute(struct ivtv *itv)
931 939
932void ivtv_unmute(struct ivtv *itv) 940void ivtv_unmute(struct ivtv *itv)
933{ 941{
934 /* initialize or refresh input */
935 if (atomic_read(&itv->capturing) == 0)
936 ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);
937
938 ivtv_msleep_timeout(100, 0);
939
940 if (atomic_read(&itv->capturing)) { 942 if (atomic_read(&itv->capturing)) {
943 ivtv_msleep_timeout(100, 0);
941 ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12); 944 ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12);
942 ivtv_vapi(itv, CX2341X_ENC_MUTE_AUDIO, 1, 0); 945 ivtv_vapi(itv, CX2341X_ENC_MUTE_AUDIO, 1, 0);
943 } 946 }