aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-11-26 02:07:26 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 19:03:05 -0200
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 767e49022f9..7c47345501b 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 {
};
+struct routing_scheme {
+ const int *def;
+ unsigned int cnt;
+};
+
+
+static const int routing_scheme0[] = {
+ [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4,
+ /* In radio mode, we mute the video, but point at one
+ spot just to stay consistent */
+ [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5,
+ [PVR2_CVAL_INPUT_COMPOSITE] = SAA7115_COMPOSITE5,
+ [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2,
+};
+
+static const struct routing_scheme routing_schemes[] = {
+ [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
+ .def = routing_scheme0,
+ .cnt = ARRAY_SIZE(routing_scheme0),
+ },
+};
+
static void set_input(struct pvr2_v4l_decoder *ctxt)
{
struct pvr2_hdw *hdw = ctxt->hdw;
struct v4l2_routing route;
+ const struct routing_scheme *sp;
+ unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 set_input(%d)",hdw->input_val);
- switch(hdw->input_val) {
- case PVR2_CVAL_INPUT_TV:
- route.input = SAA7115_COMPOSITE4;
- break;
- case PVR2_CVAL_INPUT_COMPOSITE:
- route.input = SAA7115_COMPOSITE5;
- break;
- case PVR2_CVAL_INPUT_SVIDEO:
- route.input = SAA7115_SVIDEO2;
- break;
- case PVR2_CVAL_INPUT_RADIO:
- // In radio mode, we mute the video, but point at one
- // spot just to stay consistent
- route.input = SAA7115_COMPOSITE5;
- default:
+
+ if ((sid < ARRAY_SIZE(routing_schemes)) &&
+ ((sp = routing_schemes + sid) != 0) &&
+ (hdw->input_val >= 0) &&
+ (hdw->input_val < sp->cnt)) {
+ route.input = sp->def[hdw->input_val];
+ } else {
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS,
+ "*** WARNING *** i2c v4l2 set_input:"
+ " Invalid routing scheme (%u) and/or input (%d)",
+ sid,hdw->input_val);
return;
}
+
route.output = 0;
pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_S_VIDEO_ROUTING,&route);
}