aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-fileops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-fileops.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 1c404e454a36..5eb587592e9d 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -155,7 +155,7 @@ static void ivtv_dualwatch(struct ivtv *itv)
155 155
156 new_stereo_mode = itv->params.audio_properties & stereo_mask; 156 new_stereo_mode = itv->params.audio_properties & stereo_mask;
157 memset(&vt, 0, sizeof(vt)); 157 memset(&vt, 0, sizeof(vt));
158 ivtv_call_i2c_clients(itv, VIDIOC_G_TUNER, &vt); 158 ivtv_call_all(itv, tuner, g_tuner, &vt);
159 if (vt.audmode == V4L2_TUNER_MODE_LANG1_LANG2 && (vt.rxsubchans & V4L2_TUNER_SUB_LANG2)) 159 if (vt.audmode == V4L2_TUNER_MODE_LANG1_LANG2 && (vt.rxsubchans & V4L2_TUNER_SUB_LANG2))
160 new_stereo_mode = dual; 160 new_stereo_mode = dual;
161 161
@@ -857,7 +857,7 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
857 /* Mark that the radio is no longer in use */ 857 /* Mark that the radio is no longer in use */
858 clear_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); 858 clear_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
859 /* Switch tuner to TV */ 859 /* Switch tuner to TV */
860 ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); 860 ivtv_call_all(itv, tuner, s_std, itv->std);
861 /* Select correct audio input (i.e. TV tuner or Line in) */ 861 /* Select correct audio input (i.e. TV tuner or Line in) */
862 ivtv_audio_set_io(itv); 862 ivtv_audio_set_io(itv);
863 if (itv->hw_flags & IVTV_HW_SAA711X) 863 if (itv->hw_flags & IVTV_HW_SAA711X)
@@ -865,7 +865,7 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
865 struct v4l2_crystal_freq crystal_freq; 865 struct v4l2_crystal_freq crystal_freq;
866 crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; 866 crystal_freq.freq = SAA7115_FREQ_32_11_MHZ;
867 crystal_freq.flags = 0; 867 crystal_freq.flags = 0;
868 ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); 868 ivtv_call_hw(itv, IVTV_HW_SAA711X, video, s_crystal_freq, &crystal_freq);
869 } 869 }
870 if (atomic_read(&itv->capturing) > 0) { 870 if (atomic_read(&itv->capturing) > 0) {
871 /* Undo video mute */ 871 /* Undo video mute */
@@ -952,15 +952,14 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp)
952 /* We have the radio */ 952 /* We have the radio */
953 ivtv_mute(itv); 953 ivtv_mute(itv);
954 /* Switch tuner to radio */ 954 /* Switch tuner to radio */
955 ivtv_call_i2c_clients(itv, AUDC_SET_RADIO, NULL); 955 ivtv_call_all(itv, tuner, s_radio);
956 /* Select the correct audio input (i.e. radio tuner) */ 956 /* Select the correct audio input (i.e. radio tuner) */
957 ivtv_audio_set_io(itv); 957 ivtv_audio_set_io(itv);
958 if (itv->hw_flags & IVTV_HW_SAA711X) 958 if (itv->hw_flags & IVTV_HW_SAA711X) {
959 {
960 struct v4l2_crystal_freq crystal_freq; 959 struct v4l2_crystal_freq crystal_freq;
961 crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; 960 crystal_freq.freq = SAA7115_FREQ_32_11_MHZ;
962 crystal_freq.flags = SAA7115_FREQ_FL_APLL; 961 crystal_freq.flags = SAA7115_FREQ_FL_APLL;
963 ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); 962 ivtv_call_hw(itv, IVTV_HW_SAA711X, video, s_crystal_freq, &crystal_freq);
964 } 963 }
965 /* Done! Unmute and continue. */ 964 /* Done! Unmute and continue. */
966 ivtv_unmute(itv); 965 ivtv_unmute(itv);
@@ -981,37 +980,18 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp)
981 980
982int ivtv_v4l2_open(struct inode *inode, struct file *filp) 981int ivtv_v4l2_open(struct inode *inode, struct file *filp)
983{ 982{
984 int res, x, y = 0; 983 int res;
985 struct ivtv *itv = NULL; 984 struct ivtv *itv = NULL;
986 struct ivtv_stream *s = NULL; 985 struct ivtv_stream *s = NULL;
987 int minor = iminor(inode); 986 struct video_device *vdev = video_devdata(filp);
988
989 /* Find which card this open was on */
990 spin_lock(&ivtv_cards_lock);
991 for (x = 0; itv == NULL && x < ivtv_cards_active; x++) {
992 if (ivtv_cards[x] == NULL)
993 continue;
994 /* find out which stream this open was on */
995 for (y = 0; y < IVTV_MAX_STREAMS; y++) {
996 s = &ivtv_cards[x]->streams[y];
997 if (s->v4l2dev && s->v4l2dev->minor == minor) {
998 itv = ivtv_cards[x];
999 break;
1000 }
1001 }
1002 }
1003 spin_unlock(&ivtv_cards_lock);
1004 987
1005 if (itv == NULL) { 988 s = video_get_drvdata(vdev);
1006 /* Couldn't find a device registered 989 itv = s->itv;
1007 on that minor, shouldn't happen! */
1008 printk(KERN_WARNING "No ivtv device found on minor %d\n", minor);
1009 return -ENXIO;
1010 }
1011 990
1012 mutex_lock(&itv->serialize_lock); 991 mutex_lock(&itv->serialize_lock);
1013 if (ivtv_init_on_first_open(itv)) { 992 if (ivtv_init_on_first_open(itv)) {
1014 IVTV_ERR("Failed to initialize on minor %d\n", minor); 993 IVTV_ERR("Failed to initialize on minor %d\n",
994 s->v4l2dev->minor);
1015 mutex_unlock(&itv->serialize_lock); 995 mutex_unlock(&itv->serialize_lock);
1016 return -ENXIO; 996 return -ENXIO;
1017 } 997 }