• Home
  • Raw
  • Download

Lines Matching refs:s

110 	struct cx18_stream *s, struct cx18_videobuf_buffer *buf)  in cx18_dma_free()  argument
118 struct cx18_stream *s, in cx18_prepare_buffer() argument
124 struct cx18 *cx = s->cx; in cx18_prepare_buffer()
139 buf->vb.field != field || s->pixelformat != pixelformat || in cx18_prepare_buffer()
146 s->pixelformat = pixelformat; in cx18_prepare_buffer()
150 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_prepare_buffer()
151 s->vb_bytes_per_frame = height * 720 * 3 / 2; in cx18_prepare_buffer()
153 s->vb_bytes_per_frame = height * 720 * 2; in cx18_prepare_buffer()
154 cx18_dma_free(q, s, buf); in cx18_prepare_buffer()
168 s->pixelformat = pixelformat; in cx18_prepare_buffer()
172 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_prepare_buffer()
173 s->vb_bytes_per_frame = height * 720 * 3 / 2; in cx18_prepare_buffer()
175 s->vb_bytes_per_frame = height * 720 * 2; in cx18_prepare_buffer()
184 cx18_dma_free(q, s, buf); in cx18_prepare_buffer()
198 struct cx18_stream *s = q->priv_data; in buffer_setup() local
199 struct cx18 *cx = s->cx; in buffer_setup()
220 struct cx18_stream *s = q->priv_data; in buffer_prepare() local
221 struct cx18 *cx = s->cx; in buffer_prepare()
223 return cx18_prepare_buffer(q, s, buf, s->pixelformat, in buffer_prepare()
232 struct cx18_stream *s = q->priv_data; in buffer_release() local
234 cx18_dma_free(q, s, buf); in buffer_release()
241 struct cx18_stream *s = q->priv_data; in buffer_queue() local
245 list_add_tail(&buf->vb.queue, &s->vb_capture); in buffer_queue()
257 struct cx18_stream *s = &cx->streams[type]; in cx18_stream_init() local
259 memset(s, 0, sizeof(*s)); in cx18_stream_init()
262 s->dvb = NULL; in cx18_stream_init()
263 s->cx = cx; in cx18_stream_init()
264 s->type = type; in cx18_stream_init()
265 s->name = cx18_stream_info[type].name; in cx18_stream_init()
266 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_stream_init()
268 s->dma = cx18_stream_info[type].dma; in cx18_stream_init()
269 s->v4l2_dev_caps = cx18_stream_info[type].caps; in cx18_stream_init()
270 s->buffers = cx->stream_buffers[type]; in cx18_stream_init()
271 s->buf_size = cx->stream_buf_size[type]; in cx18_stream_init()
272 INIT_LIST_HEAD(&s->buf_pool); in cx18_stream_init()
273 s->bufs_per_mdl = 1; in cx18_stream_init()
274 s->mdl_size = s->buf_size * s->bufs_per_mdl; in cx18_stream_init()
276 init_waitqueue_head(&s->waitq); in cx18_stream_init()
277 s->id = -1; in cx18_stream_init()
278 spin_lock_init(&s->q_free.lock); in cx18_stream_init()
279 cx18_queue_init(&s->q_free); in cx18_stream_init()
280 spin_lock_init(&s->q_busy.lock); in cx18_stream_init()
281 cx18_queue_init(&s->q_busy); in cx18_stream_init()
282 spin_lock_init(&s->q_full.lock); in cx18_stream_init()
283 cx18_queue_init(&s->q_full); in cx18_stream_init()
284 spin_lock_init(&s->q_idle.lock); in cx18_stream_init()
285 cx18_queue_init(&s->q_idle); in cx18_stream_init()
287 INIT_WORK(&s->out_work_order, cx18_out_work_handler); in cx18_stream_init()
289 INIT_LIST_HEAD(&s->vb_capture); in cx18_stream_init()
290 s->vb_timeout.function = cx18_vb_timeout; in cx18_stream_init()
291 s->vb_timeout.data = (unsigned long)s; in cx18_stream_init()
292 init_timer(&s->vb_timeout); in cx18_stream_init()
293 spin_lock_init(&s->vb_lock); in cx18_stream_init()
295 spin_lock_init(&s->vbuf_q_lock); in cx18_stream_init()
297 s->vb_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cx18_stream_init()
298 videobuf_queue_vmalloc_init(&s->vbuf_q, &cx18_videobuf_qops, in cx18_stream_init()
299 &cx->pci_dev->dev, &s->vbuf_q_lock, in cx18_stream_init()
303 s, &cx->serialize_lock); in cx18_stream_init()
306 s->pixelformat = V4L2_PIX_FMT_HM12; in cx18_stream_init()
307 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2; in cx18_stream_init()
308 s->vb_bytes_per_line = 720; in cx18_stream_init()
314 struct cx18_stream *s = &cx->streams[type]; in cx18_prep_dev() local
326 s->video_dev.v4l2_dev = NULL; in cx18_prep_dev()
327 s->dvb = NULL; in cx18_prep_dev()
328 s->cx = cx; in cx18_prep_dev()
329 s->type = type; in cx18_prep_dev()
330 s->name = cx18_stream_info[type].name; in cx18_prep_dev()
354 s->dvb = kzalloc(sizeof(struct cx18_dvb), GFP_KERNEL); in cx18_prep_dev()
355 if (s->dvb == NULL) { in cx18_prep_dev()
357 " for %s\n", s->name); in cx18_prep_dev()
362 s->buffers = 0; in cx18_prep_dev()
370 snprintf(s->video_dev.name, sizeof(s->video_dev.name), "%s %s", in cx18_prep_dev()
371 cx->v4l2_dev.name, s->name); in cx18_prep_dev()
373 s->video_dev.num = num; in cx18_prep_dev()
374 s->video_dev.v4l2_dev = &cx->v4l2_dev; in cx18_prep_dev()
375 s->video_dev.fops = &cx18_v4l2_enc_fops; in cx18_prep_dev()
376 s->video_dev.release = video_device_release_empty; in cx18_prep_dev()
378 s->video_dev.tvnorms = cx->tuner_std; in cx18_prep_dev()
380 s->video_dev.tvnorms = V4L2_STD_ALL; in cx18_prep_dev()
381 s->video_dev.lock = &cx->serialize_lock; in cx18_prep_dev()
382 cx18_set_funcs(&s->video_dev); in cx18_prep_dev()
413 struct cx18_stream *s = &cx->streams[type]; in cx18_reg_dev() local
418 if (type == CX18_ENC_STREAM_TYPE_TS && s->dvb != NULL) { in cx18_reg_dev()
419 ret = cx18_dvb_register(s); in cx18_reg_dev()
426 if (s->video_dev.v4l2_dev == NULL) in cx18_reg_dev()
429 num = s->video_dev.num; in cx18_reg_dev()
438 video_set_drvdata(&s->video_dev, s); in cx18_reg_dev()
441 ret = video_register_device_no_warn(&s->video_dev, vfl_type, num); in cx18_reg_dev()
444 s->name, num); in cx18_reg_dev()
445 s->video_dev.v4l2_dev = NULL; in cx18_reg_dev()
449 name = video_device_node_name(&s->video_dev); in cx18_reg_dev()
454 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
460 CX18_INFO("Registered device %s for %s\n", name, s->name); in cx18_reg_dev()
467 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
471 name, s->name); in cx18_reg_dev()
553 static void cx18_vbi_setup(struct cx18_stream *s) in cx18_vbi_setup() argument
555 struct cx18 *cx = s->cx; in cx18_vbi_setup()
604 data[0] = s->handle; in cx18_vbi_setup()
665 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_stream_rotate_idx_mdls() local
668 if (!cx18_stream_enabled(s)) in cx18_stream_rotate_idx_mdls()
672 if ((atomic_read(&s->q_free.depth) + atomic_read(&s->q_busy.depth)) >= in cx18_stream_rotate_idx_mdls()
677 if (atomic_read(&s->q_full.depth) < 2) in cx18_stream_rotate_idx_mdls()
684 mdl = cx18_dequeue(s, &s->q_full); in cx18_stream_rotate_idx_mdls()
686 cx18_enqueue(s, mdl, &s->q_free); in cx18_stream_rotate_idx_mdls()
690 struct cx18_queue *_cx18_stream_put_mdl_fw(struct cx18_stream *s, in _cx18_stream_put_mdl_fw() argument
693 struct cx18 *cx = s->cx; in _cx18_stream_put_mdl_fw()
697 if (s->handle == CX18_INVALID_TASK_HANDLE || in _cx18_stream_put_mdl_fw()
698 test_bit(CX18_F_S_STOPPING, &s->s_flags) || in _cx18_stream_put_mdl_fw()
699 !test_bit(CX18_F_S_STREAMING, &s->s_flags)) in _cx18_stream_put_mdl_fw()
700 return cx18_enqueue(s, mdl, &s->q_free); in _cx18_stream_put_mdl_fw()
702 q = cx18_enqueue(s, mdl, &s->q_busy); in _cx18_stream_put_mdl_fw()
703 if (q != &s->q_busy) in _cx18_stream_put_mdl_fw()
706 cx18_mdl_sync_for_device(s, mdl); in _cx18_stream_put_mdl_fw()
707 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, in _cx18_stream_put_mdl_fw()
709 s->bufs_per_mdl, mdl->id, s->mdl_size); in _cx18_stream_put_mdl_fw()
714 void _cx18_stream_load_fw_queue(struct cx18_stream *s) in _cx18_stream_load_fw_queue() argument
719 if (atomic_read(&s->q_free.depth) == 0 || in _cx18_stream_load_fw_queue()
720 atomic_read(&s->q_busy.depth) >= CX18_MAX_FW_MDLS_PER_STREAM) in _cx18_stream_load_fw_queue()
725 mdl = cx18_dequeue(s, &s->q_free); in _cx18_stream_load_fw_queue()
728 q = _cx18_stream_put_mdl_fw(s, mdl); in _cx18_stream_load_fw_queue()
729 } while (atomic_read(&s->q_busy.depth) < CX18_MAX_FW_MDLS_PER_STREAM in _cx18_stream_load_fw_queue()
730 && q == &s->q_busy); in _cx18_stream_load_fw_queue()
735 struct cx18_stream *s = in cx18_out_work_handler() local
738 _cx18_stream_load_fw_queue(s); in cx18_out_work_handler()
741 static void cx18_stream_configure_mdls(struct cx18_stream *s) in cx18_stream_configure_mdls() argument
743 cx18_unload_queues(s); in cx18_stream_configure_mdls()
745 switch (s->type) { in cx18_stream_configure_mdls()
752 if (s->pixelformat == V4L2_PIX_FMT_HM12) in cx18_stream_configure_mdls()
753 s->mdl_size = 720 * s->cx->cxhdl.height * 3 / 2; in cx18_stream_configure_mdls()
755 s->mdl_size = 720 * s->cx->cxhdl.height * 2; in cx18_stream_configure_mdls()
756 s->bufs_per_mdl = s->mdl_size / s->buf_size; in cx18_stream_configure_mdls()
757 if (s->mdl_size % s->buf_size) in cx18_stream_configure_mdls()
758 s->bufs_per_mdl++; in cx18_stream_configure_mdls()
761 s->bufs_per_mdl = 1; in cx18_stream_configure_mdls()
762 if (cx18_raw_vbi(s->cx)) { in cx18_stream_configure_mdls()
763 s->mdl_size = (s->cx->is_60hz ? 12 : 18) in cx18_stream_configure_mdls()
771 s->mdl_size = s->cx->is_60hz in cx18_stream_configure_mdls()
777 s->bufs_per_mdl = 1; in cx18_stream_configure_mdls()
778 s->mdl_size = s->buf_size * s->bufs_per_mdl; in cx18_stream_configure_mdls()
782 cx18_load_queues(s); in cx18_stream_configure_mdls()
785 int cx18_start_v4l2_encode_stream(struct cx18_stream *s) in cx18_start_v4l2_encode_stream() argument
788 struct cx18 *cx = s->cx; in cx18_start_v4l2_encode_stream()
792 if (!cx18_stream_enabled(s)) in cx18_start_v4l2_encode_stream()
795 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); in cx18_start_v4l2_encode_stream()
797 switch (s->type) { in cx18_start_v4l2_encode_stream()
839 clear_bit(CX18_F_S_STREAMOFF, &s->s_flags); in cx18_start_v4l2_encode_stream()
842 s->handle = data[0]; in cx18_start_v4l2_encode_stream()
843 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); in cx18_start_v4l2_encode_stream()
857 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); in cx18_start_v4l2_encode_stream()
858 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); in cx18_start_v4l2_encode_stream()
859 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 8, 0); in cx18_start_v4l2_encode_stream()
860 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 4, 1); in cx18_start_v4l2_encode_stream()
868 s->handle, 12); in cx18_start_v4l2_encode_stream()
877 s->handle, 312, 313); in cx18_start_v4l2_encode_stream()
880 cx18_vbi_setup(s); in cx18_start_v4l2_encode_stream()
889 s->handle, cx18_stream_enabled(s_idx) ? 7 : 0); in cx18_start_v4l2_encode_stream()
892 cx->cxhdl.priv = s; in cx18_start_v4l2_encode_stream()
901 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, in cx18_start_v4l2_encode_stream()
908 if (s->pixelformat == V4L2_PIX_FMT_UYVY) in cx18_start_v4l2_encode_stream()
910 s->handle, 1); in cx18_start_v4l2_encode_stream()
914 s->handle, 0); in cx18_start_v4l2_encode_stream()
924 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle, in cx18_start_v4l2_encode_stream()
925 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem, in cx18_start_v4l2_encode_stream()
926 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem); in cx18_start_v4l2_encode_stream()
929 cx18_stream_configure_mdls(s); in cx18_start_v4l2_encode_stream()
930 _cx18_stream_load_fw_queue(s); in cx18_start_v4l2_encode_stream()
933 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { in cx18_start_v4l2_encode_stream()
936 set_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_start_v4l2_encode_stream()
937 if (s->type == CX18_ENC_STREAM_TYPE_MPG) in cx18_start_v4l2_encode_stream()
938 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1); in cx18_start_v4l2_encode_stream()
940 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle); in cx18_start_v4l2_encode_stream()
941 clear_bit(CX18_F_S_STREAMING, &s->s_flags); in cx18_start_v4l2_encode_stream()
943 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle); in cx18_start_v4l2_encode_stream()
944 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); in cx18_start_v4l2_encode_stream()
945 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_start_v4l2_encode_stream()
946 clear_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_start_v4l2_encode_stream()
967 struct cx18_stream *s = &cx->streams[i]; in cx18_stop_all_captures() local
969 if (!cx18_stream_enabled(s)) in cx18_stop_all_captures()
971 if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) in cx18_stop_all_captures()
972 cx18_stop_v4l2_encode_stream(s, 0); in cx18_stop_all_captures()
976 int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) in cx18_stop_v4l2_encode_stream() argument
978 struct cx18 *cx = s->cx; in cx18_stop_v4l2_encode_stream()
980 if (!cx18_stream_enabled(s)) in cx18_stop_v4l2_encode_stream()
991 set_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
992 if (s->type == CX18_ENC_STREAM_TYPE_MPG) in cx18_stop_v4l2_encode_stream()
993 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, !gop_end); in cx18_stop_v4l2_encode_stream()
995 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle); in cx18_stop_v4l2_encode_stream()
997 if (s->type == CX18_ENC_STREAM_TYPE_MPG && gop_end) { in cx18_stop_v4l2_encode_stream()
1001 if (s->type != CX18_ENC_STREAM_TYPE_TS) in cx18_stop_v4l2_encode_stream()
1006 clear_bit(CX18_F_S_STREAMING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
1009 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle); in cx18_stop_v4l2_encode_stream()
1011 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); in cx18_stop_v4l2_encode_stream()
1012 s->handle = CX18_INVALID_TASK_HANDLE; in cx18_stop_v4l2_encode_stream()
1013 clear_bit(CX18_F_S_STOPPING, &s->s_flags); in cx18_stop_v4l2_encode_stream()
1020 wake_up(&s->waitq); in cx18_stop_v4l2_encode_stream()
1032 struct cx18_stream *s = &cx->streams[i]; in cx18_find_handle() local
1034 if (s->video_dev.v4l2_dev && (s->handle != CX18_INVALID_TASK_HANDLE)) in cx18_find_handle()
1035 return s->handle; in cx18_find_handle()
1043 struct cx18_stream *s; in cx18_handle_to_stream() local
1049 s = &cx->streams[i]; in cx18_handle_to_stream()
1050 if (s->handle != handle) in cx18_handle_to_stream()
1052 if (cx18_stream_enabled(s)) in cx18_handle_to_stream()
1053 return s; in cx18_handle_to_stream()