• Home
  • Raw
  • Download

Lines Matching refs:s

96 	struct cx18_stream *s, struct cx18_videobuf_buffer *buf)  in cx18_dma_free()  argument
104 struct cx18_stream *s, in cx18_prepare_buffer() argument
110 struct cx18 *cx = s->cx; in cx18_prepare_buffer()
125 buf->vb.field != field || s->pixelformat != pixelformat || in cx18_prepare_buffer()
132 s->pixelformat = pixelformat; in cx18_prepare_buffer()
136 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_prepare_buffer()
137 s->vb_bytes_per_frame = height * 720 * 3 / 2; in cx18_prepare_buffer()
139 s->vb_bytes_per_frame = height * 720 * 2; in cx18_prepare_buffer()
140 cx18_dma_free(q, s, buf); in cx18_prepare_buffer()
154 s->pixelformat = pixelformat; in cx18_prepare_buffer()
158 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_prepare_buffer()
159 s->vb_bytes_per_frame = height * 720 * 3 / 2; in cx18_prepare_buffer()
161 s->vb_bytes_per_frame = height * 720 * 2; in cx18_prepare_buffer()
170 cx18_dma_free(q, s, buf); in cx18_prepare_buffer()
184 struct cx18_stream *s = q->priv_data; in buffer_setup() local
185 struct cx18 *cx = s->cx; in buffer_setup()
206 struct cx18_stream *s = q->priv_data; in buffer_prepare() local
207 struct cx18 *cx = s->cx; in buffer_prepare()
209 return cx18_prepare_buffer(q, s, buf, s->pixelformat, in buffer_prepare()
218 struct cx18_stream *s = q->priv_data; in buffer_release() local
220 cx18_dma_free(q, s, buf); in buffer_release()
227 struct cx18_stream *s = q->priv_data; in buffer_queue() local
231 list_add_tail(&buf->vb.queue, &s->vb_capture); in buffer_queue()
243 struct cx18_stream *s = &cx->streams[type]; in cx18_stream_init() local
245 memset(s, 0, sizeof(*s)); in cx18_stream_init()
248 s->dvb = NULL; in cx18_stream_init()
249 s->cx = cx; in cx18_stream_init()
250 s->type = type; in cx18_stream_init()
251 s->name = cx18_stream_info[type].name; in cx18_stream_init()
252 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_stream_init()
254 s->dma = cx18_stream_info[type].dma; in cx18_stream_init()
255 s->v4l2_dev_caps = cx18_stream_info[type].caps; in cx18_stream_init()
256 s->buffers = cx->stream_buffers[type]; in cx18_stream_init()
257 s->buf_size = cx->stream_buf_size[type]; in cx18_stream_init()
258 INIT_LIST_HEAD(&s->buf_pool); in cx18_stream_init()
259 s->bufs_per_mdl = 1; in cx18_stream_init()
260 s->mdl_size = s->buf_size * s->bufs_per_mdl; in cx18_stream_init()
262 init_waitqueue_head(&s->waitq); in cx18_stream_init()
263 s->id = -1; in cx18_stream_init()
264 spin_lock_init(&s->q_free.lock); in cx18_stream_init()
265 cx18_queue_init(&s->q_free); in cx18_stream_init()
266 spin_lock_init(&s->q_busy.lock); in cx18_stream_init()
267 cx18_queue_init(&s->q_busy); in cx18_stream_init()
268 spin_lock_init(&s->q_full.lock); in cx18_stream_init()
269 cx18_queue_init(&s->q_full); in cx18_stream_init()
270 spin_lock_init(&s->q_idle.lock); in cx18_stream_init()
271 cx18_queue_init(&s->q_idle); in cx18_stream_init()
273 INIT_WORK(&s->out_work_order, cx18_out_work_handler); in cx18_stream_init()
275 INIT_LIST_HEAD(&s->vb_capture); in cx18_stream_init()
276 timer_setup(&s->vb_timeout, cx18_vb_timeout, 0); in cx18_stream_init()
277 spin_lock_init(&s->vb_lock); in cx18_stream_init()
279 spin_lock_init(&s->vbuf_q_lock); in cx18_stream_init()
281 s->vb_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cx18_stream_init()
282 videobuf_queue_vmalloc_init(&s->vbuf_q, &cx18_videobuf_qops, in cx18_stream_init()
283 &cx->pci_dev->dev, &s->vbuf_q_lock, in cx18_stream_init()
287 s, &cx->serialize_lock); in cx18_stream_init()
290 s->pixelformat = V4L2_PIX_FMT_HM12; in cx18_stream_init()
291 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2; in cx18_stream_init()
292 s->vb_bytes_per_line = 720; in cx18_stream_init()
298 struct cx18_stream *s = &cx->streams[type]; in cx18_prep_dev() local
310 s->video_dev.v4l2_dev = NULL; in cx18_prep_dev()
311 s->dvb = NULL; in cx18_prep_dev()
312 s->cx = cx; in cx18_prep_dev()
313 s->type = type; in cx18_prep_dev()
314 s->name = cx18_stream_info[type].name; in cx18_prep_dev()
338 s->dvb = kzalloc(sizeof(struct cx18_dvb), GFP_KERNEL); in cx18_prep_dev()
339 if (s->dvb == NULL) { in cx18_prep_dev()
341 s->name); in cx18_prep_dev()
346 s->buffers = 0; in cx18_prep_dev()
354 snprintf(s->video_dev.name, sizeof(s->video_dev.name), "%s %s", in cx18_prep_dev()
355 cx->v4l2_dev.name, s->name); in cx18_prep_dev()
357 s->video_dev.num = num; in cx18_prep_dev()
358 s->video_dev.v4l2_dev = &cx->v4l2_dev; in cx18_prep_dev()
359 s->video_dev.fops = &cx18_v4l2_enc_fops; in cx18_prep_dev()
360 s->video_dev.release = video_device_release_empty; in cx18_prep_dev()
362 s->video_dev.tvnorms = cx->tuner_std; in cx18_prep_dev()
364 s->video_dev.tvnorms = V4L2_STD_ALL; in cx18_prep_dev()
365 s->video_dev.lock = &cx->serialize_lock; in cx18_prep_dev()
366 cx18_set_funcs(&s->video_dev); in cx18_prep_dev()
397 struct cx18_stream *s = &cx->streams[type]; in cx18_reg_dev() local
402 if (type == CX18_ENC_STREAM_TYPE_TS && s->dvb != NULL) { in cx18_reg_dev()
403 ret = cx18_dvb_register(s); in cx18_reg_dev()
410 if (s->video_dev.v4l2_dev == NULL) in cx18_reg_dev()
413 num = s->video_dev.num; in cx18_reg_dev()
414 s->video_dev.device_caps = s->v4l2_dev_caps; /* device capabilities */ in cx18_reg_dev()
423 video_set_drvdata(&s->video_dev, s); in cx18_reg_dev()
426 ret = video_register_device_no_warn(&s->video_dev, vfl_type, num); in cx18_reg_dev()
429 s->name, num); in cx18_reg_dev()
430 s->video_dev.v4l2_dev = NULL; in cx18_reg_dev()
434 name = video_device_node_name(&s->video_dev); in cx18_reg_dev()
439 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
445 CX18_INFO("Registered device %s for %s\n", name, s->name); in cx18_reg_dev()
451 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
455 name, s->name); in cx18_reg_dev()
537 static void cx18_vbi_setup(struct cx18_stream *s) in cx18_vbi_setup() argument
539 struct cx18 *cx = s->cx; in cx18_vbi_setup()
588 data[0] = s->handle; in cx18_vbi_setup()
649 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_stream_rotate_idx_mdls() local
652 if (!cx18_stream_enabled(s)) in cx18_stream_rotate_idx_mdls()
656 if ((atomic_read(&s->q_free.depth) + atomic_read(&s->q_busy.depth)) >= in cx18_stream_rotate_idx_mdls()
661 if (atomic_read(&s->q_full.depth) < 2) in cx18_stream_rotate_idx_mdls()
668 mdl = cx18_dequeue(s, &s->q_full); in cx18_stream_rotate_idx_mdls()
670 cx18_enqueue(s, mdl, &s->q_free); in cx18_stream_rotate_idx_mdls()
674 struct cx18_queue *_cx18_stream_put_mdl_fw(struct cx18_stream *s, in _cx18_stream_put_mdl_fw() argument
677 struct cx18 *cx = s->cx; in _cx18_stream_put_mdl_fw()
681 if (s->handle == CX18_INVALID_TASK_HANDLE || in _cx18_stream_put_mdl_fw()
682 test_bit(CX18_F_S_STOPPING, &s->s_flags) || in _cx18_stream_put_mdl_fw()
683 !test_bit(CX18_F_S_STREAMING, &s->s_flags)) in _cx18_stream_put_mdl_fw()
684 return cx18_enqueue(s, mdl, &s->q_free); in _cx18_stream_put_mdl_fw()
686 q = cx18_enqueue(s, mdl, &s->q_busy); in _cx18_stream_put_mdl_fw()
687 if (q != &s->q_busy) in _cx18_stream_put_mdl_fw()
690 cx18_mdl_sync_for_device(s, mdl); in _cx18_stream_put_mdl_fw()
691 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, in _cx18_stream_put_mdl_fw()
693 s->bufs_per_mdl, mdl->id, s->mdl_size); in _cx18_stream_put_mdl_fw()
698 void _cx18_stream_load_fw_queue(struct cx18_stream *s) in _cx18_stream_load_fw_queue() argument
703 if (atomic_read(&s->q_free.depth) == 0 || in _cx18_stream_load_fw_queue()
704 atomic_read(&s->q_busy.depth) >= CX18_MAX_FW_MDLS_PER_STREAM) in _cx18_stream_load_fw_queue()
709 mdl = cx18_dequeue(s, &s->q_free); in _cx18_stream_load_fw_queue()
712 q = _cx18_stream_put_mdl_fw(s, mdl); in _cx18_stream_load_fw_queue()
713 } while (atomic_read(&s->q_busy.depth) < CX18_MAX_FW_MDLS_PER_STREAM in _cx18_stream_load_fw_queue()
714 && q == &s->q_busy); in _cx18_stream_load_fw_queue()
719 struct cx18_stream *s = in cx18_out_work_handler() local
722 _cx18_stream_load_fw_queue(s); in cx18_out_work_handler()
725 static void cx18_stream_configure_mdls(struct cx18_stream *s) in cx18_stream_configure_mdls() argument
727 cx18_unload_queues(s); in cx18_stream_configure_mdls()
729 switch (s->type) { in cx18_stream_configure_mdls()
736 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_stream_configure_mdls()
737 s->mdl_size = 720 * s->cx->cxhdl.height * 3 / 2; in cx18_stream_configure_mdls()
739 s->mdl_size = 720 * s->cx->cxhdl.height * 2; in cx18_stream_configure_mdls()
740 s->bufs_per_mdl = s->mdl_size / s->buf_size; in cx18_stream_configure_mdls()
741 if (s->mdl_size % s->buf_size) in cx18_stream_configure_mdls()
742 s->bufs_per_mdl++; in cx18_stream_configure_mdls()
745 s->bufs_per_mdl = 1; in cx18_stream_configure_mdls()
746 if (cx18_raw_vbi(s->cx)) { in cx18_stream_configure_mdls()
747 s->mdl_size = (s->cx->is_60hz ? 12 : 18) in cx18_stream_configure_mdls()
755 s->mdl_size = s->cx->is_60hz in cx18_stream_configure_mdls()
761 s->bufs_per_mdl = 1; in cx18_stream_configure_mdls()
762 s->mdl_size = s->buf_size * s->bufs_per_mdl; in cx18_stream_configure_mdls()
766 cx18_load_queues(s); in cx18_stream_configure_mdls()
769 int cx18_start_v4l2_encode_stream(struct cx18_stream *s) in cx18_start_v4l2_encode_stream() argument
772 struct cx18 *cx = s->cx; in cx18_start_v4l2_encode_stream()
776 if (!cx18_stream_enabled(s)) in cx18_start_v4l2_encode_stream()
779 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); in cx18_start_v4l2_encode_stream()
781 switch (s->type) { in cx18_start_v4l2_encode_stream()
823 clear_bit(CX18_F_S_STREAMOFF, &s->s_flags); in cx18_start_v4l2_encode_stream()
826 s->handle = data[0]; in cx18_start_v4l2_encode_stream()
827 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); in cx18_start_v4l2_encode_stream()
841 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); in cx18_start_v4l2_encode_stream()
842 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); in cx18_start_v4l2_encode_stream()
843 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 8, 0); in cx18_start_v4l2_encode_stream()
844 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 4, 1); in cx18_start_v4l2_encode_stream()
852 s->handle, 12); in cx18_start_v4l2_encode_stream()
861 s->handle, 312, 313); in cx18_start_v4l2_encode_stream()
864 cx18_vbi_setup(s); in cx18_start_v4l2_encode_stream()
873 s->handle, cx18_stream_enabled(s_idx) ? 7 : 0); in cx18_start_v4l2_encode_stream()
876 cx->cxhdl.priv = s; in cx18_start_v4l2_encode_stream()
885 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, in cx18_start_v4l2_encode_stream()
892 if (s->pixelformat == V4L2_PIX_FMT_UYVY) in cx18_start_v4l2_encode_stream()
894 s->handle, 1); in cx18_start_v4l2_encode_stream()
898 s->handle, 0); in cx18_start_v4l2_encode_stream()
908 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle, in cx18_start_v4l2_encode_stream()
909 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem, in cx18_start_v4l2_encode_stream()
910 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem); in cx18_start_v4l2_encode_stream()
913 cx18_stream_configure_mdls(s); in cx18_start_v4l2_encode_stream()
914 _cx18_stream_load_fw_queue(s); in cx18_start_v4l2_encode_stream()
917 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { in cx18_start_v4l2_encode_stream()
920 set_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_start_v4l2_encode_stream()
921 if (s->type == CX18_ENC_STREAM_TYPE_MPG) in cx18_start_v4l2_encode_stream()
922 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1); in cx18_start_v4l2_encode_stream()
924 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle); in cx18_start_v4l2_encode_stream()
925 clear_bit(CX18_F_S_STREAMING, &s->s_flags); in cx18_start_v4l2_encode_stream()
927 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle); in cx18_start_v4l2_encode_stream()
928 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); in cx18_start_v4l2_encode_stream()
929 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_start_v4l2_encode_stream()
930 clear_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_start_v4l2_encode_stream()
951 struct cx18_stream *s = &cx->streams[i]; in cx18_stop_all_captures() local
953 if (!cx18_stream_enabled(s)) in cx18_stop_all_captures()
955 if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) in cx18_stop_all_captures()
956 cx18_stop_v4l2_encode_stream(s, 0); in cx18_stop_all_captures()
960 int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) in cx18_stop_v4l2_encode_stream() argument
962 struct cx18 *cx = s->cx; in cx18_stop_v4l2_encode_stream()
964 if (!cx18_stream_enabled(s)) in cx18_stop_v4l2_encode_stream()
975 set_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
976 if (s->type == CX18_ENC_STREAM_TYPE_MPG) in cx18_stop_v4l2_encode_stream()
977 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, !gop_end); in cx18_stop_v4l2_encode_stream()
979 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle); in cx18_stop_v4l2_encode_stream()
981 if (s->type == CX18_ENC_STREAM_TYPE_MPG && gop_end) { in cx18_stop_v4l2_encode_stream()
985 if (s->type != CX18_ENC_STREAM_TYPE_TS) in cx18_stop_v4l2_encode_stream()
990 clear_bit(CX18_F_S_STREAMING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
993 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle); in cx18_stop_v4l2_encode_stream()
995 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); in cx18_stop_v4l2_encode_stream()
996 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_stop_v4l2_encode_stream()
997 clear_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
1004 wake_up(&s->waitq); in cx18_stop_v4l2_encode_stream()
1016 struct cx18_stream *s = &cx->streams[i]; in cx18_find_handle() local
1018 if (s->video_dev.v4l2_dev && (s->handle != CX18_INVALID_TASK_HANDLE)) in cx18_find_handle()
1019 return s->handle; in cx18_find_handle()
1027 struct cx18_stream *s; in cx18_handle_to_stream() local
1033 s = &cx->streams[i]; in cx18_handle_to_stream()
1034 if (s->handle != handle) in cx18_handle_to_stream()
1036 if (cx18_stream_enabled(s)) in cx18_handle_to_stream()
1037 return s; in cx18_handle_to_stream()