aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-11-26 00:07:26 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:05 -0500
commitf5174af201f2e22c101bb02d06343e4bc5f056de (patch)
treea13e51ad387953b17f11360a5cb89d8abc0ea551 /drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
parentaaf7884db395332ae8474f3ea5bcdd39c0a941ea (diff)
V4L/DVB (6698): pvrusb2: Implement signal routing schemes
The exact routing of video and audio signals within a device is a device-specific attribute. Hauppauge devices do it one way; other types of device may route things differently. Unfortunately it is rather impractical to define chip-specific routing at the device attribute level, so instead what happens here is that "schemes" are defined. Each chip level interface implements its part of a given scheme and the scheme as a whole is made into a device specific attribute controlled via a table entry in pvrusb2-devattr.c. The only scheme defined here is for Hauppauge devices, but clearly this opens the door for other possibilities to follow. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-video-v4l.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index 767e49022f9b..7c47345501b6 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
@@ -49,29 +49,50 @@ struct pvr2_v4l_decoder {
49}; 49};
50 50
51 51
52struct routing_scheme {
53 const int *def;
54 unsigned int cnt;
55};
56
57
58static const int routing_scheme0[] = {
59 [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4,
60 /* In radio mode, we mute the video, but point at one
61 spot just to stay consistent */
62 [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5,
63 [PVR2_CVAL_INPUT_COMPOSITE] = SAA7115_COMPOSITE5,
64 [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2,
65};
66
67static const struct routing_scheme routing_schemes[] = {
68 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
69 .def = routing_scheme0,
70 .cnt = ARRAY_SIZE(routing_scheme0),
71 },
72};
73
52static void set_input(struct pvr2_v4l_decoder *ctxt) 74static void set_input(struct pvr2_v4l_decoder *ctxt)
53{ 75{
54 struct pvr2_hdw *hdw = ctxt->hdw; 76 struct pvr2_hdw *hdw = ctxt->hdw;
55 struct v4l2_routing route; 77 struct v4l2_routing route;
78 const struct routing_scheme *sp;
79 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
56 80
57 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 set_input(%d)",hdw->input_val); 81 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 set_input(%d)",hdw->input_val);
58 switch(hdw->input_val) { 82
59 case PVR2_CVAL_INPUT_TV: 83 if ((sid < ARRAY_SIZE(routing_schemes)) &&
60 route.input = SAA7115_COMPOSITE4; 84 ((sp = routing_schemes + sid) != 0) &&
61 break; 85 (hdw->input_val >= 0) &&
62 case PVR2_CVAL_INPUT_COMPOSITE: 86 (hdw->input_val < sp->cnt)) {
63 route.input = SAA7115_COMPOSITE5; 87 route.input = sp->def[hdw->input_val];
64 break; 88 } else {
65 case PVR2_CVAL_INPUT_SVIDEO: 89 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
66 route.input = SAA7115_SVIDEO2; 90 "*** WARNING *** i2c v4l2 set_input:"
67 break; 91 " Invalid routing scheme (%u) and/or input (%d)",
68 case PVR2_CVAL_INPUT_RADIO: 92 sid,hdw->input_val);
69 // In radio mode, we mute the video, but point at one
70 // spot just to stay consistent
71 route.input = SAA7115_COMPOSITE5;
72 default:
73 return; 93 return;
74 } 94 }
95
75 route.output = 0; 96 route.output = 0;
76 pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_S_VIDEO_ROUTING,&route); 97 pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_S_VIDEO_ROUTING,&route);
77} 98}