Lines Matching +full:usb +full:- +full:attach
1 // SPDX-License-Identifier: GPL-2.0
5 // (c) 2008-2011 Mauro Carvalho Chehab <mchehab@kernel.org>
8 // - Fixes for the driver to properly work with HVR-950
9 // - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick
10 // - Fixes for the driver to properly work with AMD ATI TV Wonder HD 600
16 // Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by:
24 #include <linux/usb.h>
26 #include <media/v4l2-common.h>
31 #include "tuner-simple.h"
65 MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface");
76 dev_printk(KERN_DEBUG, &dev->intf->dev, \
95 /* Due to DRX-K - probably need changes */
111 case -ENOENT: in print_err_status()
114 case -ECONNRESET: in print_err_status()
117 case -ENOSR: in print_err_status()
120 case -EPIPE: in print_err_status()
123 case -EOVERFLOW: in print_err_status()
126 case -EPROTO: in print_err_status()
127 errmsg = "Bit-stuff error (bad cable?)"; in print_err_status()
129 case -EILSEQ: in print_err_status()
132 case -ETIME: in print_err_status()
151 if (dev->disconnected) in em28xx_dvb_urb_data_copy()
154 if (urb->status < 0) in em28xx_dvb_urb_data_copy()
155 print_err_status(dev, -1, urb->status); in em28xx_dvb_urb_data_copy()
157 xfer_bulk = usb_pipebulk(urb->pipe); in em28xx_dvb_urb_data_copy()
162 num_packets = urb->number_of_packets; in em28xx_dvb_urb_data_copy()
166 if (urb->status < 0) { in em28xx_dvb_urb_data_copy()
167 print_err_status(dev, i, urb->status); in em28xx_dvb_urb_data_copy()
168 if (urb->status != -EPROTO) in em28xx_dvb_urb_data_copy()
171 if (!urb->actual_length) in em28xx_dvb_urb_data_copy()
173 dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer, in em28xx_dvb_urb_data_copy()
174 urb->actual_length); in em28xx_dvb_urb_data_copy()
176 if (urb->iso_frame_desc[i].status < 0) { in em28xx_dvb_urb_data_copy()
178 urb->iso_frame_desc[i].status); in em28xx_dvb_urb_data_copy()
179 if (urb->iso_frame_desc[i].status != -EPROTO) in em28xx_dvb_urb_data_copy()
182 if (!urb->iso_frame_desc[i].actual_length) in em28xx_dvb_urb_data_copy()
184 dvb_dmx_swfilter(&dev->dvb->demux, in em28xx_dvb_urb_data_copy()
185 urb->transfer_buffer + in em28xx_dvb_urb_data_copy()
186 urb->iso_frame_desc[i].offset, in em28xx_dvb_urb_data_copy()
187 urb->iso_frame_desc[i].actual_length); in em28xx_dvb_urb_data_copy()
197 struct em28xx_i2c_bus *i2c_bus = dvb->adapter.priv; in em28xx_start_streaming()
198 struct em28xx *dev = i2c_bus->dev; in em28xx_start_streaming()
199 struct usb_device *udev = interface_to_usbdev(dev->intf); in em28xx_start_streaming()
202 if (dev->dvb_xfer_bulk) { in em28xx_start_streaming()
203 if (!dev->dvb_ep_bulk) in em28xx_start_streaming()
204 return -ENODEV; in em28xx_start_streaming()
205 dvb_max_packet_size = 512; /* USB 2.0 spec */ in em28xx_start_streaming()
209 if (!dev->dvb_ep_isoc) in em28xx_start_streaming()
210 return -ENODEV; in em28xx_start_streaming()
211 dvb_max_packet_size = dev->dvb_max_pkt_size_isoc; in em28xx_start_streaming()
215 dvb_alt = dev->dvb_alt_isoc; in em28xx_start_streaming()
218 if (!dev->board.has_dual_ts) in em28xx_start_streaming()
219 usb_set_interface(udev, dev->ifnum, dvb_alt); in em28xx_start_streaming()
231 dev->dvb_xfer_bulk, in em28xx_start_streaming()
240 struct em28xx_i2c_bus *i2c_bus = dvb->adapter.priv; in em28xx_stop_streaming()
241 struct em28xx *dev = i2c_bus->dev; in em28xx_stop_streaming()
250 struct dvb_demux *demux = feed->demux; in em28xx_start_feed()
251 struct em28xx_dvb *dvb = demux->priv; in em28xx_start_feed()
254 if (!demux->dmx.frontend) in em28xx_start_feed()
255 return -EINVAL; in em28xx_start_feed()
257 mutex_lock(&dvb->lock); in em28xx_start_feed()
258 dvb->nfeeds++; in em28xx_start_feed()
259 rc = dvb->nfeeds; in em28xx_start_feed()
261 if (dvb->nfeeds == 1) { in em28xx_start_feed()
267 mutex_unlock(&dvb->lock); in em28xx_start_feed()
273 struct dvb_demux *demux = feed->demux; in em28xx_stop_feed()
274 struct em28xx_dvb *dvb = demux->priv; in em28xx_stop_feed()
277 mutex_lock(&dvb->lock); in em28xx_stop_feed()
278 dvb->nfeeds--; in em28xx_stop_feed()
280 if (!dvb->nfeeds) in em28xx_stop_feed()
283 mutex_unlock(&dvb->lock); in em28xx_stop_feed()
287 /* ------------------------------------------------------------------ */
290 struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; in em28xx_dvb_bus_ctrl()
291 struct em28xx *dev = i2c_bus->dev; in em28xx_dvb_bus_ctrl()
299 /* ------------------------------------------------------------------ */
404 .microcode_name = "dvb-usb-terratec-h5-drxk.fw",
412 .microcode_name = "dvb-usb-hauppauge-hvr930c-drxk.fw",
421 .microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw",
434 .microcode_name = "dvb-demod-drxk-01.fw",
442 .microcode_name = "dvb-demod-drxk-pctv.fw",
451 struct em28xx_dvb *dvb = fe->sec_priv; in drxk_gate_ctrl()
455 return -EINVAL; in drxk_gate_ctrl()
458 down(&dvb->pll_mutex); in drxk_gate_ctrl()
459 status = dvb->gate_ctrl(fe, 1); in drxk_gate_ctrl()
461 status = dvb->gate_ctrl(fe, 0); in drxk_gate_ctrl()
462 up(&dvb->pll_mutex); in drxk_gate_ctrl()
475 { -1, -1, -1, -1}, in hauppauge_hvr930c_init()
490 { -1, -1, -1, -1}, in hauppauge_hvr930c_init()
518 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; in hauppauge_hvr930c_init()
521 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], in hauppauge_hvr930c_init()
542 { -1, -1, -1, -1}, in terratec_h5_init()
548 { -1, -1, -1, -1}, in terratec_h5_init()
575 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; in terratec_h5_init()
578 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], in terratec_h5_init()
589 * 0xff: unknown (does not affect DVB-T). in terratec_htc_stick_init()
590 * 0xf6: DRX-K (demodulator). in terratec_htc_stick_init()
591 * 0xe6: unknown (does not affect DVB-T). in terratec_htc_stick_init()
592 * 0xb6: unknown (does not affect DVB-T). in terratec_htc_stick_init()
599 { -1, -1, -1, -1}, in terratec_htc_stick_init()
604 { -1, -1, -1, -1}, in terratec_htc_stick_init()
629 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; in terratec_htc_stick_init()
632 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], in terratec_htc_stick_init()
647 { -1, -1, -1, -1}, in terratec_htc_usb_xs_init()
653 { -1, -1, -1, -1}, in terratec_htc_usb_xs_init()
688 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; in terratec_htc_usb_xs_init()
691 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], in terratec_htc_usb_xs_init()
718 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */ in pctv_520e_init()
721 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], in pctv_520e_init()
727 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in em28xx_pctv_290e_set_lna()
728 struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; in em28xx_pctv_290e_set_lna()
729 struct em28xx *dev = i2c_bus->dev; in em28xx_pctv_290e_set_lna()
731 struct em28xx_dvb *dvb = dev->dvb; in em28xx_pctv_290e_set_lna()
735 if (c->lna == 1) in em28xx_pctv_290e_set_lna()
740 ret = gpio_request_one(dvb->lna_gpio, flags, NULL); in em28xx_pctv_290e_set_lna()
742 dev_err(&dev->intf->dev, "gpio request failed %d\n", ret); in em28xx_pctv_290e_set_lna()
744 gpio_free(dvb->lna_gpio); in em28xx_pctv_290e_set_lna()
748 dev_warn(&dev->intf->dev, "%s: LNA control is disabled (lna=%u)\n", in em28xx_pctv_290e_set_lna()
749 KBUILD_MODNAME, c->lna); in em28xx_pctv_290e_set_lna()
756 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in em28xx_pctv_292e_set_lna()
757 struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; in em28xx_pctv_292e_set_lna()
758 struct em28xx *dev = i2c_bus->dev; in em28xx_pctv_292e_set_lna()
761 if (c->lna == 1) in em28xx_pctv_292e_set_lna()
771 /* Values extracted from a USB trace of the Terratec Windows driver */ in em28xx_mt352_terratec_xs_init()
841 /* sleeping ISDB-T */ in px_bcud_init()
842 dev->dvb->i2c_client_demod->addr = 0x14; in px_bcud_init()
844 i2c_master_send(dev->dvb->i2c_client_demod, in px_bcud_init()
846 /* sleeping ISDB-S */ in px_bcud_init()
847 dev->dvb->i2c_client_demod->addr = 0x15; in px_bcud_init()
849 i2c_master_send(dev->dvb->i2c_client_demod, regs2[i].r, in px_bcud_init()
936 /* ------------------------------------------------------------------ */
945 cfg.i2c_adap = &dev->i2c_adap[dev->def_i2c_bus]; in em28xx_attach_xc3028()
952 if (!dev->dvb->fe[0]) { in em28xx_attach_xc3028()
953 dev_err(&dev->intf->dev, in em28xx_attach_xc3028()
954 "dvb frontend not attached. Can't attach xc3028\n"); in em28xx_attach_xc3028()
955 return -EINVAL; in em28xx_attach_xc3028()
958 fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg); in em28xx_attach_xc3028()
960 dev_err(&dev->intf->dev, "xc3028 attach failed\n"); in em28xx_attach_xc3028()
961 dvb_frontend_detach(dev->dvb->fe[0]); in em28xx_attach_xc3028()
962 dev->dvb->fe[0] = NULL; in em28xx_attach_xc3028()
963 return -EINVAL; in em28xx_attach_xc3028()
966 dev_info(&dev->intf->dev, "xc3028 attached\n"); in em28xx_attach_xc3028()
971 /* ------------------------------------------------------------------ */
979 mutex_init(&dvb->lock); in em28xx_register_dvb()
982 result = dvb_register_adapter(&dvb->adapter, in em28xx_register_dvb()
983 dev_name(&dev->intf->dev), module, in em28xx_register_dvb()
986 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
992 dvb->adapter.mdev = dev->media_dev; in em28xx_register_dvb()
996 dvb->fe[0]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl; in em28xx_register_dvb()
997 if (dvb->fe[1]) in em28xx_register_dvb()
998 dvb->fe[1]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl; in em28xx_register_dvb()
1000 dvb->adapter.priv = &dev->i2c_bus[dev->def_i2c_bus]; in em28xx_register_dvb()
1003 result = dvb_register_frontend(&dvb->adapter, dvb->fe[0]); in em28xx_register_dvb()
1005 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1012 if (dvb->fe[1]) { in em28xx_register_dvb()
1013 result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]); in em28xx_register_dvb()
1015 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1023 dvb->demux.dmx.capabilities = in em28xx_register_dvb()
1026 dvb->demux.priv = dvb; in em28xx_register_dvb()
1027 dvb->demux.filternum = 256; in em28xx_register_dvb()
1028 dvb->demux.feednum = 256; in em28xx_register_dvb()
1029 dvb->demux.start_feed = em28xx_start_feed; in em28xx_register_dvb()
1030 dvb->demux.stop_feed = em28xx_stop_feed; in em28xx_register_dvb()
1032 result = dvb_dmx_init(&dvb->demux); in em28xx_register_dvb()
1034 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1040 dvb->dmxdev.filternum = 256; in em28xx_register_dvb()
1041 dvb->dmxdev.demux = &dvb->demux.dmx; in em28xx_register_dvb()
1042 dvb->dmxdev.capabilities = 0; in em28xx_register_dvb()
1043 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); in em28xx_register_dvb()
1045 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1051 dvb->fe_hw.source = DMX_FRONTEND_0; in em28xx_register_dvb()
1052 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); in em28xx_register_dvb()
1054 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1060 dvb->fe_mem.source = DMX_MEMORY_FE; in em28xx_register_dvb()
1061 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); in em28xx_register_dvb()
1063 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1069 result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); in em28xx_register_dvb()
1071 dev_warn(&dev->intf->dev, in em28xx_register_dvb()
1078 dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); in em28xx_register_dvb()
1081 if (!dev->has_video || dev->tuner_type == TUNER_ABSENT) in em28xx_register_dvb()
1084 result = dvb_create_media_graph(&dvb->adapter, create_rf_connector); in em28xx_register_dvb()
1091 dvb_net_release(&dvb->net); in em28xx_register_dvb()
1093 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); in em28xx_register_dvb()
1095 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); in em28xx_register_dvb()
1097 dvb_dmxdev_release(&dvb->dmxdev); in em28xx_register_dvb()
1099 dvb_dmx_release(&dvb->demux); in em28xx_register_dvb()
1101 if (dvb->fe[1]) in em28xx_register_dvb()
1102 dvb_unregister_frontend(dvb->fe[1]); in em28xx_register_dvb()
1103 dvb_unregister_frontend(dvb->fe[0]); in em28xx_register_dvb()
1105 if (dvb->fe[1]) in em28xx_register_dvb()
1106 dvb_frontend_detach(dvb->fe[1]); in em28xx_register_dvb()
1108 dvb_frontend_detach(dvb->fe[0]); in em28xx_register_dvb()
1109 dvb_unregister_adapter(&dvb->adapter); in em28xx_register_dvb()
1116 dvb_net_release(&dvb->net); in em28xx_unregister_dvb()
1117 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); in em28xx_unregister_dvb()
1118 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); in em28xx_unregister_dvb()
1119 dvb_dmxdev_release(&dvb->dmxdev); in em28xx_unregister_dvb()
1120 dvb_dmx_release(&dvb->demux); in em28xx_unregister_dvb()
1121 if (dvb->fe[1]) in em28xx_unregister_dvb()
1122 dvb_unregister_frontend(dvb->fe[1]); in em28xx_unregister_dvb()
1123 dvb_unregister_frontend(dvb->fe[0]); in em28xx_unregister_dvb()
1124 if (dvb->fe[1] && !dvb->dont_attach_fe1) in em28xx_unregister_dvb()
1125 dvb_frontend_detach(dvb->fe[1]); in em28xx_unregister_dvb()
1126 dvb_frontend_detach(dvb->fe[0]); in em28xx_unregister_dvb()
1127 dvb_unregister_adapter(&dvb->adapter); in em28xx_unregister_dvb()
1132 struct em28xx_dvb *dvb = dev->dvb; in em28174_dvb_init_pctv_460e()
1136 /* attach demod + tuner combo */ in em28174_dvb_init_pctv_460e()
1143 dvb->i2c_client_demod = dvb_module_probe("tda10071", "tda10071_cx24118", in em28174_dvb_init_pctv_460e()
1144 &dev->i2c_adap[dev->def_i2c_bus], in em28174_dvb_init_pctv_460e()
1146 if (!dvb->i2c_client_demod) in em28174_dvb_init_pctv_460e()
1147 return -ENODEV; in em28174_dvb_init_pctv_460e()
1149 dvb->fe[0] = tda10071_pdata.get_dvb_frontend(dvb->i2c_client_demod); in em28174_dvb_init_pctv_460e()
1151 /* attach SEC */ in em28174_dvb_init_pctv_460e()
1152 a8293_pdata.dvb_frontend = dvb->fe[0]; in em28174_dvb_init_pctv_460e()
1154 dvb->i2c_client_sec = dvb_module_probe("a8293", NULL, in em28174_dvb_init_pctv_460e()
1155 &dev->i2c_adap[dev->def_i2c_bus], in em28174_dvb_init_pctv_460e()
1157 if (!dvb->i2c_client_sec) { in em28174_dvb_init_pctv_460e()
1158 dvb_module_release(dvb->i2c_client_demod); in em28174_dvb_init_pctv_460e()
1159 return -ENODEV; in em28174_dvb_init_pctv_460e()
1167 struct em28xx_dvb *dvb = dev->dvb; in em28178_dvb_init_pctv_461e()
1173 /* attach demod */ in em28178_dvb_init_pctv_461e()
1181 dvb->i2c_client_demod = dvb_module_probe("m88ds3103", NULL, in em28178_dvb_init_pctv_461e()
1182 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_pctv_461e()
1184 if (!dvb->i2c_client_demod) in em28178_dvb_init_pctv_461e()
1185 return -ENODEV; in em28178_dvb_init_pctv_461e()
1187 dvb->fe[0] = m88ds3103_pdata.get_dvb_frontend(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e()
1188 i2c_adapter = m88ds3103_pdata.get_i2c_adapter(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e()
1190 /* attach tuner */ in em28178_dvb_init_pctv_461e()
1191 ts2020_config.fe = dvb->fe[0]; in em28178_dvb_init_pctv_461e()
1193 dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022", in em28178_dvb_init_pctv_461e()
1196 if (!dvb->i2c_client_tuner) { in em28178_dvb_init_pctv_461e()
1197 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e()
1198 return -ENODEV; in em28178_dvb_init_pctv_461e()
1202 dvb->fe[0]->ops.read_signal_strength = in em28178_dvb_init_pctv_461e()
1203 dvb->fe[0]->ops.tuner_ops.get_rf_strength; in em28178_dvb_init_pctv_461e()
1205 /* attach SEC */ in em28178_dvb_init_pctv_461e()
1206 a8293_pdata.dvb_frontend = dvb->fe[0]; in em28178_dvb_init_pctv_461e()
1213 dvb->i2c_client_sec = dvb_module_probe("a8293", NULL, in em28178_dvb_init_pctv_461e()
1214 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_pctv_461e()
1216 if (!dvb->i2c_client_sec) { in em28178_dvb_init_pctv_461e()
1217 dvb_module_release(dvb->i2c_client_tuner); in em28178_dvb_init_pctv_461e()
1218 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e()
1219 return -ENODEV; in em28178_dvb_init_pctv_461e()
1227 struct em28xx_dvb *dvb = dev->dvb; in em28178_dvb_init_pctv_461e_v2()
1233 /* attach demod */ in em28178_dvb_init_pctv_461e_v2()
1242 dvb->i2c_client_demod = dvb_module_probe("m88ds3103", "m88ds3103b", in em28178_dvb_init_pctv_461e_v2()
1243 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_pctv_461e_v2()
1246 if (!dvb->i2c_client_demod) in em28178_dvb_init_pctv_461e_v2()
1247 return -ENODEV; in em28178_dvb_init_pctv_461e_v2()
1249 dvb->fe[0] = m88ds3103_pdata.get_dvb_frontend(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e_v2()
1250 i2c_adapter = m88ds3103_pdata.get_i2c_adapter(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e_v2()
1252 /* attach tuner */ in em28178_dvb_init_pctv_461e_v2()
1253 ts2020_config.fe = dvb->fe[0]; in em28178_dvb_init_pctv_461e_v2()
1254 dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022", in em28178_dvb_init_pctv_461e_v2()
1257 if (!dvb->i2c_client_tuner) { in em28178_dvb_init_pctv_461e_v2()
1258 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e_v2()
1259 return -ENODEV; in em28178_dvb_init_pctv_461e_v2()
1263 dvb->fe[0]->ops.read_signal_strength = in em28178_dvb_init_pctv_461e_v2()
1264 dvb->fe[0]->ops.tuner_ops.get_rf_strength; in em28178_dvb_init_pctv_461e_v2()
1266 /* attach SEC */ in em28178_dvb_init_pctv_461e_v2()
1267 a8293_pdata.dvb_frontend = dvb->fe[0]; in em28178_dvb_init_pctv_461e_v2()
1268 dvb->i2c_client_sec = dvb_module_probe("a8293", NULL, in em28178_dvb_init_pctv_461e_v2()
1269 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_pctv_461e_v2()
1271 if (!dvb->i2c_client_sec) { in em28178_dvb_init_pctv_461e_v2()
1272 dvb_module_release(dvb->i2c_client_tuner); in em28178_dvb_init_pctv_461e_v2()
1273 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_pctv_461e_v2()
1274 return -ENODEV; in em28178_dvb_init_pctv_461e_v2()
1282 struct em28xx_dvb *dvb = dev->dvb; in em28178_dvb_init_pctv_292e()
1287 /* attach demod */ in em28178_dvb_init_pctv_292e()
1289 si2168_config.fe = &dvb->fe[0]; in em28178_dvb_init_pctv_292e()
1293 dvb->i2c_client_demod = dvb_module_probe("si2168", NULL, in em28178_dvb_init_pctv_292e()
1294 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_pctv_292e()
1296 if (!dvb->i2c_client_demod) in em28178_dvb_init_pctv_292e()
1297 return -ENODEV; in em28178_dvb_init_pctv_292e()
1299 /* attach tuner */ in em28178_dvb_init_pctv_292e()
1300 si2157_config.fe = dvb->fe[0]; in em28178_dvb_init_pctv_292e()
1303 si2157_config.mdev = dev->media_dev; in em28178_dvb_init_pctv_292e()
1305 dvb->i2c_client_tuner = dvb_module_probe("si2157", NULL, in em28178_dvb_init_pctv_292e()
1308 if (!dvb->i2c_client_tuner) { in em28178_dvb_init_pctv_292e()
1309 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_pctv_292e()
1310 return -ENODEV; in em28178_dvb_init_pctv_292e()
1312 dvb->fe[0]->ops.set_lna = em28xx_pctv_292e_set_lna; in em28178_dvb_init_pctv_292e()
1319 struct em28xx_dvb *dvb = dev->dvb; in em28178_dvb_init_terratec_t2_stick_hd()
1324 /* attach demod */ in em28178_dvb_init_terratec_t2_stick_hd()
1326 si2168_config.fe = &dvb->fe[0]; in em28178_dvb_init_terratec_t2_stick_hd()
1329 dvb->i2c_client_demod = dvb_module_probe("si2168", NULL, in em28178_dvb_init_terratec_t2_stick_hd()
1330 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_terratec_t2_stick_hd()
1332 if (!dvb->i2c_client_demod) in em28178_dvb_init_terratec_t2_stick_hd()
1333 return -ENODEV; in em28178_dvb_init_terratec_t2_stick_hd()
1335 /* attach tuner */ in em28178_dvb_init_terratec_t2_stick_hd()
1337 si2157_config.fe = dvb->fe[0]; in em28178_dvb_init_terratec_t2_stick_hd()
1340 si2157_config.mdev = dev->media_dev; in em28178_dvb_init_terratec_t2_stick_hd()
1342 dvb->i2c_client_tuner = dvb_module_probe("si2157", "si2146", in em28178_dvb_init_terratec_t2_stick_hd()
1345 if (!dvb->i2c_client_tuner) { in em28178_dvb_init_terratec_t2_stick_hd()
1346 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_terratec_t2_stick_hd()
1347 return -ENODEV; in em28178_dvb_init_terratec_t2_stick_hd()
1355 struct em28xx_dvb *dvb = dev->dvb; in em28178_dvb_init_plex_px_bcud()
1359 /* attach demod */ in em28178_dvb_init_plex_px_bcud()
1360 dvb->i2c_client_demod = dvb_module_probe("tc90522", "tc90522sat", in em28178_dvb_init_plex_px_bcud()
1361 &dev->i2c_adap[dev->def_i2c_bus], in em28178_dvb_init_plex_px_bcud()
1363 if (!dvb->i2c_client_demod) in em28178_dvb_init_plex_px_bcud()
1364 return -ENODEV; in em28178_dvb_init_plex_px_bcud()
1366 /* attach tuner */ in em28178_dvb_init_plex_px_bcud()
1370 dvb->i2c_client_tuner = dvb_module_probe("qm1d1c0042", NULL, in em28178_dvb_init_plex_px_bcud()
1373 if (!dvb->i2c_client_tuner) { in em28178_dvb_init_plex_px_bcud()
1374 dvb_module_release(dvb->i2c_client_demod); in em28178_dvb_init_plex_px_bcud()
1375 return -ENODEV; in em28178_dvb_init_plex_px_bcud()
1378 dvb->fe[0] = tc90522_config.fe; in em28178_dvb_init_plex_px_bcud()
1386 struct em28xx_dvb *dvb = dev->dvb; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1392 /* attach demod */ in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1394 si2168_config.fe = &dvb->fe[0]; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1397 addr = (dev->ts == PRIMARY_TS) ? 0x64 : 0x67; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1399 dvb->i2c_client_demod = dvb_module_probe("si2168", NULL, in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1400 &dev->i2c_adap[dev->def_i2c_bus], in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1402 if (!dvb->i2c_client_demod) in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1403 return -ENODEV; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1405 /* attach tuner */ in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1407 si2157_config.fe = dvb->fe[0]; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1410 si2157_config.mdev = dev->media_dev; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1412 addr = (dev->ts == PRIMARY_TS) ? 0x60 : 0x63; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1414 dvb->i2c_client_tuner = dvb_module_probe("si2157", NULL, in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1417 if (!dvb->i2c_client_tuner) { in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1418 dvb_module_release(dvb->i2c_client_demod); in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1419 return -ENODEV; in em28174_dvb_init_hauppauge_wintv_dualhd_dvb()
1427 struct em28xx_dvb *dvb = dev->dvb; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1433 /* attach demod */ in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1435 lgdt3306a_config.fe = &dvb->fe[0]; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1437 addr = (dev->ts == PRIMARY_TS) ? 0x59 : 0x0e; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1439 dvb->i2c_client_demod = dvb_module_probe("lgdt3306a", NULL, in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1440 &dev->i2c_adap[dev->def_i2c_bus], in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1442 if (!dvb->i2c_client_demod) in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1443 return -ENODEV; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1445 /* attach tuner */ in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1446 si2157_config.fe = dvb->fe[0]; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1450 si2157_config.mdev = dev->media_dev; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1452 addr = (dev->ts == PRIMARY_TS) ? 0x60 : 0x62; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1454 dvb->i2c_client_tuner = dvb_module_probe("si2157", NULL, in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1457 if (!dvb->i2c_client_tuner) { in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1458 dvb_module_release(dvb->i2c_client_demod); in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1459 return -ENODEV; in em28174_dvb_init_hauppauge_wintv_dualhd_01595()
1467 struct em28xx_dvb *dvb = dev->dvb; in em2874_dvb_init_hauppauge_usb_quadhd()
1471 /* attach demod/tuner combo */ in em2874_dvb_init_hauppauge_usb_quadhd()
1472 mxl692_config.id = (dev->ts == PRIMARY_TS) ? 0 : 1; in em2874_dvb_init_hauppauge_usb_quadhd()
1473 mxl692_config.fe = &dvb->fe[0]; in em2874_dvb_init_hauppauge_usb_quadhd()
1474 addr = (dev->ts == PRIMARY_TS) ? 0x60 : 0x63; in em2874_dvb_init_hauppauge_usb_quadhd()
1476 dvb->i2c_client_demod = dvb_module_probe("mxl692", NULL, in em2874_dvb_init_hauppauge_usb_quadhd()
1477 &dev->i2c_adap[dev->def_i2c_bus], in em2874_dvb_init_hauppauge_usb_quadhd()
1479 if (!dvb->i2c_client_demod) in em2874_dvb_init_hauppauge_usb_quadhd()
1480 return -ENODEV; in em2874_dvb_init_hauppauge_usb_quadhd()
1491 if (dev->is_audio_only) { in em28xx_dvb_init()
1496 if (!dev->board.has_dvb) { in em28xx_dvb_init()
1501 dev_info(&dev->intf->dev, "Binding DVB extension\n"); in em28xx_dvb_init()
1505 return -ENOMEM; in em28xx_dvb_init()
1507 dev->dvb = dvb; in em28xx_dvb_init()
1508 dvb->fe[0] = NULL; in em28xx_dvb_init()
1509 dvb->fe[1] = NULL; in em28xx_dvb_init()
1511 /* pre-allocate DVB usb transfer buffers */ in em28xx_dvb_init()
1512 if (dev->dvb_xfer_bulk) { in em28xx_dvb_init()
1514 dev->dvb_xfer_bulk, in em28xx_dvb_init()
1520 dev->dvb_xfer_bulk, in em28xx_dvb_init()
1522 dev->dvb_max_pkt_size_isoc, in em28xx_dvb_init()
1526 dev_err(&dev->intf->dev, in em28xx_dvb_init()
1527 "failed to pre-allocate USB transfer buffers for DVB.\n"); in em28xx_dvb_init()
1529 dev->dvb = NULL; in em28xx_dvb_init()
1533 mutex_lock(&dev->lock); in em28xx_dvb_init()
1536 switch (dev->model) { in em28xx_dvb_init()
1538 dvb->fe[0] = dvb_attach(s921_attach, in em28xx_dvb_init()
1540 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1542 if (!dvb->fe[0]) { in em28xx_dvb_init()
1543 result = -EINVAL; in em28xx_dvb_init()
1552 dvb->fe[0] = dvb_attach(lgdt330x_attach, in em28xx_dvb_init()
1555 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1557 result = -EINVAL; in em28xx_dvb_init()
1562 dvb->fe[0] = dvb_attach(zl10353_attach, in em28xx_dvb_init()
1564 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1566 result = -EINVAL; in em28xx_dvb_init()
1574 dvb->fe[0] = dvb_attach(zl10353_attach, in em28xx_dvb_init()
1576 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1578 result = -EINVAL; in em28xx_dvb_init()
1591 dvb->fe[0] = dvb_attach(zl10353_attach, in em28xx_dvb_init()
1593 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1594 if (!dvb->fe[0]) in em28xx_dvb_init()
1595 dvb->fe[0] = dvb_attach(mt352_attach, in em28xx_dvb_init()
1597 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1600 result = -EINVAL; in em28xx_dvb_init()
1605 dvb->fe[0] = dvb_attach(zl10353_attach, in em28xx_dvb_init()
1607 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1608 if (dvb->fe[0]) { in em28xx_dvb_init()
1609 dvb_attach(mt2060_attach, dvb->fe[0], in em28xx_dvb_init()
1610 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1615 dvb->fe[0] = dvb_attach(zl10353_attach, in em28xx_dvb_init()
1617 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1618 if (dvb->fe[0]) in em28xx_dvb_init()
1619 dvb_attach(qt1010_attach, dvb->fe[0], in em28xx_dvb_init()
1620 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1625 dvb->fe[0] = dvb_attach(s5h1409_attach, in em28xx_dvb_init()
1627 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1629 result = -EINVAL; in em28xx_dvb_init()
1634 dvb->fe[0] = dvb_attach(lgdt330x_attach, in em28xx_dvb_init()
1637 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1638 if (dvb->fe[0]) { in em28xx_dvb_init()
1639 if (!dvb_attach(simple_tuner_attach, dvb->fe[0], in em28xx_dvb_init()
1640 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1642 result = -EINVAL; in em28xx_dvb_init()
1649 dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL, in em28xx_dvb_init()
1650 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1651 &dev->intf->dev); in em28xx_dvb_init()
1653 result = -EINVAL; in em28xx_dvb_init()
1659 dvb->fe[0] = dvb_attach(tda10023_attach, in em28xx_dvb_init()
1661 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1663 if (dvb->fe[0]) { in em28xx_dvb_init()
1664 if (!dvb_attach(simple_tuner_attach, dvb->fe[0], in em28xx_dvb_init()
1665 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1667 result = -EINVAL; in em28xx_dvb_init()
1673 dvb->fe[0] = dvb_attach(lgdt3305_attach, in em28xx_dvb_init()
1675 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1676 if (!dvb->fe[0]) { in em28xx_dvb_init()
1677 result = -EINVAL; in em28xx_dvb_init()
1680 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1681 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1683 dvb_frontend_detach(dvb->fe[0]); in em28xx_dvb_init()
1684 result = -EINVAL; in em28xx_dvb_init()
1690 dvb->lna_gpio = CXD2820R_GPIO_E | CXD2820R_GPIO_O | in em28xx_dvb_init()
1692 dvb->fe[0] = dvb_attach(cxd2820r_attach, in em28xx_dvb_init()
1694 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1695 &dvb->lna_gpio); in em28xx_dvb_init()
1696 if (dvb->fe[0]) { in em28xx_dvb_init()
1697 /* FE 0 attach tuner */ in em28xx_dvb_init()
1699 dvb->fe[0], in em28xx_dvb_init()
1701 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1703 dvb_frontend_detach(dvb->fe[0]); in em28xx_dvb_init()
1704 result = -EINVAL; in em28xx_dvb_init()
1709 /* enable LNA for DVB-T, DVB-T2 and DVB-C */ in em28xx_dvb_init()
1710 result = gpio_request_one(dvb->lna_gpio, in em28xx_dvb_init()
1713 dev_err(&dev->intf->dev, in em28xx_dvb_init()
1717 gpio_free(dvb->lna_gpio); in em28xx_dvb_init()
1721 dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna; in em28xx_dvb_init()
1731 dvb->fe[0] = dvb_attach(drxk_attach, in em28xx_dvb_init()
1733 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1734 if (!dvb->fe[0]) { in em28xx_dvb_init()
1735 result = -EINVAL; in em28xx_dvb_init()
1739 dvb->fe[0]->sec_priv = dvb; in em28xx_dvb_init()
1740 sema_init(&dvb->pll_mutex, 1); in em28xx_dvb_init()
1741 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl; in em28xx_dvb_init()
1742 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; in em28xx_dvb_init()
1744 /* Attach xc5000 */ in em28xx_dvb_init()
1748 if (dvb->fe[0]->ops.i2c_gate_ctrl) in em28xx_dvb_init()
1749 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); in em28xx_dvb_init()
1750 if (!dvb_attach(xc5000_attach, dvb->fe[0], in em28xx_dvb_init()
1751 &dev->i2c_adap[dev->def_i2c_bus], &cfg)) { in em28xx_dvb_init()
1752 result = -EINVAL; in em28xx_dvb_init()
1755 if (dvb->fe[0]->ops.i2c_gate_ctrl) in em28xx_dvb_init()
1756 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0); in em28xx_dvb_init()
1763 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, in em28xx_dvb_init()
1764 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1765 if (!dvb->fe[0]) { in em28xx_dvb_init()
1766 result = -EINVAL; in em28xx_dvb_init()
1770 dvb->fe[0]->sec_priv = dvb; in em28xx_dvb_init()
1771 sema_init(&dvb->pll_mutex, 1); in em28xx_dvb_init()
1772 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl; in em28xx_dvb_init()
1773 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; in em28xx_dvb_init()
1775 /* Attach tda18271 to DVB-C frontend */ in em28xx_dvb_init()
1776 if (dvb->fe[0]->ops.i2c_gate_ctrl) in em28xx_dvb_init()
1777 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); in em28xx_dvb_init()
1778 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], in em28xx_dvb_init()
1779 &dev->i2c_adap[dev->def_i2c_bus], 0x60)) { in em28xx_dvb_init()
1780 result = -EINVAL; in em28xx_dvb_init()
1783 if (dvb->fe[0]->ops.i2c_gate_ctrl) in em28xx_dvb_init()
1784 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0); in em28xx_dvb_init()
1788 dvb->fe[0] = dvb_attach(mb86a20s_attach, in em28xx_dvb_init()
1790 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1791 if (dvb->fe[0]) in em28xx_dvb_init()
1792 dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1793 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1803 /* attach demodulator */ in em28xx_dvb_init()
1804 dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, in em28xx_dvb_init()
1805 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1807 if (dvb->fe[0]) { in em28xx_dvb_init()
1808 /* disable I2C-gate */ in em28xx_dvb_init()
1809 dvb->fe[0]->ops.i2c_gate_ctrl = NULL; in em28xx_dvb_init()
1811 /* attach tuner */ in em28xx_dvb_init()
1812 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1813 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1815 dvb_frontend_detach(dvb->fe[0]); in em28xx_dvb_init()
1816 result = -EINVAL; in em28xx_dvb_init()
1825 /* attach demodulator */ in em28xx_dvb_init()
1826 dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, in em28xx_dvb_init()
1827 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1829 if (dvb->fe[0]) { in em28xx_dvb_init()
1830 /* attach tuner */ in em28xx_dvb_init()
1831 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1832 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1834 dvb_frontend_detach(dvb->fe[0]); in em28xx_dvb_init()
1835 result = -EINVAL; in em28xx_dvb_init()
1845 /* attach demodulator */ in em28xx_dvb_init()
1846 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, in em28xx_dvb_init()
1847 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1848 if (!dvb->fe[0]) { in em28xx_dvb_init()
1849 result = -EINVAL; in em28xx_dvb_init()
1853 /* Attach the demodulator. */ in em28xx_dvb_init()
1854 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1855 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1857 result = -EINVAL; in em28xx_dvb_init()
1864 /* attach demodulator */ in em28xx_dvb_init()
1865 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, in em28xx_dvb_init()
1866 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1867 if (!dvb->fe[0]) { in em28xx_dvb_init()
1868 result = -EINVAL; in em28xx_dvb_init()
1872 /* Attach the demodulator. */ in em28xx_dvb_init()
1873 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1874 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1876 result = -EINVAL; in em28xx_dvb_init()
1881 dvb->fe[0] = dvb_attach(lgdt3305_attach, in em28xx_dvb_init()
1883 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1884 if (!dvb->fe[0]) { in em28xx_dvb_init()
1885 result = -EINVAL; in em28xx_dvb_init()
1889 /* Attach the demodulator. */ in em28xx_dvb_init()
1890 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, in em28xx_dvb_init()
1891 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1893 result = -EINVAL; in em28xx_dvb_init()
1899 struct i2c_adapter *adapter = &dev->i2c_adap[dev->def_i2c_bus]; in em28xx_dvb_init()
1901 dvb->fe[0] = dvb_attach(lgdt3305_attach, in em28xx_dvb_init()
1903 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1904 if (!dvb->fe[0]) { in em28xx_dvb_init()
1905 result = -EINVAL; in em28xx_dvb_init()
1909 /* attach tuner */ in em28xx_dvb_init()
1910 kworld_ub435q_v3_config.fe = dvb->fe[0]; in em28xx_dvb_init()
1912 dvb->i2c_client_tuner = dvb_module_probe("tda18212", NULL, in em28xx_dvb_init()
1915 if (!dvb->i2c_client_tuner) { in em28xx_dvb_init()
1916 dvb_frontend_detach(dvb->fe[0]); in em28xx_dvb_init()
1917 result = -ENODEV; in em28xx_dvb_init()
1923 dvb->fe[0] = dvb_attach(drx39xxj_attach, in em28xx_dvb_init()
1924 &dev->i2c_adap[dev->def_i2c_bus]); in em28xx_dvb_init()
1925 if (dvb->fe[0]) { in em28xx_dvb_init()
1926 dvb->fe[0] = dvb_attach(tda18271_attach, dvb->fe[0], in em28xx_dvb_init()
1928 &dev->i2c_adap[dev->def_i2c_bus], in em28xx_dvb_init()
1930 if (!dvb->fe[0]) { in em28xx_dvb_init()
1931 result = -EINVAL; in em28xx_dvb_init()
1977 dev_err(&dev->intf->dev, in em28xx_dvb_init()
1981 if (!dvb->fe[0]) { in em28xx_dvb_init()
1982 dev_err(&dev->intf->dev, "frontend initialization failed\n"); in em28xx_dvb_init()
1983 result = -EINVAL; in em28xx_dvb_init()
1986 /* define general-purpose callback pointer */ in em28xx_dvb_init()
1987 dvb->fe[0]->callback = em28xx_tuner_callback; in em28xx_dvb_init()
1988 if (dvb->fe[1]) in em28xx_dvb_init()
1989 dvb->fe[1]->callback = em28xx_tuner_callback; in em28xx_dvb_init()
1992 result = em28xx_register_dvb(dvb, THIS_MODULE, dev, &dev->intf->dev); in em28xx_dvb_init()
1997 if (dev->dvb_xfer_bulk) { in em28xx_dvb_init()
2000 dvb_alt = dev->dvb_alt_isoc; in em28xx_dvb_init()
2003 udev = interface_to_usbdev(dev->intf); in em28xx_dvb_init()
2004 usb_set_interface(udev, dev->ifnum, dvb_alt); in em28xx_dvb_init()
2005 dev_info(&dev->intf->dev, "DVB extension successfully initialized\n"); in em28xx_dvb_init()
2007 kref_get(&dev->ref); in em28xx_dvb_init()
2011 mutex_unlock(&dev->lock); in em28xx_dvb_init()
2017 dev->dvb = NULL; in em28xx_dvb_init()
2023 ops->set_voltage = NULL; in prevent_sleep()
2024 ops->sleep = NULL; in prevent_sleep()
2025 ops->tuner_ops.sleep = NULL; in prevent_sleep()
2032 if (dev->is_audio_only) { in em28xx_dvb_fini()
2037 if (!dev->board.has_dvb) { in em28xx_dvb_fini()
2042 if (!dev->dvb) in em28xx_dvb_fini()
2045 dev_info(&dev->intf->dev, "Closing DVB extension\n"); in em28xx_dvb_fini()
2047 dvb = dev->dvb; in em28xx_dvb_fini()
2051 if (dev->disconnected) { in em28xx_dvb_fini()
2056 if (dvb->fe[0]) { in em28xx_dvb_fini()
2057 prevent_sleep(&dvb->fe[0]->ops); in em28xx_dvb_fini()
2058 dvb->fe[0]->exit = DVB_FE_DEVICE_REMOVED; in em28xx_dvb_fini()
2060 if (dvb->fe[1]) { in em28xx_dvb_fini()
2061 prevent_sleep(&dvb->fe[1]->ops); in em28xx_dvb_fini()
2062 dvb->fe[1]->exit = DVB_FE_DEVICE_REMOVED; in em28xx_dvb_fini()
2069 dvb_module_release(dvb->i2c_client_sec); in em28xx_dvb_fini()
2070 dvb_module_release(dvb->i2c_client_tuner); in em28xx_dvb_fini()
2071 dvb_module_release(dvb->i2c_client_demod); in em28xx_dvb_fini()
2074 dev->dvb = NULL; in em28xx_dvb_fini()
2075 kref_put(&dev->ref, em28xx_free_device); in em28xx_dvb_fini()
2084 if (dev->is_audio_only) in em28xx_dvb_suspend()
2087 if (!dev->board.has_dvb) in em28xx_dvb_suspend()
2090 dev_info(&dev->intf->dev, "Suspending DVB extension\n"); in em28xx_dvb_suspend()
2091 if (dev->dvb) { in em28xx_dvb_suspend()
2092 struct em28xx_dvb *dvb = dev->dvb; in em28xx_dvb_suspend()
2094 if (dvb->fe[0]) { in em28xx_dvb_suspend()
2095 ret = dvb_frontend_suspend(dvb->fe[0]); in em28xx_dvb_suspend()
2096 dev_info(&dev->intf->dev, "fe0 suspend %d\n", ret); in em28xx_dvb_suspend()
2098 if (dvb->fe[1]) { in em28xx_dvb_suspend()
2099 dvb_frontend_suspend(dvb->fe[1]); in em28xx_dvb_suspend()
2100 dev_info(&dev->intf->dev, "fe1 suspend %d\n", ret); in em28xx_dvb_suspend()
2111 if (dev->is_audio_only) in em28xx_dvb_resume()
2114 if (!dev->board.has_dvb) in em28xx_dvb_resume()
2117 dev_info(&dev->intf->dev, "Resuming DVB extension\n"); in em28xx_dvb_resume()
2118 if (dev->dvb) { in em28xx_dvb_resume()
2119 struct em28xx_dvb *dvb = dev->dvb; in em28xx_dvb_resume()
2121 if (dvb->fe[0]) { in em28xx_dvb_resume()
2122 ret = dvb_frontend_resume(dvb->fe[0]); in em28xx_dvb_resume()
2123 dev_info(&dev->intf->dev, "fe0 resume %d\n", ret); in em28xx_dvb_resume()
2126 if (dvb->fe[1]) { in em28xx_dvb_resume()
2127 ret = dvb_frontend_resume(dvb->fe[1]); in em28xx_dvb_resume()
2128 dev_info(&dev->intf->dev, "fe1 resume %d\n", ret); in em28xx_dvb_resume()