]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB (12121): pvrusb2: Improve handling of routing schemes
authorMike Isely <isely@pobox.com>
Sat, 20 Jun 2009 17:55:31 +0000 (14:55 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 23 Jun 2009 06:15:13 +0000 (03:15 -0300)
The pvrusb2 driver has a concept of "routing scheme" which defines
which physical inputs should be connected based on application's
choice of logical input.  The correct "routing scheme" depends on the
specific device since different devices might wire up their muxes

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/pvrusb2/pvrusb2-audio.c
drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
drivers/media/video/pvrusb2/pvrusb2-video-v4l.c

index 10ef1a2c13eac39adbff08bed37d1c4daa0390e6..416933ca607d28ac6a500907d9e6282399c6775b 100644 (file)
@@ -48,11 +48,13 @@ static const int routing_scheme0[] = {
                                                MSP_DSP_IN_SCART),
 };
 
-static const struct routing_scheme routing_schemes[] = {
-       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
-               .def = routing_scheme0,
-               .cnt = ARRAY_SIZE(routing_scheme0),
-       },
+static const struct routing_scheme routing_def0 = {
+       .def = routing_scheme0,
+       .cnt = ARRAY_SIZE(routing_scheme0),
+};
+
+static const struct routing_scheme *routing_schemes[] = {
+       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
 };
 
 void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
@@ -65,7 +67,7 @@ void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
                pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo");
 
                if ((sid < ARRAY_SIZE(routing_schemes)) &&
-                   ((sp = routing_schemes + sid) != NULL) &&
+                   ((sp = routing_schemes[sid]) != NULL) &&
                    (hdw->input_val >= 0) &&
                    (hdw->input_val < sp->cnt)) {
                        input = sp->def[hdw->input_val];
index 9023adf3fdcc5f587e64db693d683e65703e895c..41f6e009d5ef52e8f968e4e112640a3c4f8f8e66 100644 (file)
@@ -49,11 +49,13 @@ static const int routing_scheme1[] = {
        [PVR2_CVAL_INPUT_SVIDEO] =  0,
 };
 
-static const struct routing_scheme routing_schemes[] = {
-       [PVR2_ROUTING_SCHEME_ONAIR] = {
-               .def = routing_scheme1,
-               .cnt = ARRAY_SIZE(routing_scheme1),
-       },
+static const struct routing_scheme routing_def1 = {
+       .def = routing_scheme1,
+       .cnt = ARRAY_SIZE(routing_scheme1),
+};
+
+static const struct routing_scheme *routing_schemes[] = {
+       [PVR2_ROUTING_SCHEME_ONAIR] = &routing_def1,
 };
 
 
@@ -66,7 +68,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
                pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
                           hdw->input_val);
                if ((sid < ARRAY_SIZE(routing_schemes)) &&
-                   ((sp = routing_schemes + sid) != NULL) &&
+                   ((sp = routing_schemes[sid]) != NULL) &&
                    (hdw->input_val >= 0) &&
                    (hdw->input_val < sp->cnt)) {
                        input = sp->def[hdw->input_val];
index 05e52358ae495a121c94c6722e8f536b5d418eb4..8710c6218aa8e53a5f837ff194f9464ab41e688e 100644 (file)
@@ -68,6 +68,11 @@ static const struct routing_scheme_item routing_scheme0[] = {
        },
 };
 
+static const struct routing_scheme routing_def0 = {
+       .def = routing_scheme0,
+       .cnt = ARRAY_SIZE(routing_scheme0),
+};
+
 /* Specific to gotview device */
 static const struct routing_scheme_item routing_schemegv[] = {
        [PVR2_CVAL_INPUT_TV] = {
@@ -90,15 +95,14 @@ static const struct routing_scheme_item routing_schemegv[] = {
        },
 };
 
-static const struct routing_scheme routing_schemes[] = {
-       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
-               .def = routing_scheme0,
-               .cnt = ARRAY_SIZE(routing_scheme0),
-       },
-       [PVR2_ROUTING_SCHEME_GOTVIEW] = {
-               .def = routing_schemegv,
-               .cnt = ARRAY_SIZE(routing_schemegv),
-       },
+static const struct routing_scheme routing_defgv = {
+       .def = routing_schemegv,
+       .cnt = ARRAY_SIZE(routing_schemegv),
+};
+
+static const struct routing_scheme *routing_schemes[] = {
+       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
+       [PVR2_ROUTING_SCHEME_GOTVIEW] = &routing_defgv,
 };
 
 void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
@@ -111,7 +115,7 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
                unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
 
                if ((sid < ARRAY_SIZE(routing_schemes)) &&
-                   ((sp = routing_schemes + sid) != NULL) &&
+                   ((sp = routing_schemes[sid]) != NULL) &&
                    (hdw->input_val >= 0) &&
                    (hdw->input_val < sp->cnt)) {
                        vid_input = sp->def[hdw->input_val].vid;
index d2fe7c8f2c3a2cb7b6aafe42dfb8fcc46308e024..8c32288eebed45add98b5afb336a735b536b909d 100644 (file)
@@ -54,6 +54,11 @@ static const int routing_scheme0[] = {
        [PVR2_CVAL_INPUT_SVIDEO] =  SAA7115_SVIDEO2,
 };
 
+static const struct routing_scheme routing_def0 = {
+       .def = routing_scheme0,
+       .cnt = ARRAY_SIZE(routing_scheme0),
+};
+
 static const int routing_scheme1[] = {
        [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4,
        [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5,
@@ -61,15 +66,14 @@ static const int routing_scheme1[] = {
        [PVR2_CVAL_INPUT_SVIDEO] =  SAA7115_SVIDEO2, /* or SVIDEO0, it seems */
 };
 
-static const struct routing_scheme routing_schemes[] = {
-       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
-               .def = routing_scheme0,
-               .cnt = ARRAY_SIZE(routing_scheme0),
-       },
-       [PVR2_ROUTING_SCHEME_ONAIR] = {
-               .def = routing_scheme1,
-               .cnt = ARRAY_SIZE(routing_scheme1),
-       },
+static const struct routing_scheme routing_def1 = {
+       .def = routing_scheme1,
+       .cnt = ARRAY_SIZE(routing_scheme1),
+};
+
+static const struct routing_scheme *routing_schemes[] = {
+       [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
+       [PVR2_ROUTING_SCHEME_ONAIR] = &routing_def1,
 };
 
 void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
@@ -82,7 +86,7 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
                pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
                           hdw->input_val);
                if ((sid < ARRAY_SIZE(routing_schemes)) &&
-                   ((sp = routing_schemes + sid) != NULL) &&
+                   ((sp = routing_schemes[sid]) != NULL) &&
                    (hdw->input_val >= 0) &&
                    (hdw->input_val < sp->cnt)) {
                        input = sp->def[hdw->input_val];