Lines Matching refs:fdtv
24 static int alloc_channel(struct firedtv *fdtv) in alloc_channel() argument
29 if (!__test_and_set_bit(i, &fdtv->channel_active)) in alloc_channel()
34 static void collect_channels(struct firedtv *fdtv, int *pidc, u16 pid[]) in collect_channels() argument
39 if (test_bit(i, &fdtv->channel_active)) in collect_channels()
40 pid[n++] = fdtv->channel_pid[i]; in collect_channels()
44 static inline void dealloc_channel(struct firedtv *fdtv, int i) in dealloc_channel() argument
46 __clear_bit(i, &fdtv->channel_active); in dealloc_channel()
51 struct firedtv *fdtv = dvbdmxfeed->demux->priv; in fdtv_start_feed() local
60 dev_err(fdtv->device, "can't start dmx feed: invalid type %u\n", in fdtv_start_feed()
65 if (mutex_lock_interruptible(&fdtv->demux_mutex)) in fdtv_start_feed()
75 c = alloc_channel(fdtv); in fdtv_start_feed()
78 dev_err(fdtv->device, in fdtv_start_feed()
85 c = alloc_channel(fdtv); in fdtv_start_feed()
89 dev_err(fdtv->device, "can't start dmx feed: busy\n"); in fdtv_start_feed()
95 fdtv->channel_pid[c] = dvbdmxfeed->pid; in fdtv_start_feed()
96 collect_channels(fdtv, &pidc, pids); in fdtv_start_feed()
99 ret = avc_tuner_get_ts(fdtv); in fdtv_start_feed()
101 dealloc_channel(fdtv, c); in fdtv_start_feed()
102 dev_err(fdtv->device, "can't get TS\n"); in fdtv_start_feed()
106 ret = avc_tuner_set_pids(fdtv, pidc, pids); in fdtv_start_feed()
108 dealloc_channel(fdtv, c); in fdtv_start_feed()
109 dev_err(fdtv->device, "can't set PIDs\n"); in fdtv_start_feed()
114 mutex_unlock(&fdtv->demux_mutex); in fdtv_start_feed()
122 struct firedtv *fdtv = demux->priv; in fdtv_stop_feed() local
144 if (mutex_lock_interruptible(&fdtv->demux_mutex)) in fdtv_stop_feed()
148 dealloc_channel(fdtv, c); in fdtv_stop_feed()
149 collect_channels(fdtv, &pidc, pids); in fdtv_stop_feed()
151 ret = avc_tuner_set_pids(fdtv, pidc, pids); in fdtv_stop_feed()
153 mutex_unlock(&fdtv->demux_mutex); in fdtv_stop_feed()
160 int fdtv_dvb_register(struct firedtv *fdtv, const char *name) in fdtv_dvb_register() argument
164 err = dvb_register_adapter(&fdtv->adapter, name, in fdtv_dvb_register()
165 THIS_MODULE, fdtv->device, adapter_nr); in fdtv_dvb_register()
170 fdtv->demux.dmx.capabilities = 0; in fdtv_dvb_register()
172 fdtv->demux.priv = fdtv; in fdtv_dvb_register()
173 fdtv->demux.filternum = 16; in fdtv_dvb_register()
174 fdtv->demux.feednum = 16; in fdtv_dvb_register()
175 fdtv->demux.start_feed = fdtv_start_feed; in fdtv_dvb_register()
176 fdtv->demux.stop_feed = fdtv_stop_feed; in fdtv_dvb_register()
177 fdtv->demux.write_to_decoder = NULL; in fdtv_dvb_register()
179 err = dvb_dmx_init(&fdtv->demux); in fdtv_dvb_register()
183 fdtv->dmxdev.filternum = 16; in fdtv_dvb_register()
184 fdtv->dmxdev.demux = &fdtv->demux.dmx; in fdtv_dvb_register()
185 fdtv->dmxdev.capabilities = 0; in fdtv_dvb_register()
187 err = dvb_dmxdev_init(&fdtv->dmxdev, &fdtv->adapter); in fdtv_dvb_register()
191 fdtv->frontend.source = DMX_FRONTEND_0; in fdtv_dvb_register()
193 err = fdtv->demux.dmx.add_frontend(&fdtv->demux.dmx, &fdtv->frontend); in fdtv_dvb_register()
197 err = fdtv->demux.dmx.connect_frontend(&fdtv->demux.dmx, in fdtv_dvb_register()
198 &fdtv->frontend); in fdtv_dvb_register()
202 err = dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx); in fdtv_dvb_register()
206 fdtv_frontend_init(fdtv, name); in fdtv_dvb_register()
207 err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe); in fdtv_dvb_register()
211 err = fdtv_ca_register(fdtv); in fdtv_dvb_register()
213 dev_info(fdtv->device, in fdtv_dvb_register()
218 dvb_net_release(&fdtv->dvbnet); in fdtv_dvb_register()
220 fdtv->demux.dmx.close(&fdtv->demux.dmx); in fdtv_dvb_register()
222 fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx, &fdtv->frontend); in fdtv_dvb_register()
224 dvb_dmxdev_release(&fdtv->dmxdev); in fdtv_dvb_register()
226 dvb_dmx_release(&fdtv->demux); in fdtv_dvb_register()
228 dvb_unregister_adapter(&fdtv->adapter); in fdtv_dvb_register()
230 dev_err(fdtv->device, "DVB initialization failed\n"); in fdtv_dvb_register()
234 void fdtv_dvb_unregister(struct firedtv *fdtv) in fdtv_dvb_unregister() argument
236 fdtv_ca_release(fdtv); in fdtv_dvb_unregister()
237 dvb_unregister_frontend(&fdtv->fe); in fdtv_dvb_unregister()
238 dvb_net_release(&fdtv->dvbnet); in fdtv_dvb_unregister()
239 fdtv->demux.dmx.close(&fdtv->demux.dmx); in fdtv_dvb_unregister()
240 fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx, &fdtv->frontend); in fdtv_dvb_unregister()
241 dvb_dmxdev_release(&fdtv->dmxdev); in fdtv_dvb_unregister()
242 dvb_dmx_release(&fdtv->demux); in fdtv_dvb_unregister()
243 dvb_unregister_adapter(&fdtv->adapter); in fdtv_dvb_unregister()