aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-06-20 13:55:31 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-23 02:15:13 -0400
commit81e804c9c2e38431c1c01165d06076776c6fcbd6 (patch)
treec8be43ea41c58f0ab583ac3df441fd401e7ff068 /drivers/media/video/pvrusb2
parent6f441ed78e28ea02940e58ffa89fbbc734ab6da3 (diff)
V4L/DVB (12121): pvrusb2: Improve handling of routing schemes
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>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-audio.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c24
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c24
4 files changed, 44 insertions, 32 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c
index 10ef1a2c13ea..416933ca607d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-audio.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c
@@ -48,11 +48,13 @@ static const int routing_scheme0[] = {
48 MSP_DSP_IN_SCART), 48 MSP_DSP_IN_SCART),
49}; 49};
50 50
51static const struct routing_scheme routing_schemes[] = { 51static const struct routing_scheme routing_def0 = {
52 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = { 52 .def = routing_scheme0,
53 .def = routing_scheme0, 53 .cnt = ARRAY_SIZE(routing_scheme0),
54 .cnt = ARRAY_SIZE(routing_scheme0), 54};
55 }, 55
56static const struct routing_scheme *routing_schemes[] = {
57 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
56}; 58};
57 59
58void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 60void 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)
65 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo"); 67 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo");
66 68
67 if ((sid < ARRAY_SIZE(routing_schemes)) && 69 if ((sid < ARRAY_SIZE(routing_schemes)) &&
68 ((sp = routing_schemes + sid) != NULL) && 70 ((sp = routing_schemes[sid]) != NULL) &&
69 (hdw->input_val >= 0) && 71 (hdw->input_val >= 0) &&
70 (hdw->input_val < sp->cnt)) { 72 (hdw->input_val < sp->cnt)) {
71 input = sp->def[hdw->input_val]; 73 input = sp->def[hdw->input_val];
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
index 9023adf3fdcc..41f6e009d5ef 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
@@ -49,11 +49,13 @@ static const int routing_scheme1[] = {
49 [PVR2_CVAL_INPUT_SVIDEO] = 0, 49 [PVR2_CVAL_INPUT_SVIDEO] = 0,
50}; 50};
51 51
52static const struct routing_scheme routing_schemes[] = { 52static const struct routing_scheme routing_def1 = {
53 [PVR2_ROUTING_SCHEME_ONAIR] = { 53 .def = routing_scheme1,
54 .def = routing_scheme1, 54 .cnt = ARRAY_SIZE(routing_scheme1),
55 .cnt = ARRAY_SIZE(routing_scheme1), 55};
56 }, 56
57static const struct routing_scheme *routing_schemes[] = {
58 [PVR2_ROUTING_SCHEME_ONAIR] = &routing_def1,
57}; 59};
58 60
59 61
@@ -66,7 +68,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
66 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", 68 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
67 hdw->input_val); 69 hdw->input_val);
68 if ((sid < ARRAY_SIZE(routing_schemes)) && 70 if ((sid < ARRAY_SIZE(routing_schemes)) &&
69 ((sp = routing_schemes + sid) != NULL) && 71 ((sp = routing_schemes[sid]) != NULL) &&
70 (hdw->input_val >= 0) && 72 (hdw->input_val >= 0) &&
71 (hdw->input_val < sp->cnt)) { 73 (hdw->input_val < sp->cnt)) {
72 input = sp->def[hdw->input_val]; 74 input = sp->def[hdw->input_val];
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 05e52358ae49..8710c6218aa8 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -68,6 +68,11 @@ static const struct routing_scheme_item routing_scheme0[] = {
68 }, 68 },
69}; 69};
70 70
71static const struct routing_scheme routing_def0 = {
72 .def = routing_scheme0,
73 .cnt = ARRAY_SIZE(routing_scheme0),
74};
75
71/* Specific to gotview device */ 76/* Specific to gotview device */
72static const struct routing_scheme_item routing_schemegv[] = { 77static const struct routing_scheme_item routing_schemegv[] = {
73 [PVR2_CVAL_INPUT_TV] = { 78 [PVR2_CVAL_INPUT_TV] = {
@@ -90,15 +95,14 @@ static const struct routing_scheme_item routing_schemegv[] = {
90 }, 95 },
91}; 96};
92 97
93static const struct routing_scheme routing_schemes[] = { 98static const struct routing_scheme routing_defgv = {
94 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = { 99 .def = routing_schemegv,
95 .def = routing_scheme0, 100 .cnt = ARRAY_SIZE(routing_schemegv),
96 .cnt = ARRAY_SIZE(routing_scheme0), 101};
97 }, 102
98 [PVR2_ROUTING_SCHEME_GOTVIEW] = { 103static const struct routing_scheme *routing_schemes[] = {
99 .def = routing_schemegv, 104 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
100 .cnt = ARRAY_SIZE(routing_schemegv), 105 [PVR2_ROUTING_SCHEME_GOTVIEW] = &routing_defgv,
101 },
102}; 106};
103 107
104void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 108void 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)
111 unsigned int sid = hdw->hdw_desc->signal_routing_scheme; 115 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
112 116
113 if ((sid < ARRAY_SIZE(routing_schemes)) && 117 if ((sid < ARRAY_SIZE(routing_schemes)) &&
114 ((sp = routing_schemes + sid) != NULL) && 118 ((sp = routing_schemes[sid]) != NULL) &&
115 (hdw->input_val >= 0) && 119 (hdw->input_val >= 0) &&
116 (hdw->input_val < sp->cnt)) { 120 (hdw->input_val < sp->cnt)) {
117 vid_input = sp->def[hdw->input_val].vid; 121 vid_input = sp->def[hdw->input_val].vid;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index d2fe7c8f2c3a..8c32288eebed 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
57static const struct routing_scheme routing_def0 = {
58 .def = routing_scheme0,
59 .cnt = ARRAY_SIZE(routing_scheme0),
60};
61
57static const int routing_scheme1[] = { 62static 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
64static const struct routing_scheme routing_schemes[] = { 69static 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] = { 74static 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
75void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 79void 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)
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 if ((sid < ARRAY_SIZE(routing_schemes)) &&
85 ((sp = routing_schemes + sid) != NULL) && 89 ((sp = routing_schemes[sid]) != NULL) &&
86 (hdw->input_val >= 0) && 90 (hdw->input_val >= 0) &&
87 (hdw->input_val < sp->cnt)) { 91 (hdw->input_val < sp->cnt)) {
88 input = sp->def[hdw->input_val]; 92 input = sp->def[hdw->input_val];