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.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c7
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c12
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c9
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c12
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-wm8775.c12
9 files changed, 37 insertions, 56 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c
index ccf2a3c7ad06..10ef1a2c13ea 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-audio.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c
@@ -58,9 +58,9 @@ static const struct routing_scheme routing_schemes[] = {
58void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 58void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
59{ 59{
60 if (hdw->input_dirty || hdw->force_dirty) { 60 if (hdw->input_dirty || hdw->force_dirty) {
61 struct v4l2_routing route;
62 const struct routing_scheme *sp; 61 const struct routing_scheme *sp;
63 unsigned int sid = hdw->hdw_desc->signal_routing_scheme; 62 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
63 u32 input;
64 64
65 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo"); 65 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo");
66 66
@@ -68,7 +68,7 @@ void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
68 ((sp = routing_schemes + sid) != NULL) && 68 ((sp = routing_schemes + sid) != NULL) &&
69 (hdw->input_val >= 0) && 69 (hdw->input_val >= 0) &&
70 (hdw->input_val < sp->cnt)) { 70 (hdw->input_val < sp->cnt)) {
71 route.input = sp->def[hdw->input_val]; 71 input = sp->def[hdw->input_val];
72 } else { 72 } else {
73 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 73 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
74 "*** WARNING *** subdev msp3400 set_input:" 74 "*** WARNING *** subdev msp3400 set_input:"
@@ -77,8 +77,8 @@ void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
77 sid, hdw->input_val); 77 sid, hdw->input_val);
78 return; 78 return;
79 } 79 }
80 route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); 80 sd->ops->audio->s_routing(sd, input,
81 sd->ops->audio->s_routing(sd, &route); 81 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0);
82 } 82 }
83} 83}
84 84
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
index b5c3428ebb9f..9023adf3fdcc 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
@@ -60,16 +60,16 @@ static const struct routing_scheme routing_schemes[] = {
60void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 60void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
61{ 61{
62 if (hdw->input_dirty || hdw->force_dirty) { 62 if (hdw->input_dirty || hdw->force_dirty) {
63 struct v4l2_routing route;
64 const struct routing_scheme *sp; 63 const struct routing_scheme *sp;
65 unsigned int sid = hdw->hdw_desc->signal_routing_scheme; 64 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
65 u32 input;
66 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", 66 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
67 hdw->input_val); 67 hdw->input_val);
68 if ((sid < ARRAY_SIZE(routing_schemes)) && 68 if ((sid < ARRAY_SIZE(routing_schemes)) &&
69 ((sp = routing_schemes + sid) != NULL) && 69 ((sp = routing_schemes + sid) != NULL) &&
70 (hdw->input_val >= 0) && 70 (hdw->input_val >= 0) &&
71 (hdw->input_val < sp->cnt)) { 71 (hdw->input_val < sp->cnt)) {
72 route.input = sp->def[hdw->input_val]; 72 input = sp->def[hdw->input_val];
73 } else { 73 } else {
74 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 74 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
75 "*** WARNING *** subdev v4l2 set_input:" 75 "*** WARNING *** subdev v4l2 set_input:"
@@ -78,8 +78,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
78 sid, hdw->input_val); 78 sid, hdw->input_val);
79 return; 79 return;
80 } 80 }
81 route.output = 0; 81 sd->ops->audio->s_routing(sd, input, 0, 0);
82 sd->ops->audio->s_routing(sd, &route);
83 } 82 }
84} 83}
85 84
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index 203f54cd18a1..1b992b847198 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -137,14 +137,12 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr)
137int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr, int *valptr) 137int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr, int *valptr)
138{ 138{
139 int ret = 0; 139 int ret = 0;
140 if (!cptr) return 0; 140 if (!cptr) return -EINVAL;
141 LOCK_TAKE(cptr->hdw->big_lock); do { 141 LOCK_TAKE(cptr->hdw->big_lock); do {
142 if (cptr->info->type == pvr2_ctl_int) { 142 if (cptr->info->get_def_value) {
143 if (cptr->info->get_def_value) { 143 ret = cptr->info->get_def_value(cptr, valptr);
144 ret = cptr->info->get_def_value(cptr, valptr); 144 } else {
145 } else { 145 *valptr = cptr->info->default_value;
146 *valptr = cptr->info->default_value;
147 }
148 } 146 }
149 } while(0); LOCK_GIVE(cptr->hdw->big_lock); 147 } while(0); LOCK_GIVE(cptr->hdw->big_lock);
150 return ret; 148 return ret;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 4e017ff26c36..05e52358ae49 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -105,14 +105,11 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
105{ 105{
106 pvr2_trace(PVR2_TRACE_CHIPS, "subdev cx2584x update..."); 106 pvr2_trace(PVR2_TRACE_CHIPS, "subdev cx2584x update...");
107 if (hdw->input_dirty || hdw->force_dirty) { 107 if (hdw->input_dirty || hdw->force_dirty) {
108 struct v4l2_routing route;
109 enum cx25840_video_input vid_input; 108 enum cx25840_video_input vid_input;
110 enum cx25840_audio_input aud_input; 109 enum cx25840_audio_input aud_input;
111 const struct routing_scheme *sp; 110 const struct routing_scheme *sp;
112 unsigned int sid = hdw->hdw_desc->signal_routing_scheme; 111 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
113 112
114 memset(&route, 0, sizeof(route));
115
116 if ((sid < ARRAY_SIZE(routing_schemes)) && 113 if ((sid < ARRAY_SIZE(routing_schemes)) &&
117 ((sp = routing_schemes + sid) != NULL) && 114 ((sp = routing_schemes + sid) != NULL) &&
118 (hdw->input_val >= 0) && 115 (hdw->input_val >= 0) &&
@@ -131,10 +128,8 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
131 pvr2_trace(PVR2_TRACE_CHIPS, 128 pvr2_trace(PVR2_TRACE_CHIPS,
132 "subdev cx2584x set_input vid=0x%x aud=0x%x", 129 "subdev cx2584x set_input vid=0x%x aud=0x%x",
133 vid_input, aud_input); 130 vid_input, aud_input);
134 route.input = (u32)vid_input; 131 sd->ops->video->s_routing(sd, (u32)vid_input, 0, 0);
135 sd->ops->video->s_routing(sd, &route); 132 sd->ops->audio->s_routing(sd, (u32)aud_input, 0, 0);
136 route.input = (u32)aud_input;
137 sd->ops->audio->s_routing(sd, &route);
138 } 133 }
139} 134}
140 135
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 7a65b42a4f53..d9d974a8f52a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -2039,7 +2039,7 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2039 "Module ID %u:" 2039 "Module ID %u:"
2040 " Setting up with specified i2c address 0x%x", 2040 " Setting up with specified i2c address 0x%x",
2041 mid, i2caddr[0]); 2041 mid, i2caddr[0]);
2042 sd = v4l2_i2c_new_subdev(&hdw->i2c_adap, 2042 sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap,
2043 fname, fname, 2043 fname, fname,
2044 i2caddr[0]); 2044 i2caddr[0]);
2045 } else { 2045 } else {
@@ -2047,7 +2047,7 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2047 "Module ID %u:" 2047 "Module ID %u:"
2048 " Setting up with address probe list", 2048 " Setting up with address probe list",
2049 mid); 2049 mid);
2050 sd = v4l2_i2c_new_probed_subdev(&hdw->i2c_adap, 2050 sd = v4l2_i2c_new_probed_subdev(&hdw->v4l2_dev, &hdw->i2c_adap,
2051 fname, fname, 2051 fname, fname,
2052 i2caddr); 2052 i2caddr);
2053 } 2053 }
@@ -2185,7 +2185,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
2185 pvr2_hdw_load_modules(hdw); 2185 pvr2_hdw_load_modules(hdw);
2186 if (!pvr2_hdw_dev_ok(hdw)) return; 2186 if (!pvr2_hdw_dev_ok(hdw)) return;
2187 2187
2188 v4l2_device_call_all(&hdw->v4l2_dev, 0, core, init, 0); 2188 v4l2_device_call_all(&hdw->v4l2_dev, 0, core, load_fw);
2189 2189
2190 for (idx = 0; idx < CTRLDEF_COUNT; idx++) { 2190 for (idx = 0; idx < CTRLDEF_COUNT; idx++) {
2191 cptr = hdw->controls + idx; 2191 cptr = hdw->controls + idx;
@@ -2574,7 +2574,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
2574 hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL); 2574 hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL);
2575 if (!hdw->ctl_read_urb) goto fail; 2575 if (!hdw->ctl_read_urb) goto fail;
2576 2576
2577 if (v4l2_device_register(&usb_dev->dev, &hdw->v4l2_dev) != 0) { 2577 if (v4l2_device_register(&intf->dev, &hdw->v4l2_dev) != 0) {
2578 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 2578 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
2579 "Error registering with v4l core, giving up"); 2579 "Error registering with v4l core, giving up");
2580 goto fail; 2580 goto fail;
@@ -2926,6 +2926,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
2926 pvr2_trace(PVR2_TRACE_CHIPS, "subdev tuner set_type(%d)", 2926 pvr2_trace(PVR2_TRACE_CHIPS, "subdev tuner set_type(%d)",
2927 hdw->tuner_type); 2927 hdw->tuner_type);
2928 if (((int)(hdw->tuner_type)) >= 0) { 2928 if (((int)(hdw->tuner_type)) >= 0) {
2929 memset(&setup, 0, sizeof(setup));
2929 setup.addr = ADDR_UNSET; 2930 setup.addr = ADDR_UNSET;
2930 setup.type = hdw->tuner_type; 2931 setup.type = hdw->tuner_type;
2931 setup.mode_mask = T_RADIO | T_ANALOG_TV; 2932 setup.mode_mask = T_RADIO | T_ANALOG_TV;
@@ -2943,7 +2944,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
2943 v4l2_std_id vs; 2944 v4l2_std_id vs;
2944 vs = hdw->std_mask_cur; 2945 vs = hdw->std_mask_cur;
2945 v4l2_device_call_all(&hdw->v4l2_dev, 0, 2946 v4l2_device_call_all(&hdw->v4l2_dev, 0,
2946 tuner, s_std, vs); 2947 core, s_std, vs);
2947 } 2948 }
2948 hdw->tuner_signal_stale = !0; 2949 hdw->tuner_signal_stale = !0;
2949 hdw->cropcap_stale = !0; 2950 hdw->cropcap_stale = !0;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 9464862745fa..9af282f9e765 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -520,16 +520,6 @@ static u32 pvr2_i2c_functionality(struct i2c_adapter *adap)
520 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; 520 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
521} 521}
522 522
523static int pvr2_i2c_attach_inform(struct i2c_client *client)
524{
525 return 0;
526}
527
528static int pvr2_i2c_detach_inform(struct i2c_client *client)
529{
530 return 0;
531}
532
533static struct i2c_algorithm pvr2_i2c_algo_template = { 523static struct i2c_algorithm pvr2_i2c_algo_template = {
534 .master_xfer = pvr2_i2c_xfer, 524 .master_xfer = pvr2_i2c_xfer,
535 .functionality = pvr2_i2c_functionality, 525 .functionality = pvr2_i2c_functionality,
@@ -539,8 +529,6 @@ static struct i2c_adapter pvr2_i2c_adap_template = {
539 .owner = THIS_MODULE, 529 .owner = THIS_MODULE,
540 .class = 0, 530 .class = 0,
541 .id = I2C_HW_B_BT848, 531 .id = I2C_HW_B_BT848,
542 .client_register = pvr2_i2c_attach_inform,
543 .client_unregister = pvr2_i2c_detach_inform,
544}; 532};
545 533
546 534
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index e20ba1e6e0ea..299c1cbc3832 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -153,14 +153,16 @@ static ssize_t show_def(struct device *class_dev,
153 struct pvr2_sysfs_ctl_item *cip; 153 struct pvr2_sysfs_ctl_item *cip;
154 int val; 154 int val;
155 int ret; 155 int ret;
156 unsigned int cnt = 0;
156 cip = container_of(attr, struct pvr2_sysfs_ctl_item, attr_def); 157 cip = container_of(attr, struct pvr2_sysfs_ctl_item, attr_def);
157 ret = pvr2_ctrl_get_def(cip->cptr, &val); 158 ret = pvr2_ctrl_get_def(cip->cptr, &val);
158 pvr2_sysfs_trace("pvr2_sysfs(%p) show_def(cid=%d) is %d, stat=%d", 159 if (ret < 0) return ret;
159 cip->chptr, cip->ctl_id, val, ret); 160 ret = pvr2_ctrl_value_to_sym(cip->cptr, ~0, val,
160 if (ret < 0) { 161 buf, PAGE_SIZE - 1, &cnt);
161 return ret; 162 pvr2_sysfs_trace("pvr2_sysfs(%p) show_def(cid=%d) is %.*s (%d)",
162 } 163 cip->chptr, cip->ctl_id, cnt, buf, val);
163 return scnprintf(buf, PAGE_SIZE, "%d\n", val); 164 buf[cnt] = '\n';
165 return cnt + 1;
164} 166}
165 167
166static ssize_t show_val_norm(struct device *class_dev, 168static ssize_t show_val_norm(struct device *class_dev,
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index b3862f5554bd..d2fe7c8f2c3a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
@@ -75,16 +75,17 @@ static const struct routing_scheme routing_schemes[] = {
75void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 75void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
76{ 76{
77 if (hdw->input_dirty || hdw->force_dirty) { 77 if (hdw->input_dirty || hdw->force_dirty) {
78 struct v4l2_routing route;
79 const struct routing_scheme *sp; 78 const struct routing_scheme *sp;
80 unsigned int sid = hdw->hdw_desc->signal_routing_scheme; 79 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
80 u32 input;
81
81 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", 82 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
82 hdw->input_val); 83 hdw->input_val);
83 if ((sid < ARRAY_SIZE(routing_schemes)) && 84 if ((sid < ARRAY_SIZE(routing_schemes)) &&
84 ((sp = routing_schemes + sid) != NULL) && 85 ((sp = routing_schemes + sid) != NULL) &&
85 (hdw->input_val >= 0) && 86 (hdw->input_val >= 0) &&
86 (hdw->input_val < sp->cnt)) { 87 (hdw->input_val < sp->cnt)) {
87 route.input = sp->def[hdw->input_val]; 88 input = sp->def[hdw->input_val];
88 } else { 89 } else {
89 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 90 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
90 "*** WARNING *** subdev v4l2 set_input:" 91 "*** WARNING *** subdev v4l2 set_input:"
@@ -93,8 +94,7 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
93 sid, hdw->input_val); 94 sid, hdw->input_val);
94 return; 95 return;
95 } 96 }
96 route.output = 0; 97 sd->ops->video->s_routing(sd, input, 0, 0);
97 sd->ops->video->s_routing(sd, &route);
98 } 98 }
99} 99}
100 100
diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
index 1670aa4051ce..8c1eae05aa08 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
@@ -39,24 +39,22 @@
39void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 39void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
40{ 40{
41 if (hdw->input_dirty || hdw->force_dirty) { 41 if (hdw->input_dirty || hdw->force_dirty) {
42 struct v4l2_routing route; 42 u32 input;
43
44 memset(&route, 0, sizeof(route));
45 43
46 switch (hdw->input_val) { 44 switch (hdw->input_val) {
47 case PVR2_CVAL_INPUT_RADIO: 45 case PVR2_CVAL_INPUT_RADIO:
48 route.input = 1; 46 input = 1;
49 break; 47 break;
50 default: 48 default:
51 /* All other cases just use the second input */ 49 /* All other cases just use the second input */
52 route.input = 2; 50 input = 2;
53 break; 51 break;
54 } 52 }
55 pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775" 53 pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775"
56 " set_input(val=%d route=0x%x)", 54 " set_input(val=%d route=0x%x)",
57 hdw->input_val, route.input); 55 hdw->input_val, input);
58 56
59 sd->ops->audio->s_routing(sd, &route); 57 sd->ops->audio->s_routing(sd, input, 0, 0);
60 } 58 }
61} 59}
62 60