diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-fileops.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 19 |
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 9e867b5229d1..908e640c274d 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 | ||
932 | void ivtv_unmute(struct ivtv *itv) | 940 | void 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 | } |