27 "disable remote control polling (default: 0)");
28 static int dvb_usb_force_pid_filter_usage;
31 MODULE_PARM_DESC(force_pid_filter_usage,
"force all DVB USB devices to use a " \
32 "PID filter, if any (default: 0)");
40 if (!d->
props->download_firmware) {
47 dev_err(&d->
udev->dev,
"%s: Did not find the firmware file "\
48 "'%s'. Please see linux/Documentation/dvb/ " \
49 "for more details on firmware-problems. " \
50 "Status %d\n", KBUILD_MODNAME, name, ret);
54 dev_info(&d->
udev->dev,
"%s: downloading firmware from file '%s'\n",
55 KBUILD_MODNAME, name);
57 ret = d->
props->download_firmware(d, fw);
64 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
73 if (!d->
props->i2c_algo)
84 dev_err(&d->
udev->dev,
"%s: i2c_add_adapter() failed=%d\n",
91 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
118 ret = d->
rc.query(d);
120 dev_err(&d->
udev->dev,
"%s: rc.query() failed=%d\n",
121 KBUILD_MODNAME, ret);
139 ret = d->
props->get_rc_config(d, &d->
rc);
153 dev->
dev.parent = &d->
udev->dev;
176 if (d->
rc.query && !d->
rc.bulk_mode) {
179 dvb_usb_read_remote_control);
180 dev_info(&d->
udev->dev,
"%s: schedule remote query interval " \
181 "to %d msecs\n", KBUILD_MODNAME,
189 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
233 adap->
stream.user_priv = adap;
234 adap->
stream.complete = dvb_usb_data_complete;
247 static inline int dvb_usb_ctrl_feed(
struct dvb_demux_feed *dvbdmxfeed,
253 dev_dbg(&d->
udev->dev,
"%s: adap=%d active_fe=%d feed_type=%d " \
254 "setting pid [%s]: %04x (%04d) at index %d '%s'\n",
258 (count == 1) ?
"on" :
"off");
267 dev_dbg(&d->
udev->dev,
"%s: stop feeding\n", __func__);
269 if (d->
props->streaming_ctrl) {
270 ret = d->
props->streaming_ctrl(
274 "failed=%d\n", KBUILD_MODNAME,
277 goto err_mutex_unlock;
287 ret = adap->
props->pid_filter(adap, dvbdmxfeed->
index,
288 dvbdmxfeed->
pid, (count == 1) ? 1 : 0);
290 dev_err(&d->
udev->dev,
"%s: pid_filter() failed=%d\n",
291 KBUILD_MODNAME, ret);
298 dev_dbg(&d->
udev->dev,
"%s: start feeding\n", __func__);
301 if (d->
props->get_stream_config) {
304 ret = d->
props->get_stream_config(
306 &adap->
ts_type, &stream_props);
308 goto err_mutex_unlock;
310 stream_props = adap->
props->stream;
315 adap->
stream.complete = dvb_usb_data_complete_204;
318 adap->
stream.complete = dvb_usb_data_complete_raw;
322 adap->
stream.complete = dvb_usb_data_complete;
331 adap->
props->pid_filter_ctrl) {
332 ret = adap->
props->pid_filter_ctrl(adap,
336 "pid_filter_ctrl() failed=%d\n",
337 KBUILD_MODNAME, ret);
338 goto err_mutex_unlock;
342 if (d->
props->streaming_ctrl) {
343 ret = d->
props->streaming_ctrl(
347 "failed=%d\n", KBUILD_MODNAME,
349 goto err_mutex_unlock;
357 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
363 return dvb_usb_ctrl_feed(dvbdmxfeed, 1);
368 return dvb_usb_ctrl_feed(dvbdmxfeed, -1);
380 dev_dbg(&d->
udev->dev,
"%s: dvb_register_adapter() failed=%d\n",
382 goto err_dvb_register_adapter;
387 if (d->
props->read_mac_address) {
388 ret = d->
props->read_mac_address(adap,
391 goto err_dvb_dmx_init;
394 KBUILD_MODNAME, adap->
dvb_adap.proposed_mac);
398 adap->
demux.priv = adap;
399 adap->
demux.filternum = 0;
402 adap->
demux.start_feed = dvb_usb_start_feed;
403 adap->
demux.stop_feed = dvb_usb_stop_feed;
407 dev_err(&d->
udev->dev,
"%s: dvb_dmx_init() failed=%d\n",
408 KBUILD_MODNAME, ret);
409 goto err_dvb_dmx_init;
414 adap->
dmxdev.capabilities = 0;
417 dev_err(&d->
udev->dev,
"%s: dvb_dmxdev_init() failed=%d\n",
418 KBUILD_MODNAME, ret);
419 goto err_dvb_dmxdev_init;
424 dev_err(&d->
udev->dev,
"%s: dvb_net_init() failed=%d\n",
425 KBUILD_MODNAME, ret);
426 goto err_dvb_net_init;
438 err_dvb_register_adapter:
470 dev_dbg(&d->
udev->dev,
"%s: power=%d\n", __func__, onoff);
471 if (d->
props->power_ctrl) {
472 ret = d->
props->power_ctrl(d, onoff);
480 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
489 dev_dbg(&d->
udev->dev,
"%s: adap=%d fe=%d\n", __func__, adap->
id,
501 if (d->
props->frontend_ctrl) {
502 ret = d->
props->frontend_ctrl(fe, 1);
516 dev_dbg(&d->
udev->dev,
"%s: ret=%d\n", __func__, ret);
525 dev_dbg(&d->
udev->dev,
"%s: adap=%d fe=%d\n", __func__, adap->
id,
537 if (d->
props->frontend_ctrl) {
538 ret = d->
props->frontend_ctrl(fe, 0);
552 dev_dbg(&d->
udev->dev,
"%s: ret=%d\n", __func__, ret);
558 int ret,
i, count_registered = 0;
565 if (d->
props->frontend_attach) {
566 ret = d->
props->frontend_attach(adap);
569 "failed=%d\n", __func__, ret);
570 goto err_dvb_frontend_detach;
573 dev_dbg(&d->
udev->dev,
"%s: frontend_attach() do not exists\n",
583 adap->
fe[
i]->ops.init = dvb_usb_fe_init;
585 adap->
fe[
i]->ops.sleep = dvb_usb_fe_sleep;
589 dev_err(&d->
udev->dev,
"%s: frontend%d registration " \
590 "failed\n", KBUILD_MODNAME, i);
591 goto err_dvb_unregister_frontend;
597 if (d->
props->tuner_attach) {
598 ret = d->
props->tuner_attach(adap);
600 dev_dbg(&d->
udev->dev,
"%s: tuner_attach() failed=%d\n",
602 goto err_dvb_unregister_frontend;
608 err_dvb_unregister_frontend:
609 for (i = count_registered - 1; i >= 0; i--)
612 err_dvb_frontend_detach:
621 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
644 int ret,
i, adapter_count;
647 adapter_count = d->
props->num_adapters;
648 if (d->
props->get_adapter_count) {
649 ret = d->
props->get_adapter_count(d);
656 for (i = 0; i < adapter_count; i++) {
665 "cannot be run on a USB1.1 port (it " \
666 "lacks a hardware PID filter)\n",
674 "hardware PID filter " \
675 "(table count: %d)\n", KBUILD_MODNAME,
676 adap->
props->pid_filter_count);
681 "MPEG2 transport stream to the " \
682 "software demuxer\n", KBUILD_MODNAME);
687 if (!adap->
pid_filtering && dvb_usb_force_pid_filter_usage &&
690 "module option\n", KBUILD_MODNAME);
714 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
739 dvb_usbv2_remote_exit(d);
740 dvb_usbv2_adapter_exit(d);
741 dvb_usbv2_i2c_exit(d);
755 if (d->
props->read_config) {
756 ret = d->
props->read_config(d);
761 ret = dvb_usbv2_i2c_init(d);
765 ret = dvb_usbv2_adapter_init(d);
769 if (d->
props->init) {
770 ret = d->
props->init(d);
775 ret = dvb_usbv2_remote_init(d);
784 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
794 static void dvb_usbv2_init_work(
struct work_struct *work)
803 if (d->
props->size_of_priv) {
809 goto err_usb_driver_release_interface;
813 if (d->
props->identify_state) {
814 const char *name =
NULL;
815 ret = d->
props->identify_state(d, &name);
818 }
else if (ret ==
COLD) {
820 "state\n", KBUILD_MODNAME, d->
name);
823 name = d->
props->firmware;
825 ret = dvb_usbv2_download_firmware(d, name);
848 goto err_usb_driver_release_interface;
851 goto err_usb_driver_release_interface;
855 dev_info(&d->
udev->dev,
"%s: found a '%s' in warm state\n",
856 KBUILD_MODNAME, d->
name);
858 ret = dvb_usbv2_init(d);
860 goto err_usb_driver_release_interface;
862 dev_info(&d->
udev->dev,
"%s: '%s' successfully initialized and " \
863 "connected\n", KBUILD_MODNAME, d->
name);
866 err_usb_driver_release_interface:
867 dev_info(&d->
udev->dev,
"%s: '%s' error while loading driver (%d)\n",
868 KBUILD_MODNAME, d->
name, ret);
871 dev_dbg(&d->
udev->dev,
"%s: failed=%d\n", __func__, ret);
880 struct usb_device *
udev = interface_to_usbdev(intf);
884 dev_dbg(&udev->dev,
"%s: bInterfaceNumber=%d\n", __func__,
885 intf->cur_altsetting->desc.bInterfaceNumber);
887 if (!id->driver_info) {
888 dev_err(&udev->dev,
"%s: driver_info failed\n", KBUILD_MODNAME);
895 dev_err(&udev->dev,
"%s: kzalloc() failed\n", KBUILD_MODNAME);
906 if (d->
intf->cur_altsetting->desc.bInterfaceNumber !=
907 d->
props->bInterfaceNumber) {
915 usb_set_intfdata(intf, d);
918 dev_err(&d->
udev->dev,
"%s: schedule_work() failed\n",
927 dev_dbg(&udev->dev,
"%s: failed=%d\n", __func__, ret);
935 const char *name = d->
name;
937 dev_dbg(&d->
udev->dev,
"%s: pid=%d work_pid=%d\n", __func__,
949 dev_info(&dev,
"%s: '%s' successfully deinitialized and disconnected\n",
950 KBUILD_MODNAME, name);
957 int ret = 0,
i, active_fe;
962 if (d->
rc.query && !d->
rc.bulk_mode)
966 active_fe = d->
adapter[
i].active_fe;
967 if (d->
adapter[i].dvb_adap.priv && active_fe != -1) {
969 d->
adapter[
i].suspend_resume_active =
true;
971 if (d->
props->streaming_ctrl)
972 d->
props->streaming_ctrl(fe, 0);
987 int ret = 0,
i, active_fe;
992 active_fe = d->
adapter[
i].active_fe;
993 if (d->
adapter[i].dvb_adap.priv && active_fe != -1) {
1001 if (d->
props->streaming_ctrl)
1002 d->
props->streaming_ctrl(fe, 1);
1004 d->
adapter[
i].suspend_resume_active =
false;
1009 if (d->
rc.query && !d->
rc.bulk_mode)
1021 return dvb_usbv2_resume_common(d);
1036 ret = dvb_usbv2_resume_common(d);