aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision
diff options
context:
space:
mode:
authorThierry MERLE <thierry.merle@free.fr>2007-06-26 15:35:30 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:38 -0400
commit66a17879e9f18a38c4ca5e6ba600a3f5b1b51188 (patch)
tree997268472ae3f4bc608106247e16dabf542c30e3 /drivers/media/video/usbvision
parentffddcaa6ec4e85ed8504deac1f51f44c86ec1d23 (diff)
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 <thierry.merle@free.fr> Acked-by: Dwaine Garden <DwaineGarden@rogers.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision')
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c33
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c5
-rw-r--r--drivers/media/video/usbvision/usbvision.h1
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 0127be9c2549..5b1e346df206 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)
2537 2537
2538int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) 2538int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
2539{ 2539{
2540 int mode[4]; 2540 /* inputs #0 and #3 are constant for every SAA711x. */
2541 /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */
2542 int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3};
2541 int audio[]= {1, 0, 0, 0}; 2543 int audio[]= {1, 0, 0, 0};
2542 struct v4l2_routing route; 2544 struct v4l2_routing route;
2543 //channel 0 is TV with audiochannel 1 (tuner mono) 2545 //channel 0 is TV with audiochannel 1 (tuner mono)
@@ -2547,10 +2549,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
2547 2549
2548 RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); 2550 RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs);
2549 usbvision->ctl_input = channel; 2551 usbvision->ctl_input = channel;
2550 route.input = SAA7115_COMPOSITE1;
2551 route.output = 0;
2552 call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route);
2553 call_i2c_clients(usbvision, VIDIOC_S_INPUT, &usbvision->ctl_input);
2554 2552
2555 // set the new channel 2553 // set the new channel
2556 // Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video 2554 // 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 2556
2559 switch (usbvision_device_data[usbvision->DevModel].Codec) { 2557 switch (usbvision_device_data[usbvision->DevModel].Codec) {
2560 case CODEC_SAA7113: 2558 case CODEC_SAA7113:
2561 if (SwitchSVideoInput) { // To handle problems with S-Video Input for some devices. Use SwitchSVideoInput parameter when loading the module. 2559 mode[1] = SAA7115_COMPOSITE2;
2562 mode[2] = 1; 2560 if (SwitchSVideoInput) {
2561 /* To handle problems with S-Video Input for
2562 * some devices. Use SwitchSVideoInput
2563 * parameter when loading the module.*/
2564 mode[2] = SAA7115_COMPOSITE1;
2563 } 2565 }
2564 else { 2566 else {
2565 mode[2] = 7; 2567 mode[2] = SAA7115_SVIDEO1;
2566 }
2567 if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) {
2568 mode[0] = 0; mode[1] = 2; mode[3] = 3; // Special for four input devices
2569 }
2570 else {
2571 mode[0] = 0; mode[1] = 2; //modes for regular saa7113 devices
2572 } 2568 }
2573 break; 2569 break;
2574 case CODEC_SAA7111: 2570 case CODEC_SAA7111:
2575 mode[0] = 0; mode[1] = 1; mode[2] = 7; //modes for saa7111
2576 break;
2577 default: 2571 default:
2578 mode[0] = 0; mode[1] = 1; mode[2] = 7; //default modes 2572 /* modes for saa7111 */
2573 mode[1] = SAA7115_COMPOSITE1;
2574 mode[2] = SAA7115_SVIDEO1;
2575 break;
2579 } 2576 }
2580 route.input = mode[channel]; 2577 route.input = mode[channel];
2578 route.output = 0;
2581 call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); 2579 call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route);
2582 usbvision->channel = channel;
2583 usbvision_set_audio(usbvision, audio[channel]); 2580 usbvision_set_audio(usbvision, audio[channel]);
2584 return 0; 2581 return 0;
2585} 2582}
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 8d53c8a2bb2b..868b6886fe7f 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)
637 637
638 if ((input >= usbvision->video_inputs) || (input < 0) ) 638 if ((input >= usbvision->video_inputs) || (input < 0) )
639 return -EINVAL; 639 return -EINVAL;
640 usbvision->ctl_input = input;
641 640
642 down(&usbvision->lock); 641 down(&usbvision->lock);
643 usbvision_muxsel(usbvision, usbvision->ctl_input); 642 usbvision_muxsel(usbvision, input);
644 usbvision_set_input(usbvision); 643 usbvision_set_input(usbvision);
645 usbvision_set_output(usbvision, 644 usbvision_set_output(usbvision,
646 usbvision->curwidth, 645 usbvision->curwidth,
@@ -660,6 +659,8 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id)
660 call_i2c_clients(usbvision, VIDIOC_S_STD, 659 call_i2c_clients(usbvision, VIDIOC_S_STD,
661 &usbvision->tvnormId); 660 &usbvision->tvnormId);
662 up(&usbvision->lock); 661 up(&usbvision->lock);
662 /* propagate the change to the decoder */
663 usbvision_muxsel(usbvision, usbvision->ctl_input);
663 664
664 return 0; 665 return 0;
665} 666}
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h
index 7e6cc8e09cc4..c5b6c501c869 100644
--- a/drivers/media/video/usbvision/usbvision.h
+++ b/drivers/media/video/usbvision/usbvision.h
@@ -380,7 +380,6 @@ struct usb_usbvision {
380 int tuner_type; 380 int tuner_type;
381 int tuner_addr; 381 int tuner_addr;
382 int bridgeType; // NT1003, NT1004, NT1005 382 int bridgeType; // NT1003, NT1004, NT1005
383 int channel;
384 int radio; 383 int radio;
385 int video_inputs; // # of inputs 384 int video_inputs; // # of inputs
386 unsigned long freq; 385 unsigned long freq;