aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-08-16 21:15:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-13 12:37:36 -0400
commitfaedc36377258dc2d7e5b847db403e6e13794b1c (patch)
treeca07413218dd971226c801936cc0154e16d27b86
parent7fa8694acf90f16b845d6ec7d1a6c6728ec8768b (diff)
[media] dvb-usb: remove unused files
Those files were left from dvb-usb-v2 development as I have made mistake during rebase operation. Reported-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/usb/dvb-usb/dvb_usb_dvb.c403
-rw-r--r--drivers/media/usb/dvb-usb/dvb_usb_remote.c117
2 files changed, 0 insertions, 520 deletions
diff --git a/drivers/media/usb/dvb-usb/dvb_usb_dvb.c b/drivers/media/usb/dvb-usb/dvb_usb_dvb.c
deleted file mode 100644
index 384fe8eec21f..000000000000
--- a/drivers/media/usb/dvb-usb/dvb_usb_dvb.c
+++ /dev/null
@@ -1,403 +0,0 @@
1/* dvb-usb-dvb.c is part of the DVB USB library.
2 *
3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information.
5 *
6 * This file contains functions for initializing and handling the
7 * linux-dvb API.
8 */
9#include "dvb_usb_common.h"
10
11static void dvb_usb_data_complete(struct usb_data_stream *stream, u8 *buf,
12 size_t len)
13{
14 struct dvb_usb_adapter *adap = stream->user_priv;
15 dvb_dmx_swfilter(&adap->demux, buf, len);
16}
17
18static void dvb_usb_data_complete_204(struct usb_data_stream *stream, u8 *buf,
19 size_t len)
20{
21 struct dvb_usb_adapter *adap = stream->user_priv;
22 dvb_dmx_swfilter_204(&adap->demux, buf, len);
23}
24
25static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, u8 *buf,
26 size_t len)
27{
28 struct dvb_usb_adapter *adap = stream->user_priv;
29 dvb_dmx_swfilter_raw(&adap->demux, buf, len);
30}
31
32int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
33{
34 pr_debug("%s: adap=%d\n", __func__, adap->id);
35
36 adap->stream.udev = adap_to_d(adap)->udev;
37 adap->stream.user_priv = adap;
38 adap->stream.complete = dvb_usb_data_complete;
39
40 return usb_urb_initv2(&adap->stream, &adap->props->stream);
41}
42
43int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
44{
45 pr_debug("%s: adap=%d\n", __func__, adap->id);
46 usb_urb_exitv2(&adap->stream);
47
48 return 0;
49}
50
51/* does the complete input transfer handling */
52static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int count)
53{
54 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
55 struct dvb_usb_device *d = adap_to_d(adap);
56 int ret;
57 pr_debug("%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: " \
58 "%04x (%04d) at index %d '%s'\n", __func__, adap->id,
59 adap->active_fe, dvbdmxfeed->type,
60 adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid,
61 dvbdmxfeed->pid, dvbdmxfeed->index,
62 (count == 1) ? "on" : "off");
63
64 if (adap->active_fe == -1)
65 return -EINVAL;
66
67 adap->feed_count += count;
68
69 /* stop feeding if it is last pid */
70 if (adap->feed_count == 0) {
71 pr_debug("%s: stop feeding\n", __func__);
72 usb_urb_killv2(&adap->stream);
73
74 if (d->props->streaming_ctrl) {
75 ret = d->props->streaming_ctrl(adap, 0);
76 if (ret < 0) {
77 pr_err("%s: streaming_ctrl() failed=%d\n",
78 KBUILD_MODNAME, ret);
79 goto err_mutex_unlock;
80 }
81 }
82 mutex_unlock(&adap->sync_mutex);
83 }
84
85 /* activate the pid on the device pid filter */
86 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
87 adap->pid_filtering &&
88 adap->props->pid_filter)
89 ret = adap->props->pid_filter(adap, dvbdmxfeed->index,
90 dvbdmxfeed->pid, (count == 1) ? 1 : 0);
91 if (ret < 0)
92 pr_err("%s: pid_filter() failed=%d\n",
93 KBUILD_MODNAME, ret);
94
95 /* start feeding if it is first pid */
96 if (adap->feed_count == 1 && count == 1) {
97 struct usb_data_stream_properties stream_props;
98 mutex_lock(&adap->sync_mutex);
99 pr_debug("%s: start feeding\n", __func__);
100
101 /* resolve input and output streaming paramters */
102 if (d->props->get_stream_config) {
103 memcpy(&stream_props, &adap->props->stream,
104 sizeof(struct usb_data_stream_properties));
105 ret = d->props->get_stream_config(
106 adap->fe[adap->active_fe],
107 &adap->ts_type, &stream_props);
108 if (ret < 0)
109 goto err_mutex_unlock;
110 } else {
111 stream_props = adap->props->stream;
112 }
113
114 switch (adap->ts_type) {
115 case DVB_USB_FE_TS_TYPE_204:
116 adap->stream.complete = dvb_usb_data_complete_204;
117 break;
118 case DVB_USB_FE_TS_TYPE_RAW:
119 adap->stream.complete = dvb_usb_data_complete_raw;
120 break;
121 case DVB_USB_FE_TS_TYPE_188:
122 default:
123 adap->stream.complete = dvb_usb_data_complete;
124 break;
125 }
126
127 usb_urb_submitv2(&adap->stream, &stream_props);
128
129 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
130 adap->props->caps &
131 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF &&
132 adap->props->pid_filter_ctrl) {
133 ret = adap->props->pid_filter_ctrl(adap,
134 adap->pid_filtering);
135 if (ret < 0) {
136 pr_err("%s: pid_filter_ctrl() failed=%d\n",
137 KBUILD_MODNAME, ret);
138 goto err_mutex_unlock;
139 }
140 }
141
142 if (d->props->streaming_ctrl) {
143 ret = d->props->streaming_ctrl(adap, 1);
144 if (ret < 0) {
145 pr_err("%s: streaming_ctrl() failed=%d\n",
146 KBUILD_MODNAME, ret);
147 goto err_mutex_unlock;
148 }
149 }
150 }
151
152 return 0;
153err_mutex_unlock:
154 mutex_unlock(&adap->sync_mutex);
155 pr_debug("%s: failed=%d\n", __func__, ret);
156 return ret;
157}
158
159static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
160{
161 return dvb_usb_ctrl_feed(dvbdmxfeed, 1);
162}
163
164static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
165{
166 return dvb_usb_ctrl_feed(dvbdmxfeed, -1);
167}
168
169int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
170{
171 int ret;
172 struct dvb_usb_device *d = adap_to_d(adap);
173 pr_debug("%s: adap=%d\n", __func__, adap->id);
174
175 ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner,
176 &d->udev->dev, d->props->adapter_nr);
177 if (ret < 0) {
178 pr_debug("%s: dvb_register_adapter() failed=%d\n", __func__,
179 ret);
180 goto err;
181 }
182
183 adap->dvb_adap.priv = adap;
184
185 if (d->props->read_mac_address) {
186 ret = d->props->read_mac_address(adap,
187 adap->dvb_adap.proposed_mac);
188 if (ret < 0)
189 goto err_dmx;
190
191 pr_info("%s: MAC address: %pM\n", KBUILD_MODNAME,
192 adap->dvb_adap.proposed_mac);
193 }
194
195 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
196 adap->demux.priv = adap;
197 adap->demux.filternum = 0;
198 if (adap->demux.filternum < adap->max_feed_count)
199 adap->demux.filternum = adap->max_feed_count;
200 adap->demux.feednum = adap->demux.filternum;
201 adap->demux.start_feed = dvb_usb_start_feed;
202 adap->demux.stop_feed = dvb_usb_stop_feed;
203 adap->demux.write_to_decoder = NULL;
204 ret = dvb_dmx_init(&adap->demux);
205 if (ret < 0) {
206 pr_err("%s: dvb_dmx_init() failed=%d\n", KBUILD_MODNAME, ret);
207 goto err_dmx;
208 }
209
210 adap->dmxdev.filternum = adap->demux.filternum;
211 adap->dmxdev.demux = &adap->demux.dmx;
212 adap->dmxdev.capabilities = 0;
213 ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap);
214 if (ret < 0) {
215 pr_err("%s: dvb_dmxdev_init() failed=%d\n", KBUILD_MODNAME,
216 ret);
217 goto err_dmx_dev;
218 }
219
220 ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx);
221 if (ret < 0) {
222 pr_err("%s: dvb_net_init() failed=%d\n", KBUILD_MODNAME, ret);
223 goto err_net_init;
224 }
225
226 mutex_init(&adap->sync_mutex);
227
228 return 0;
229err_net_init:
230 dvb_dmxdev_release(&adap->dmxdev);
231err_dmx_dev:
232 dvb_dmx_release(&adap->demux);
233err_dmx:
234 dvb_unregister_adapter(&adap->dvb_adap);
235err:
236 adap->dvb_adap.priv = NULL;
237 return ret;
238}
239
240int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
241{
242 pr_debug("%s: adap=%d\n", __func__, adap->id);
243
244 if (adap->dvb_adap.priv) {
245 dvb_net_release(&adap->dvb_net);
246 adap->demux.dmx.close(&adap->demux.dmx);
247 dvb_dmxdev_release(&adap->dmxdev);
248 dvb_dmx_release(&adap->demux);
249 dvb_unregister_adapter(&adap->dvb_adap);
250 }
251
252 return 0;
253}
254
255static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
256{
257 int ret;
258 struct dvb_usb_adapter *adap = fe->dvb->priv;
259 struct dvb_usb_device *d = adap_to_d(adap);
260 mutex_lock(&adap->sync_mutex);
261 pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id);
262
263 ret = dvb_usbv2_device_power_ctrl(d, 1);
264 if (ret < 0)
265 goto err;
266
267 if (d->props->frontend_ctrl) {
268 ret = d->props->frontend_ctrl(fe, 1);
269 if (ret < 0)
270 goto err;
271 }
272
273 if (adap->fe_init[fe->id]) {
274 ret = adap->fe_init[fe->id](fe);
275 if (ret < 0)
276 goto err;
277 }
278
279 adap->active_fe = fe->id;
280 mutex_unlock(&adap->sync_mutex);
281
282 return 0;
283err:
284 mutex_unlock(&adap->sync_mutex);
285 pr_debug("%s: failed=%d\n", __func__, ret);
286 return ret;
287}
288
289static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
290{
291 int ret;
292 struct dvb_usb_adapter *adap = fe->dvb->priv;
293 struct dvb_usb_device *d = adap_to_d(adap);
294 mutex_lock(&adap->sync_mutex);
295 pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id);
296
297 if (adap->fe_sleep[fe->id]) {
298 ret = adap->fe_sleep[fe->id](fe);
299 if (ret < 0)
300 goto err;
301 }
302
303 if (d->props->frontend_ctrl) {
304 ret = d->props->frontend_ctrl(fe, 0);
305 if (ret < 0)
306 goto err;
307 }
308
309 ret = dvb_usbv2_device_power_ctrl(d, 0);
310 if (ret < 0)
311 goto err;
312
313 adap->active_fe = -1;
314 mutex_unlock(&adap->sync_mutex);
315
316 return 0;
317err:
318 mutex_unlock(&adap->sync_mutex);
319 pr_debug("%s: failed=%d\n", __func__, ret);
320 return ret;
321}
322
323int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
324{
325 int ret, i, count_registered = 0;
326 struct dvb_usb_device *d = adap_to_d(adap);
327 pr_debug("%s: adap=%d\n", __func__, adap->id);
328
329 memset(adap->fe, 0, sizeof(adap->fe));
330 adap->active_fe = -1;
331
332 if (d->props->frontend_attach) {
333 ret = d->props->frontend_attach(adap);
334 if (ret < 0) {
335 pr_debug("%s: frontend_attach() failed=%d\n", __func__,
336 ret);
337 goto err_dvb_frontend_detach;
338 }
339 } else {
340 pr_debug("%s: frontend_attach() do not exists\n", __func__);
341 ret = 0;
342 goto err;
343 }
344
345 for (i = 0; i < MAX_NO_OF_FE_PER_ADAP && adap->fe[i]; i++) {
346 adap->fe[i]->id = i;
347
348 /* re-assign sleep and wakeup functions */
349 adap->fe_init[i] = adap->fe[i]->ops.init;
350 adap->fe[i]->ops.init = dvb_usb_fe_wakeup;
351 adap->fe_sleep[i] = adap->fe[i]->ops.sleep;
352 adap->fe[i]->ops.sleep = dvb_usb_fe_sleep;
353
354 ret = dvb_register_frontend(&adap->dvb_adap, adap->fe[i]);
355 if (ret < 0) {
356 pr_err("%s: frontend%d registration failed\n",
357 KBUILD_MODNAME, i);
358 goto err_dvb_unregister_frontend;
359 }
360
361 count_registered++;
362 }
363
364 if (d->props->tuner_attach) {
365 ret = d->props->tuner_attach(adap);
366 if (ret < 0) {
367 pr_debug("%s: tuner_attach() failed=%d\n", __func__,
368 ret);
369 goto err_dvb_unregister_frontend;
370 }
371 }
372
373 return 0;
374
375err_dvb_unregister_frontend:
376 for (i = count_registered - 1; i >= 0; i--)
377 dvb_unregister_frontend(adap->fe[i]);
378
379err_dvb_frontend_detach:
380 for (i = MAX_NO_OF_FE_PER_ADAP - 1; i >= 0; i--) {
381 if (adap->fe[i])
382 dvb_frontend_detach(adap->fe[i]);
383 }
384
385err:
386 pr_debug("%s: failed=%d\n", __func__, ret);
387 return ret;
388}
389
390int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap)
391{
392 int i;
393 pr_debug("%s: adap=%d\n", __func__, adap->id);
394
395 for (i = MAX_NO_OF_FE_PER_ADAP - 1; i >= 0; i--) {
396 if (adap->fe[i]) {
397 dvb_unregister_frontend(adap->fe[i]);
398 dvb_frontend_detach(adap->fe[i]);
399 }
400 }
401
402 return 0;
403}
diff --git a/drivers/media/usb/dvb-usb/dvb_usb_remote.c b/drivers/media/usb/dvb-usb/dvb_usb_remote.c
deleted file mode 100644
index f856ab6648c7..000000000000
--- a/drivers/media/usb/dvb-usb/dvb_usb_remote.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/* dvb-usb-remote.c is part of the DVB USB library.
2 *
3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information.
5 *
6 * This file contains functions for initializing the input-device and for
7 * handling remote-control-queries.
8 */
9#include "dvb_usb_common.h"
10#include <linux/usb/input.h>
11
12/* Remote-control poll function - called every dib->rc_query_interval ms to see
13 * whether the remote control has received anything.
14 *
15 * TODO: Fix the repeat rate of the input device.
16 */
17static void dvb_usb_read_remote_control(struct work_struct *work)
18{
19 struct dvb_usb_device *d = container_of(work,
20 struct dvb_usb_device, rc_query_work.work);
21 int ret;
22
23 /* TODO: need a lock here. We can simply skip checking for the remote
24 control if we're busy. */
25
26 /* when the parameter has been set to 1 via sysfs while the
27 * driver was running, or when bulk mode is enabled after IR init
28 */
29 if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode)
30 return;
31
32 ret = d->rc.query(d);
33 if (ret < 0)
34 pr_err("%s: error %d while querying for an remote control " \
35 "event\n", KBUILD_MODNAME, ret);
36
37 schedule_delayed_work(&d->rc_query_work,
38 msecs_to_jiffies(d->rc.interval));
39}
40
41int dvb_usbv2_remote_init(struct dvb_usb_device *d)
42{
43 int ret;
44 struct rc_dev *dev;
45
46 if (dvb_usbv2_disable_rc_polling || !d->props->get_rc_config)
47 return 0;
48
49 ret = d->props->get_rc_config(d, &d->rc);
50 if (ret < 0)
51 goto err;
52
53 dev = rc_allocate_device();
54 if (!dev) {
55 ret = -ENOMEM;
56 goto err;
57 }
58
59 dev->dev.parent = &d->udev->dev;
60 dev->input_name = "IR-receiver inside an USB DVB receiver";
61 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
62 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
63 dev->input_phys = d->rc_phys;
64 usb_to_input_id(d->udev, &dev->input_id);
65 /* TODO: likely RC-core should took const char * */
66 dev->driver_name = (char *) d->props->driver_name;
67 dev->driver_type = d->rc.driver_type;
68 dev->allowed_protos = d->rc.allowed_protos;
69 dev->change_protocol = d->rc.change_protocol;
70 dev->priv = d;
71 /* select used keymap */
72 if (d->rc.map_name)
73 dev->map_name = d->rc.map_name;
74 else if (d->rc_map)
75 dev->map_name = d->rc_map;
76 else
77 dev->map_name = RC_MAP_EMPTY; /* keep rc enabled */
78
79 ret = rc_register_device(dev);
80 if (ret < 0) {
81 rc_free_device(dev);
82 goto err;
83 }
84
85 d->input_dev = NULL;
86 d->rc_dev = dev;
87
88 /* start polling if needed */
89 if (d->rc.query && !d->rc.bulk_mode) {
90 /* initialize a work queue for handling polling */
91 INIT_DELAYED_WORK(&d->rc_query_work,
92 dvb_usb_read_remote_control);
93 pr_info("%s: schedule remote query interval to %d msecs\n",
94 KBUILD_MODNAME, d->rc.interval);
95 schedule_delayed_work(&d->rc_query_work,
96 msecs_to_jiffies(d->rc.interval));
97 }
98
99 d->state |= DVB_USB_STATE_REMOTE;
100
101 return 0;
102err:
103 pr_debug("%s: failed=%d\n", __func__, ret);
104 return ret;
105}
106
107int dvb_usbv2_remote_exit(struct dvb_usb_device *d)
108{
109 if (d->state & DVB_USB_STATE_REMOTE) {
110 cancel_delayed_work_sync(&d->rc_query_work);
111 rc_unregister_device(d->rc_dev);
112 }
113
114 d->state &= ~DVB_USB_STATE_REMOTE;
115
116 return 0;
117}