aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
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.c24
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c37
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c60
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c35
5 files changed, 95 insertions, 75 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..68980e19409f 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
@@ -65,12 +67,11 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
65 u32 input; 67 u32 input;
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 sp = (sid < ARRAY_SIZE(routing_schemes)) ?
69 ((sp = routing_schemes + sid) != NULL) && 71 routing_schemes[sid] : NULL;
70 (hdw->input_val >= 0) && 72 if ((sp == NULL) ||
71 (hdw->input_val < sp->cnt)) { 73 (hdw->input_val < 0) ||
72 input = sp->def[hdw->input_val]; 74 (hdw->input_val >= sp->cnt)) {
73 } else {
74 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 75 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
75 "*** WARNING *** subdev v4l2 set_input:" 76 "*** WARNING *** subdev v4l2 set_input:"
76 " Invalid routing scheme (%u)" 77 " Invalid routing scheme (%u)"
@@ -78,6 +79,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
78 sid, hdw->input_val); 79 sid, hdw->input_val);
79 return; 80 return;
80 } 81 }
82 input = sp->def[hdw->input_val];
81 sd->ops->audio->s_routing(sd, input, 0, 0); 83 sd->ops->audio->s_routing(sd, input, 0, 0);
82 } 84 }
83} 85}
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 05e52358ae49..82c135835753 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)
@@ -110,13 +114,11 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
110 const struct routing_scheme *sp; 114 const struct routing_scheme *sp;
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 sp = (sid < ARRAY_SIZE(routing_schemes)) ?
114 ((sp = routing_schemes + sid) != NULL) && 118 routing_schemes[sid] : NULL;
115 (hdw->input_val >= 0) && 119 if ((sp == NULL) ||
116 (hdw->input_val < sp->cnt)) { 120 (hdw->input_val < 0) ||
117 vid_input = sp->def[hdw->input_val].vid; 121 (hdw->input_val >= sp->cnt)) {
118 aud_input = sp->def[hdw->input_val].aud;
119 } else {
120 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 122 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
121 "*** WARNING *** subdev cx2584x set_input:" 123 "*** WARNING *** subdev cx2584x set_input:"
122 " Invalid routing scheme (%u)" 124 " Invalid routing scheme (%u)"
@@ -124,7 +126,8 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
124 sid, hdw->input_val); 126 sid, hdw->input_val);
125 return; 127 return;
126 } 128 }
127 129 vid_input = sp->def[hdw->input_val].vid;
130 aud_input = sp->def[hdw->input_val].aud;
128 pvr2_trace(PVR2_TRACE_CHIPS, 131 pvr2_trace(PVR2_TRACE_CHIPS,
129 "subdev cx2584x set_input vid=0x%x aud=0x%x", 132 "subdev cx2584x set_input vid=0x%x aud=0x%x",
130 vid_input, aud_input); 133 vid_input, aud_input);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 0c745b142fb7..cbc388729d77 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -85,8 +85,8 @@ MODULE_PARM_DESC(video_std,"specify initial video standard");
85module_param_array(tolerance, int, NULL, 0444); 85module_param_array(tolerance, int, NULL, 0444);
86MODULE_PARM_DESC(tolerance,"specify stream error tolerance"); 86MODULE_PARM_DESC(tolerance,"specify stream error tolerance");
87 87
88/* US Broadcast channel 7 (175.25 MHz) */ 88/* US Broadcast channel 3 (61.25 MHz), to help with testing */
89static int default_tv_freq = 175250000L; 89static int default_tv_freq = 61250000L;
90/* 104.3 MHz, a usable FM station for my area */ 90/* 104.3 MHz, a usable FM station for my area */
91static int default_radio_freq = 104300000L; 91static int default_radio_freq = 104300000L;
92 92
@@ -1987,6 +1987,34 @@ static unsigned int pvr2_copy_i2c_addr_list(
1987} 1987}
1988 1988
1989 1989
1990static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw)
1991{
1992 /*
1993 Mike Isely <isely@pobox.com> 19-Nov-2006 - This bit of nuttiness
1994 for cx25840 causes that module to correctly set up its video
1995 scaling. This is really a problem in the cx25840 module itself,
1996 but we work around it here. The problem has not been seen in
1997 ivtv because there VBI is supported and set up. We don't do VBI
1998 here (at least not yet) and thus we never attempted to even set
1999 it up.
2000 */
2001 struct v4l2_format fmt;
2002 if (hdw->decoder_client_id != PVR2_CLIENT_ID_CX25840) {
2003 /* We're not using a cx25840 so don't enable the hack */
2004 return;
2005 }
2006
2007 pvr2_trace(PVR2_TRACE_INIT,
2008 "Module ID %u:"
2009 " Executing cx25840 VBI hack",
2010 hdw->decoder_client_id);
2011 memset(&fmt, 0, sizeof(fmt));
2012 fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
2013 v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
2014 video, s_fmt, &fmt);
2015}
2016
2017
1990static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, 2018static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1991 const struct pvr2_device_client_desc *cd) 2019 const struct pvr2_device_client_desc *cd)
1992{ 2020{
@@ -2078,30 +2106,6 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2078 /* client-specific setup... */ 2106 /* client-specific setup... */
2079 switch (mid) { 2107 switch (mid) {
2080 case PVR2_CLIENT_ID_CX25840: 2108 case PVR2_CLIENT_ID_CX25840:
2081 hdw->decoder_client_id = mid;
2082 {
2083 /*
2084 Mike Isely <isely@pobox.com> 19-Nov-2006 - This
2085 bit of nuttiness for cx25840 causes that module
2086 to correctly set up its video scaling. This is
2087 really a problem in the cx25840 module itself,
2088 but we work around it here. The problem has not
2089 been seen in ivtv because there VBI is supported
2090 and set up. We don't do VBI here (at least not
2091 yet) and thus we never attempted to even set it
2092 up.
2093 */
2094 struct v4l2_format fmt;
2095 pvr2_trace(PVR2_TRACE_INIT,
2096 "Module ID %u:"
2097 " Executing cx25840 VBI hack",
2098 mid);
2099 memset(&fmt, 0, sizeof(fmt));
2100 fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
2101 v4l2_device_call_all(&hdw->v4l2_dev, mid,
2102 video, s_fmt, &fmt);
2103 }
2104 break;
2105 case PVR2_CLIENT_ID_SAA7115: 2109 case PVR2_CLIENT_ID_SAA7115:
2106 hdw->decoder_client_id = mid; 2110 hdw->decoder_client_id = mid;
2107 break; 2111 break;
@@ -2202,6 +2206,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
2202 cptr->info->set_value(cptr,~0,cptr->info->default_value); 2206 cptr->info->set_value(cptr,~0,cptr->info->default_value);
2203 } 2207 }
2204 2208
2209 pvr2_hdw_cx25840_vbi_hack(hdw);
2210
2205 /* Set up special default values for the television and radio 2211 /* Set up special default values for the television and radio
2206 frequencies here. It's not really important what these defaults 2212 frequencies here. It's not really important what these defaults
2207 are, but I set them to something usable in the Chicago area just 2213 are, but I set them to something usable in the Chicago area just
@@ -2954,6 +2960,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
2954 vs = hdw->std_mask_cur; 2960 vs = hdw->std_mask_cur;
2955 v4l2_device_call_all(&hdw->v4l2_dev, 0, 2961 v4l2_device_call_all(&hdw->v4l2_dev, 0,
2956 core, s_std, vs); 2962 core, s_std, vs);
2963 pvr2_hdw_cx25840_vbi_hack(hdw);
2957 } 2964 }
2958 hdw->tuner_signal_stale = !0; 2965 hdw->tuner_signal_stale = !0;
2959 hdw->cropcap_stale = !0; 2966 hdw->cropcap_stale = !0;
@@ -4076,6 +4083,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
4076 if (hdw->decoder_client_id) { 4083 if (hdw->decoder_client_id) {
4077 v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id, 4084 v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
4078 core, reset, 0); 4085 core, reset, 0);
4086 pvr2_hdw_cx25840_vbi_hack(hdw);
4079 return 0; 4087 return 0;
4080 } 4088 }
4081 pvr2_trace(PVR2_TRACE_INIT, 4089 pvr2_trace(PVR2_TRACE_INIT,
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
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)
@@ -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}