From 66a17879e9f18a38c4ca5e6ba600a3f5b1b51188 Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Tue, 26 Jun 2007 16:35:30 -0300 Subject: V4L/DVB (5826): Usbvision: video mux cleanup - usbvision_muxsel simplified, now uses some well known constants. - since the decoder needs to change input norm, call to muxsel added when changing video standard. Signed-off-by: Thierry MERLE Acked-by: Dwaine Garden Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/usbvision/usbvision-core.c | 33 +++++++++++-------------- drivers/media/video/usbvision/usbvision-video.c | 5 ++-- drivers/media/video/usbvision/usbvision.h | 1 - 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index 0127be9..5b1e346 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c @@ -2537,7 +2537,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) { - int mode[4]; + /* inputs #0 and #3 are constant for every SAA711x. */ + /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */ + int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3}; int audio[]= {1, 0, 0, 0}; struct v4l2_routing route; //channel 0 is TV with audiochannel 1 (tuner mono) @@ -2547,10 +2549,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); usbvision->ctl_input = channel; - route.input = SAA7115_COMPOSITE1; - route.output = 0; - call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); - call_i2c_clients(usbvision, VIDIOC_S_INPUT, &usbvision->ctl_input); // set the new channel // Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video @@ -2558,28 +2556,27 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) switch (usbvision_device_data[usbvision->DevModel].Codec) { case CODEC_SAA7113: - if (SwitchSVideoInput) { // To handle problems with S-Video Input for some devices. Use SwitchSVideoInput parameter when loading the module. - mode[2] = 1; + mode[1] = SAA7115_COMPOSITE2; + if (SwitchSVideoInput) { + /* To handle problems with S-Video Input for + * some devices. Use SwitchSVideoInput + * parameter when loading the module.*/ + mode[2] = SAA7115_COMPOSITE1; } else { - mode[2] = 7; - } - if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { - mode[0] = 0; mode[1] = 2; mode[3] = 3; // Special for four input devices - } - else { - mode[0] = 0; mode[1] = 2; //modes for regular saa7113 devices + mode[2] = SAA7115_SVIDEO1; } break; case CODEC_SAA7111: - mode[0] = 0; mode[1] = 1; mode[2] = 7; //modes for saa7111 - break; default: - mode[0] = 0; mode[1] = 1; mode[2] = 7; //default modes + /* modes for saa7111 */ + mode[1] = SAA7115_COMPOSITE1; + mode[2] = SAA7115_SVIDEO1; + break; } route.input = mode[channel]; + route.output = 0; call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); - usbvision->channel = channel; usbvision_set_audio(usbvision, audio[channel]); return 0; } diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 8d53c8a..868b688 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -637,10 +637,9 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input) if ((input >= usbvision->video_inputs) || (input < 0) ) return -EINVAL; - usbvision->ctl_input = input; down(&usbvision->lock); - usbvision_muxsel(usbvision, usbvision->ctl_input); + usbvision_muxsel(usbvision, input); usbvision_set_input(usbvision); usbvision_set_output(usbvision, usbvision->curwidth, @@ -660,6 +659,8 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id) call_i2c_clients(usbvision, VIDIOC_S_STD, &usbvision->tvnormId); up(&usbvision->lock); + /* propagate the change to the decoder */ + usbvision_muxsel(usbvision, usbvision->ctl_input); return 0; } diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index 7e6cc8e..c5b6c50 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h @@ -380,7 +380,6 @@ struct usb_usbvision { int tuner_type; int tuner_addr; int bridgeType; // NT1003, NT1004, NT1005 - int channel; int radio; int video_inputs; // # of inputs unsigned long freq; -- cgit v1.1