diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-video-v4l.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index d2fe7c8f2c3a..4c96cf48c796 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | |||
@@ -54,6 +54,11 @@ static const int routing_scheme0[] = { | |||
54 | [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, | 54 | [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static const struct routing_scheme routing_def0 = { | ||
58 | .def = routing_scheme0, | ||
59 | .cnt = ARRAY_SIZE(routing_scheme0), | ||
60 | }; | ||
61 | |||
57 | static const int routing_scheme1[] = { | 62 | static const int routing_scheme1[] = { |
58 | [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4, | 63 | [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4, |
59 | [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5, | 64 | [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5, |
@@ -61,15 +66,14 @@ static const int routing_scheme1[] = { | |||
61 | [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, /* or SVIDEO0, it seems */ | 66 | [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, /* or SVIDEO0, it seems */ |
62 | }; | 67 | }; |
63 | 68 | ||
64 | static const struct routing_scheme routing_schemes[] = { | 69 | static const struct routing_scheme routing_def1 = { |
65 | [PVR2_ROUTING_SCHEME_HAUPPAUGE] = { | 70 | .def = routing_scheme1, |
66 | .def = routing_scheme0, | 71 | .cnt = ARRAY_SIZE(routing_scheme1), |
67 | .cnt = ARRAY_SIZE(routing_scheme0), | 72 | }; |
68 | }, | 73 | |
69 | [PVR2_ROUTING_SCHEME_ONAIR] = { | 74 | static const struct routing_scheme *routing_schemes[] = { |
70 | .def = routing_scheme1, | 75 | [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0, |
71 | .cnt = ARRAY_SIZE(routing_scheme1), | 76 | [PVR2_ROUTING_SCHEME_ONAIR] = &routing_def1, |
72 | }, | ||
73 | }; | 77 | }; |
74 | 78 | ||
75 | void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | 79 | void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) |
@@ -81,12 +85,12 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
81 | 85 | ||
82 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", | 86 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", |
83 | hdw->input_val); | 87 | hdw->input_val); |
84 | if ((sid < ARRAY_SIZE(routing_schemes)) && | 88 | |
85 | ((sp = routing_schemes + sid) != NULL) && | 89 | sp = (sid < ARRAY_SIZE(routing_schemes)) ? |
86 | (hdw->input_val >= 0) && | 90 | routing_schemes[sid] : NULL; |
87 | (hdw->input_val < sp->cnt)) { | 91 | if ((sp == NULL) || |
88 | input = sp->def[hdw->input_val]; | 92 | (hdw->input_val < 0) || |
89 | } else { | 93 | (hdw->input_val >= sp->cnt)) { |
90 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 94 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
91 | "*** WARNING *** subdev v4l2 set_input:" | 95 | "*** WARNING *** subdev v4l2 set_input:" |
92 | " Invalid routing scheme (%u)" | 96 | " Invalid routing scheme (%u)" |
@@ -94,6 +98,7 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
94 | sid, hdw->input_val); | 98 | sid, hdw->input_val); |
95 | return; | 99 | return; |
96 | } | 100 | } |
101 | input = sp->def[hdw->input_val]; | ||
97 | sd->ops->video->s_routing(sd, input, 0, 0); | 102 | sd->ops->video->s_routing(sd, input, 0, 0); |
98 | } | 103 | } |
99 | } | 104 | } |