Commit 66a17879 authored by Thierry MERLE's avatar Thierry MERLE Committed by Mauro Carvalho Chehab

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: default avatarThierry MERLE <thierry.merle@free.fr>
Acked-by: default avatarDwaine Garden <DwaineGarden@rogers.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent ffddcaa6
...@@ -2537,7 +2537,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) ...@@ -2537,7 +2537,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) 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}; int audio[]= {1, 0, 0, 0};
struct v4l2_routing route; struct v4l2_routing route;
//channel 0 is TV with audiochannel 1 (tuner mono) //channel 0 is TV with audiochannel 1 (tuner mono)
...@@ -2547,10 +2549,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) ...@@ -2547,10 +2549,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs);
usbvision->ctl_input = channel; 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 // set the new channel
// Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video // 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) ...@@ -2558,28 +2556,27 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
switch (usbvision_device_data[usbvision->DevModel].Codec) { switch (usbvision_device_data[usbvision->DevModel].Codec) {
case CODEC_SAA7113: case CODEC_SAA7113:
if (SwitchSVideoInput) { // To handle problems with S-Video Input for some devices. Use SwitchSVideoInput parameter when loading the module. mode[1] = SAA7115_COMPOSITE2;
mode[2] = 1; if (SwitchSVideoInput) {
/* To handle problems with S-Video Input for
* some devices. Use SwitchSVideoInput
* parameter when loading the module.*/
mode[2] = SAA7115_COMPOSITE1;
} }
else { else {
mode[2] = 7; mode[2] = SAA7115_SVIDEO1;
}
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
} }
break; break;
case CODEC_SAA7111: case CODEC_SAA7111:
mode[0] = 0; mode[1] = 1; mode[2] = 7; //modes for saa7111
break;
default: 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.input = mode[channel];
route.output = 0;
call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route);
usbvision->channel = channel;
usbvision_set_audio(usbvision, audio[channel]); usbvision_set_audio(usbvision, audio[channel]);
return 0; return 0;
} }
......
...@@ -637,10 +637,9 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input) ...@@ -637,10 +637,9 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input)
if ((input >= usbvision->video_inputs) || (input < 0) ) if ((input >= usbvision->video_inputs) || (input < 0) )
return -EINVAL; return -EINVAL;
usbvision->ctl_input = input;
down(&usbvision->lock); down(&usbvision->lock);
usbvision_muxsel(usbvision, usbvision->ctl_input); usbvision_muxsel(usbvision, input);
usbvision_set_input(usbvision); usbvision_set_input(usbvision);
usbvision_set_output(usbvision, usbvision_set_output(usbvision,
usbvision->curwidth, usbvision->curwidth,
...@@ -660,6 +659,8 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id) ...@@ -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, call_i2c_clients(usbvision, VIDIOC_S_STD,
&usbvision->tvnormId); &usbvision->tvnormId);
up(&usbvision->lock); up(&usbvision->lock);
/* propagate the change to the decoder */
usbvision_muxsel(usbvision, usbvision->ctl_input);
return 0; return 0;
} }
......
...@@ -380,7 +380,6 @@ struct usb_usbvision { ...@@ -380,7 +380,6 @@ struct usb_usbvision {
int tuner_type; int tuner_type;
int tuner_addr; int tuner_addr;
int bridgeType; // NT1003, NT1004, NT1005 int bridgeType; // NT1003, NT1004, NT1005
int channel;
int radio; int radio;
int video_inputs; // # of inputs int video_inputs; // # of inputs
unsigned long freq; unsigned long freq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment