Searched refs:dmxdevfilter (Results 1 - 1 of 1) sorted by relevance

/linux-4.4.14/drivers/media/dvb-core/
H A Ddmxdev.c288 *dmxdevfilter, int state) dvb_dmxdev_filter_state_set()
290 spin_lock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_filter_state_set()
291 dmxdevfilter->state = state; dvb_dmxdev_filter_state_set()
292 spin_unlock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_filter_state_set()
295 static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, dvb_dmxdev_set_buffer_size() argument
298 struct dvb_ringbuffer *buf = &dmxdevfilter->buffer; dvb_dmxdev_set_buffer_size()
306 if (dmxdevfilter->state >= DMXDEV_STATE_GO) dvb_dmxdev_set_buffer_size()
315 spin_lock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_set_buffer_size()
321 spin_unlock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_set_buffer_size()
330 struct dmxdev_filter *dmxdevfilter = (struct dmxdev_filter *)data; dvb_dmxdev_filter_timeout() local
332 dmxdevfilter->buffer.error = -ETIMEDOUT; dvb_dmxdev_filter_timeout()
333 spin_lock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_filter_timeout()
334 dmxdevfilter->state = DMXDEV_STATE_TIMEDOUT; dvb_dmxdev_filter_timeout()
335 spin_unlock_irq(&dmxdevfilter->dev->lock); dvb_dmxdev_filter_timeout()
336 wake_up(&dmxdevfilter->buffer.queue); dvb_dmxdev_filter_timeout()
339 static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_filter_timer() argument
341 struct dmx_sct_filter_params *para = &dmxdevfilter->params.sec; dvb_dmxdev_filter_timer()
343 del_timer(&dmxdevfilter->timer); dvb_dmxdev_filter_timer()
345 dmxdevfilter->timer.function = dvb_dmxdev_filter_timeout; dvb_dmxdev_filter_timer()
346 dmxdevfilter->timer.data = (unsigned long)dmxdevfilter; dvb_dmxdev_filter_timer()
347 dmxdevfilter->timer.expires = dvb_dmxdev_filter_timer()
349 add_timer(&dmxdevfilter->timer); dvb_dmxdev_filter_timer()
357 struct dmxdev_filter *dmxdevfilter = filter->priv; dvb_dmxdev_section_callback() local
360 if (dmxdevfilter->buffer.error) { dvb_dmxdev_section_callback()
361 wake_up(&dmxdevfilter->buffer.queue); dvb_dmxdev_section_callback()
364 spin_lock(&dmxdevfilter->dev->lock); dvb_dmxdev_section_callback()
365 if (dmxdevfilter->state != DMXDEV_STATE_GO) { dvb_dmxdev_section_callback()
366 spin_unlock(&dmxdevfilter->dev->lock); dvb_dmxdev_section_callback()
369 del_timer(&dmxdevfilter->timer); dvb_dmxdev_section_callback()
371 ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1, dvb_dmxdev_section_callback()
374 ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer2, dvb_dmxdev_section_callback()
378 dmxdevfilter->buffer.error = ret; dvb_dmxdev_section_callback()
379 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) dvb_dmxdev_section_callback()
380 dmxdevfilter->state = DMXDEV_STATE_DONE; dvb_dmxdev_section_callback()
381 spin_unlock(&dmxdevfilter->dev->lock); dvb_dmxdev_section_callback()
382 wake_up(&dmxdevfilter->buffer.queue); dvb_dmxdev_section_callback()
390 struct dmxdev_filter *dmxdevfilter = feed->priv; dvb_dmxdev_ts_callback() local
394 spin_lock(&dmxdevfilter->dev->lock); dvb_dmxdev_ts_callback()
395 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { dvb_dmxdev_ts_callback()
396 spin_unlock(&dmxdevfilter->dev->lock); dvb_dmxdev_ts_callback()
400 if (dmxdevfilter->params.pes.output == DMX_OUT_TAP dvb_dmxdev_ts_callback()
401 || dmxdevfilter->params.pes.output == DMX_OUT_TSDEMUX_TAP) dvb_dmxdev_ts_callback()
402 buffer = &dmxdevfilter->buffer; dvb_dmxdev_ts_callback()
404 buffer = &dmxdevfilter->dev->dvr_buffer; dvb_dmxdev_ts_callback()
406 spin_unlock(&dmxdevfilter->dev->lock); dvb_dmxdev_ts_callback()
415 spin_unlock(&dmxdevfilter->dev->lock); dvb_dmxdev_ts_callback()
421 static int dvb_dmxdev_feed_stop(struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_feed_stop() argument
425 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); dvb_dmxdev_feed_stop()
427 switch (dmxdevfilter->type) { dvb_dmxdev_feed_stop()
429 del_timer(&dmxdevfilter->timer); dvb_dmxdev_feed_stop()
430 dmxdevfilter->feed.sec->stop_filtering(dmxdevfilter->feed.sec); dvb_dmxdev_feed_stop()
433 list_for_each_entry(feed, &dmxdevfilter->feed.ts, next) dvb_dmxdev_feed_stop()
491 static int dvb_dmxdev_filter_stop(struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_filter_stop() argument
496 if (dmxdevfilter->state < DMXDEV_STATE_GO) dvb_dmxdev_filter_stop()
499 switch (dmxdevfilter->type) { dvb_dmxdev_filter_stop()
501 if (!dmxdevfilter->feed.sec) dvb_dmxdev_filter_stop()
503 dvb_dmxdev_feed_stop(dmxdevfilter); dvb_dmxdev_filter_stop()
504 if (dmxdevfilter->filter.sec) dvb_dmxdev_filter_stop()
505 dmxdevfilter->feed.sec-> dvb_dmxdev_filter_stop()
506 release_filter(dmxdevfilter->feed.sec, dvb_dmxdev_filter_stop()
507 dmxdevfilter->filter.sec); dvb_dmxdev_filter_stop()
508 dvb_dmxdev_feed_restart(dmxdevfilter); dvb_dmxdev_filter_stop()
509 dmxdevfilter->feed.sec = NULL; dvb_dmxdev_filter_stop()
512 dvb_dmxdev_feed_stop(dmxdevfilter); dvb_dmxdev_filter_stop()
513 demux = dmxdevfilter->dev->demux; dvb_dmxdev_filter_stop()
514 list_for_each_entry(feed, &dmxdevfilter->feed.ts, next) { dvb_dmxdev_filter_stop()
520 if (dmxdevfilter->state == DMXDEV_STATE_ALLOCATED) dvb_dmxdev_filter_stop()
525 dvb_ringbuffer_flush(&dmxdevfilter->buffer); dvb_dmxdev_filter_stop()
529 static void dvb_dmxdev_delete_pids(struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_delete_pids() argument
534 list_for_each_entry_safe(feed, tmp, &dmxdevfilter->feed.ts, next) { dvb_dmxdev_delete_pids()
539 BUG_ON(!list_empty(&dmxdevfilter->feed.ts)); dvb_dmxdev_delete_pids()
542 static inline int dvb_dmxdev_filter_reset(struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_filter_reset() argument
544 if (dmxdevfilter->state < DMXDEV_STATE_SET) dvb_dmxdev_filter_reset()
547 if (dmxdevfilter->type == DMXDEV_TYPE_PES) dvb_dmxdev_filter_reset()
548 dvb_dmxdev_delete_pids(dmxdevfilter); dvb_dmxdev_filter_reset()
550 dmxdevfilter->type = DMXDEV_TYPE_NONE; dvb_dmxdev_filter_reset()
551 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); dvb_dmxdev_filter_reset()
729 struct dmxdev_filter *dmxdevfilter; dvb_demux_open() local
746 dmxdevfilter = &dmxdev->filter[i]; dvb_demux_open()
747 mutex_init(&dmxdevfilter->mutex); dvb_demux_open()
748 file->private_data = dmxdevfilter; dvb_demux_open()
750 dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); dvb_demux_open()
751 dmxdevfilter->type = DMXDEV_TYPE_NONE; dvb_demux_open()
752 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); dvb_demux_open()
753 init_timer(&dmxdevfilter->timer); dvb_demux_open()
762 struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_filter_free()
765 mutex_lock(&dmxdevfilter->mutex); dvb_dmxdev_filter_free()
767 dvb_dmxdev_filter_stop(dmxdevfilter); dvb_dmxdev_filter_free()
768 dvb_dmxdev_filter_reset(dmxdevfilter); dvb_dmxdev_filter_free()
770 if (dmxdevfilter->buffer.data) { dvb_dmxdev_filter_free()
771 void *mem = dmxdevfilter->buffer.data; dvb_dmxdev_filter_free()
774 dmxdevfilter->buffer.data = NULL; dvb_dmxdev_filter_free()
779 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_FREE); dvb_dmxdev_filter_free()
780 wake_up(&dmxdevfilter->buffer.queue); dvb_dmxdev_filter_free()
781 mutex_unlock(&dmxdevfilter->mutex); dvb_dmxdev_filter_free()
844 struct dmxdev_filter *dmxdevfilter, dvb_dmxdev_filter_set()
850 dvb_dmxdev_filter_stop(dmxdevfilter); dvb_dmxdev_filter_set()
852 dmxdevfilter->type = DMXDEV_TYPE_SEC; dvb_dmxdev_filter_set()
853 memcpy(&dmxdevfilter->params.sec, dvb_dmxdev_filter_set()
855 invert_mode(&dmxdevfilter->params.sec.filter); dvb_dmxdev_filter_set()
856 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); dvb_dmxdev_filter_set()
859 return dvb_dmxdev_filter_start(dmxdevfilter); dvb_dmxdev_filter_set()
865 struct dmxdev_filter *dmxdevfilter, dvb_dmxdev_pes_filter_set()
870 dvb_dmxdev_filter_stop(dmxdevfilter); dvb_dmxdev_pes_filter_set()
871 dvb_dmxdev_filter_reset(dmxdevfilter); dvb_dmxdev_pes_filter_set()
876 dmxdevfilter->type = DMXDEV_TYPE_PES; dvb_dmxdev_pes_filter_set()
877 memcpy(&dmxdevfilter->params, params, dvb_dmxdev_pes_filter_set()
879 INIT_LIST_HEAD(&dmxdevfilter->feed.ts); dvb_dmxdev_pes_filter_set()
881 dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); dvb_dmxdev_pes_filter_set()
883 ret = dvb_dmxdev_add_pid(dmxdev, dmxdevfilter, dvb_dmxdev_pes_filter_set()
884 dmxdevfilter->params.pes.pid); dvb_dmxdev_pes_filter_set()
889 return dvb_dmxdev_filter_start(dmxdevfilter); dvb_dmxdev_pes_filter_set()
939 struct dmxdev_filter *dmxdevfilter = file->private_data; dvb_demux_read() local
942 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) dvb_demux_read()
945 if (dmxdevfilter->type == DMXDEV_TYPE_SEC) dvb_demux_read()
946 ret = dvb_dmxdev_read_sec(dmxdevfilter, file, buf, count, ppos); dvb_demux_read()
948 ret = dvb_dmxdev_buffer_read(&dmxdevfilter->buffer, dvb_demux_read()
952 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_read()
959 struct dmxdev_filter *dmxdevfilter = file->private_data; dvb_demux_do_ioctl() local
960 struct dmxdev *dmxdev = dmxdevfilter->dev; dvb_demux_do_ioctl()
969 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
973 if (dmxdevfilter->state < DMXDEV_STATE_SET) dvb_demux_do_ioctl()
976 ret = dvb_dmxdev_filter_start(dmxdevfilter); dvb_demux_do_ioctl()
977 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
981 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
985 ret = dvb_dmxdev_filter_stop(dmxdevfilter); dvb_demux_do_ioctl()
986 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
990 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
994 ret = dvb_dmxdev_filter_set(dmxdev, dmxdevfilter, parg); dvb_demux_do_ioctl()
995 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
999 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
1003 ret = dvb_dmxdev_pes_filter_set(dmxdev, dmxdevfilter, parg); dvb_demux_do_ioctl()
1004 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
1008 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
1012 ret = dvb_dmxdev_set_buffer_size(dmxdevfilter, arg); dvb_demux_do_ioctl()
1013 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
1056 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
1060 ret = dvb_dmxdev_add_pid(dmxdev, dmxdevfilter, *(u16 *)parg); dvb_demux_do_ioctl()
1061 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
1065 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { dvb_demux_do_ioctl()
1069 ret = dvb_dmxdev_remove_pid(dmxdev, dmxdevfilter, *(u16 *)parg); dvb_demux_do_ioctl()
1070 mutex_unlock(&dmxdevfilter->mutex); dvb_demux_do_ioctl()
1089 struct dmxdev_filter *dmxdevfilter = file->private_data; dvb_demux_poll() local
1092 if ((!dmxdevfilter) || dmxdevfilter->dev->exit) dvb_demux_poll()
1095 poll_wait(file, &dmxdevfilter->buffer.queue, wait); dvb_demux_poll()
1097 if (dmxdevfilter->state != DMXDEV_STATE_GO && dvb_demux_poll()
1098 dmxdevfilter->state != DMXDEV_STATE_DONE && dvb_demux_poll()
1099 dmxdevfilter->state != DMXDEV_STATE_TIMEDOUT) dvb_demux_poll()
1102 if (dmxdevfilter->buffer.error) dvb_demux_poll()
1105 if (!dvb_ringbuffer_empty(&dmxdevfilter->buffer)) dvb_demux_poll()
1113 struct dmxdev_filter *dmxdevfilter = file->private_data; dvb_demux_release() local
1114 struct dmxdev *dmxdev = dmxdevfilter->dev; dvb_demux_release()
1118 ret = dvb_dmxdev_filter_free(dmxdev, dmxdevfilter); dvb_demux_release()
287 dvb_dmxdev_filter_state_set(struct dmxdev_filter *dmxdevfilter, int state) dvb_dmxdev_filter_state_set() argument
761 dvb_dmxdev_filter_free(struct dmxdev *dmxdev, struct dmxdev_filter *dmxdevfilter) dvb_dmxdev_filter_free() argument
843 dvb_dmxdev_filter_set(struct dmxdev *dmxdev, struct dmxdev_filter *dmxdevfilter, struct dmx_sct_filter_params *params) dvb_dmxdev_filter_set() argument
864 dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, struct dmxdev_filter *dmxdevfilter, struct dmx_pes_filter_params *params) dvb_dmxdev_pes_filter_set() argument

Completed in 52 milliseconds