Lines Matching refs:adap

16 	struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;  in dvb_usb_ctrl_feed()  local
19 if (adap == NULL) in dvb_usb_ctrl_feed()
22 if ((adap->active_fe < 0) || in dvb_usb_ctrl_feed()
23 (adap->active_fe >= adap->num_frontends_initialized)) { in dvb_usb_ctrl_feed()
27 newfeedcount = adap->feedcount + (onoff ? 1 : -1); in dvb_usb_ctrl_feed()
32 usb_urb_kill(&adap->fe_adap[adap->active_fe].stream); in dvb_usb_ctrl_feed()
34 if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { in dvb_usb_ctrl_feed()
35 ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 0); in dvb_usb_ctrl_feed()
43 adap->feedcount = newfeedcount; in dvb_usb_ctrl_feed()
47 adap->fe_adap[adap->active_fe].pid_filtering ? in dvb_usb_ctrl_feed()
50 if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER && in dvb_usb_ctrl_feed()
51 adap->fe_adap[adap->active_fe].pid_filtering && in dvb_usb_ctrl_feed()
52 adap->props.fe[adap->active_fe].pid_filter != NULL) in dvb_usb_ctrl_feed()
53 adap->props.fe[adap->active_fe].pid_filter(adap, dvbdmxfeed->index, dvbdmxfeed->pid, onoff); in dvb_usb_ctrl_feed()
58 if (adap->feedcount == onoff && adap->feedcount > 0) { in dvb_usb_ctrl_feed()
60 if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER && in dvb_usb_ctrl_feed()
61 adap->props.fe[adap->active_fe].caps & in dvb_usb_ctrl_feed()
63 adap->props.fe[adap->active_fe].pid_filter_ctrl != NULL) { in dvb_usb_ctrl_feed()
64 ret = adap->props.fe[adap->active_fe].pid_filter_ctrl(adap, in dvb_usb_ctrl_feed()
65 adap->fe_adap[adap->active_fe].pid_filtering); in dvb_usb_ctrl_feed()
72 if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { in dvb_usb_ctrl_feed()
73 ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 1); in dvb_usb_ctrl_feed()
81 usb_urb_submit(&adap->fe_adap[adap->active_fe].stream); in dvb_usb_ctrl_feed()
99 static int dvb_usb_media_device_init(struct dvb_usb_adapter *adap) in dvb_usb_media_device_init() argument
103 struct dvb_usb_device *d = adap->dev; in dvb_usb_media_device_init()
112 dvb_register_media_controller(&adap->dvb_adap, mdev); in dvb_usb_media_device_init()
119 static int dvb_usb_media_device_register(struct dvb_usb_adapter *adap) in dvb_usb_media_device_register() argument
122 return media_device_register(adap->dvb_adap.mdev); in dvb_usb_media_device_register()
128 static void dvb_usb_media_device_unregister(struct dvb_usb_adapter *adap) in dvb_usb_media_device_unregister() argument
131 if (!adap->dvb_adap.mdev) in dvb_usb_media_device_unregister()
134 mutex_lock(&adap->dvb_adap.mdev_lock); in dvb_usb_media_device_unregister()
136 media_device_unregister(adap->dvb_adap.mdev); in dvb_usb_media_device_unregister()
137 media_device_cleanup(adap->dvb_adap.mdev); in dvb_usb_media_device_unregister()
138 kfree(adap->dvb_adap.mdev); in dvb_usb_media_device_unregister()
139 adap->dvb_adap.mdev = NULL; in dvb_usb_media_device_unregister()
141 mutex_unlock(&adap->dvb_adap.mdev_lock); in dvb_usb_media_device_unregister()
145 int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) in dvb_usb_adapter_dvb_init() argument
148 int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name, in dvb_usb_adapter_dvb_init()
149 adap->dev->owner, &adap->dev->udev->dev, in dvb_usb_adapter_dvb_init()
156 adap->dvb_adap.priv = adap; in dvb_usb_adapter_dvb_init()
158 ret = dvb_usb_media_device_init(adap); in dvb_usb_adapter_dvb_init()
164 if (adap->dev->props.read_mac_address) { in dvb_usb_adapter_dvb_init()
165 if (adap->dev->props.read_mac_address(adap->dev, adap->dvb_adap.proposed_mac) == 0) in dvb_usb_adapter_dvb_init()
166 info("MAC address: %pM", adap->dvb_adap.proposed_mac); in dvb_usb_adapter_dvb_init()
172 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; in dvb_usb_adapter_dvb_init()
173 adap->demux.priv = adap; in dvb_usb_adapter_dvb_init()
175 adap->demux.filternum = 0; in dvb_usb_adapter_dvb_init()
176 for (i = 0; i < adap->props.num_frontends; i++) { in dvb_usb_adapter_dvb_init()
177 if (adap->demux.filternum < adap->fe_adap[i].max_feed_count) in dvb_usb_adapter_dvb_init()
178 adap->demux.filternum = adap->fe_adap[i].max_feed_count; in dvb_usb_adapter_dvb_init()
180 adap->demux.feednum = adap->demux.filternum; in dvb_usb_adapter_dvb_init()
181 adap->demux.start_feed = dvb_usb_start_feed; in dvb_usb_adapter_dvb_init()
182 adap->demux.stop_feed = dvb_usb_stop_feed; in dvb_usb_adapter_dvb_init()
183 adap->demux.write_to_decoder = NULL; in dvb_usb_adapter_dvb_init()
184 if ((ret = dvb_dmx_init(&adap->demux)) < 0) { in dvb_usb_adapter_dvb_init()
189 adap->dmxdev.filternum = adap->demux.filternum; in dvb_usb_adapter_dvb_init()
190 adap->dmxdev.demux = &adap->demux.dmx; in dvb_usb_adapter_dvb_init()
191 adap->dmxdev.capabilities = 0; in dvb_usb_adapter_dvb_init()
192 if ((ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap)) < 0) { in dvb_usb_adapter_dvb_init()
197 if ((ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, in dvb_usb_adapter_dvb_init()
198 &adap->demux.dmx)) < 0) { in dvb_usb_adapter_dvb_init()
203 adap->state |= DVB_USB_ADAP_STATE_DVB; in dvb_usb_adapter_dvb_init()
207 dvb_dmxdev_release(&adap->dmxdev); in dvb_usb_adapter_dvb_init()
209 dvb_dmx_release(&adap->demux); in dvb_usb_adapter_dvb_init()
211 dvb_usb_media_device_unregister(adap); in dvb_usb_adapter_dvb_init()
213 dvb_unregister_adapter(&adap->dvb_adap); in dvb_usb_adapter_dvb_init()
218 int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap) in dvb_usb_adapter_dvb_exit() argument
220 if (adap->state & DVB_USB_ADAP_STATE_DVB) { in dvb_usb_adapter_dvb_exit()
222 dvb_net_release(&adap->dvb_net); in dvb_usb_adapter_dvb_exit()
223 adap->demux.dmx.close(&adap->demux.dmx); in dvb_usb_adapter_dvb_exit()
224 dvb_dmxdev_release(&adap->dmxdev); in dvb_usb_adapter_dvb_exit()
225 dvb_dmx_release(&adap->demux); in dvb_usb_adapter_dvb_exit()
226 dvb_usb_media_device_unregister(adap); in dvb_usb_adapter_dvb_exit()
227 dvb_unregister_adapter(&adap->dvb_adap); in dvb_usb_adapter_dvb_exit()
228 adap->state &= ~DVB_USB_ADAP_STATE_DVB; in dvb_usb_adapter_dvb_exit()
235 struct dvb_usb_adapter *adap = fe->dvb->priv; in dvb_usb_set_active_fe() local
237 int ret = (adap->props.frontend_ctrl) ? in dvb_usb_set_active_fe()
238 adap->props.frontend_ctrl(fe, onoff) : 0; in dvb_usb_set_active_fe()
245 adap->active_fe = fe->id; in dvb_usb_set_active_fe()
252 struct dvb_usb_adapter *adap = fe->dvb->priv; in dvb_usb_fe_wakeup() local
254 dvb_usb_device_power_ctrl(adap->dev, 1); in dvb_usb_fe_wakeup()
258 if (adap->fe_adap[fe->id].fe_init) in dvb_usb_fe_wakeup()
259 adap->fe_adap[fe->id].fe_init(fe); in dvb_usb_fe_wakeup()
266 struct dvb_usb_adapter *adap = fe->dvb->priv; in dvb_usb_fe_sleep() local
268 if (adap->fe_adap[fe->id].fe_sleep) in dvb_usb_fe_sleep()
269 adap->fe_adap[fe->id].fe_sleep(fe); in dvb_usb_fe_sleep()
273 return dvb_usb_device_power_ctrl(adap->dev, 0); in dvb_usb_fe_sleep()
276 int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) in dvb_usb_adapter_frontend_init() argument
281 for (i = 0; i < adap->props.num_frontends; i++) { in dvb_usb_adapter_frontend_init()
283 if (adap->props.fe[i].frontend_attach == NULL) { in dvb_usb_adapter_frontend_init()
285 adap->dev->desc->name, adap->id, i); in dvb_usb_adapter_frontend_init()
290 ret = adap->props.fe[i].frontend_attach(adap); in dvb_usb_adapter_frontend_init()
291 if (ret || adap->fe_adap[i].fe == NULL) { in dvb_usb_adapter_frontend_init()
295 adap->dev->desc->name); in dvb_usb_adapter_frontend_init()
300 adap->fe_adap[i].fe->id = i; in dvb_usb_adapter_frontend_init()
303 adap->fe_adap[i].fe_init = adap->fe_adap[i].fe->ops.init; in dvb_usb_adapter_frontend_init()
304 adap->fe_adap[i].fe->ops.init = dvb_usb_fe_wakeup; in dvb_usb_adapter_frontend_init()
305 adap->fe_adap[i].fe_sleep = adap->fe_adap[i].fe->ops.sleep; in dvb_usb_adapter_frontend_init()
306 adap->fe_adap[i].fe->ops.sleep = dvb_usb_fe_sleep; in dvb_usb_adapter_frontend_init()
308 if (dvb_register_frontend(&adap->dvb_adap, adap->fe_adap[i].fe)) { in dvb_usb_adapter_frontend_init()
310 dvb_frontend_detach(adap->fe_adap[i].fe); in dvb_usb_adapter_frontend_init()
311 adap->fe_adap[i].fe = NULL; in dvb_usb_adapter_frontend_init()
321 if (adap->props.fe[i].tuner_attach != NULL) in dvb_usb_adapter_frontend_init()
322 adap->props.fe[i].tuner_attach(adap); in dvb_usb_adapter_frontend_init()
324 adap->num_frontends_initialized++; in dvb_usb_adapter_frontend_init()
327 ret = dvb_create_media_graph(&adap->dvb_adap, true); in dvb_usb_adapter_frontend_init()
331 ret = dvb_usb_media_device_register(adap); in dvb_usb_adapter_frontend_init()
336 int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap) in dvb_usb_adapter_frontend_exit() argument
338 int i = adap->num_frontends_initialized - 1; in dvb_usb_adapter_frontend_exit()
342 if (adap->fe_adap[i].fe != NULL) { in dvb_usb_adapter_frontend_exit()
343 dvb_unregister_frontend(adap->fe_adap[i].fe); in dvb_usb_adapter_frontend_exit()
344 dvb_frontend_detach(adap->fe_adap[i].fe); in dvb_usb_adapter_frontend_exit()
347 adap->num_frontends_initialized = 0; in dvb_usb_adapter_frontend_exit()