Lines Matching refs:cx
124 struct cx18 *cx = s->cx; in cx18_prepare_buffer() local
140 buf->tvnorm != cx->std) { in cx18_prepare_buffer()
145 buf->tvnorm = cx->std; in cx18_prepare_buffer()
167 buf->tvnorm = cx->std; in cx18_prepare_buffer()
199 struct cx18 *cx = s->cx; in buffer_setup() local
201 *size = 2 * cx->cxhdl.width * cx->cxhdl.height; in buffer_setup()
221 struct cx18 *cx = s->cx; in buffer_prepare() local
224 cx->cxhdl.width, cx->cxhdl.height, field); in buffer_prepare()
255 static void cx18_stream_init(struct cx18 *cx, int type) in cx18_stream_init() argument
257 struct cx18_stream *s = &cx->streams[type]; in cx18_stream_init()
263 s->cx = cx; 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()
299 &cx->pci_dev->dev, &s->vbuf_q_lock, in cx18_stream_init()
303 s, &cx->serialize_lock); in cx18_stream_init()
307 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2; in cx18_stream_init()
312 static int cx18_prep_dev(struct cx18 *cx, int type) in cx18_prep_dev() argument
314 struct cx18_stream *s = &cx->streams[type]; in cx18_prep_dev()
315 u32 cap = cx->v4l2_cap; in cx18_prep_dev()
317 int num = cx->instance + cx18_first_minor + num_offset; in cx18_prep_dev()
328 s->cx = cx; in cx18_prep_dev()
344 cx->stream_buffers[type] == 0) { in cx18_prep_dev()
349 cx18_stream_init(cx, type); in cx18_prep_dev()
353 if (cx->card->hw_all & CX18_HW_DVB) { in cx18_prep_dev()
371 cx->v4l2_dev.name, s->name); in cx18_prep_dev()
374 s->video_dev.v4l2_dev = &cx->v4l2_dev; in cx18_prep_dev()
377 if (cx->card->video_inputs->video_type == CX18_CARD_INPUT_VID_TUNER) in cx18_prep_dev()
378 s->video_dev.tvnorms = cx->tuner_std; in cx18_prep_dev()
381 s->video_dev.lock = &cx->serialize_lock; in cx18_prep_dev()
387 int cx18_streams_setup(struct cx18 *cx) in cx18_streams_setup() argument
394 ret = cx18_prep_dev(cx, type); in cx18_streams_setup()
399 ret = cx18_stream_alloc(&cx->streams[type]); in cx18_streams_setup()
407 cx18_streams_cleanup(cx, 0); in cx18_streams_setup()
411 static int cx18_reg_dev(struct cx18 *cx, int type) in cx18_reg_dev() argument
413 struct cx18_stream *s = &cx->streams[type]; in cx18_reg_dev()
432 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; in cx18_reg_dev()
454 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
455 cx->stream_buf_size[type] / 1024, in cx18_reg_dev()
456 (cx->stream_buf_size[type] * 100 / 1024) % 100); in cx18_reg_dev()
464 if (cx->stream_buffers[type]) in cx18_reg_dev()
467 name, s->name, cx->stream_buffers[type], in cx18_reg_dev()
468 cx->stream_buf_size[type]); in cx18_reg_dev()
479 int cx18_streams_register(struct cx18 *cx) in cx18_streams_register() argument
487 err = cx18_reg_dev(cx, type); in cx18_streams_register()
496 cx18_streams_cleanup(cx, 1); in cx18_streams_register()
501 void cx18_streams_cleanup(struct cx18 *cx, int unregister) in cx18_streams_cleanup() argument
511 if (cx->streams[type].dvb != NULL) { in cx18_streams_cleanup()
513 cx18_dvb_unregister(&cx->streams[type]); in cx18_streams_cleanup()
514 kfree(cx->streams[type].dvb); in cx18_streams_cleanup()
515 cx->streams[type].dvb = NULL; in cx18_streams_cleanup()
516 cx18_stream_free(&cx->streams[type]); in cx18_streams_cleanup()
524 if (cx->stream_buffers[type] != 0) { in cx18_streams_cleanup()
525 cx->stream_buffers[type] = 0; in cx18_streams_cleanup()
532 if (cx->streams[type].buffers != 0) in cx18_streams_cleanup()
533 cx18_stream_free(&cx->streams[type]); in cx18_streams_cleanup()
539 vdev = &cx->streams[type].video_dev; in cx18_streams_cleanup()
545 videobuf_mmap_free(&cx->streams[type].vbuf_q); in cx18_streams_cleanup()
547 cx18_stream_free(&cx->streams[type]); in cx18_streams_cleanup()
555 struct cx18 *cx = s->cx; in cx18_vbi_setup() local
556 int raw = cx18_raw_vbi(cx); in cx18_vbi_setup()
560 if (cx->is_60hz) { in cx18_vbi_setup()
561 cx->vbi.count = 12; in cx18_vbi_setup()
562 cx->vbi.start[0] = 10; in cx18_vbi_setup()
563 cx->vbi.start[1] = 273; in cx18_vbi_setup()
565 cx->vbi.count = 18; in cx18_vbi_setup()
566 cx->vbi.start[0] = 6; in cx18_vbi_setup()
567 cx->vbi.start[1] = 318; in cx18_vbi_setup()
572 v4l2_subdev_call(cx->sd_av, vbi, s_raw_fmt, &cx->vbi.in.fmt.vbi); in cx18_vbi_setup()
574 v4l2_subdev_call(cx->sd_av, vbi, s_sliced_fmt, &cx->vbi.in.fmt.sliced); in cx18_vbi_setup()
585 lines = cx->vbi.count * 2; in cx18_vbi_setup()
601 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2; in cx18_vbi_setup()
609 : (cx->is_60hz ? vbi_hblank_samples_60Hz in cx18_vbi_setup()
660 cx18_api(cx, CX18_CPU_SET_RAW_VBI_PARAM, 6, data); in cx18_vbi_setup()
663 void cx18_stream_rotate_idx_mdls(struct cx18 *cx) in cx18_stream_rotate_idx_mdls() argument
665 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_stream_rotate_idx_mdls()
693 struct cx18 *cx = s->cx; in _cx18_stream_put_mdl_fw() local
707 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, in _cx18_stream_put_mdl_fw()
708 (void __iomem *) &cx->scb->cpu_mdl[mdl->id] - cx->enc_mem, in _cx18_stream_put_mdl_fw()
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()
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()
788 struct cx18 *cx = s->cx; in cx18_start_v4l2_encode_stream() local
800 cx->mpg_data_received = cx->vbi_data_inserted = 0; in cx18_start_v4l2_encode_stream()
801 cx->dualwatch_jiffies = jiffies; in cx18_start_v4l2_encode_stream()
802 cx->dualwatch_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode); in cx18_start_v4l2_encode_stream()
803 cx->search_pack_header = 0; in cx18_start_v4l2_encode_stream()
820 captype = cx18_raw_vbi(cx) ? in cx18_start_v4l2_encode_stream()
829 cx->vbi.frame = 0; in cx18_start_v4l2_encode_stream()
830 cx->vbi.inserted_frame = 0; in cx18_start_v4l2_encode_stream()
831 memset(cx->vbi.sliced_mpeg_size, in cx18_start_v4l2_encode_stream()
832 0, sizeof(cx->vbi.sliced_mpeg_size)); in cx18_start_v4l2_encode_stream()
841 cx18_vapi_result(cx, data, CX18_CREATE_TASK, 1, CPU_CMD_MASK_CAPTURE); 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()
866 if (atomic_read(&cx->ana_capturing) == 0) in cx18_start_v4l2_encode_stream()
867 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, in cx18_start_v4l2_encode_stream()
876 cx18_vapi(cx, CX18_CPU_SET_CAPTURE_LINE_NO, 3, in cx18_start_v4l2_encode_stream()
879 if (cx->v4l2_cap & V4L2_CAP_VBI_CAPTURE) in cx18_start_v4l2_encode_stream()
887 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_start_v4l2_encode_stream()
888 cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 2, in cx18_start_v4l2_encode_stream()
892 cx->cxhdl.priv = s; in cx18_start_v4l2_encode_stream()
893 cx2341x_handler_setup(&cx->cxhdl); in cx18_start_v4l2_encode_stream()
899 if (!cx->cxhdl.video_mute && in cx18_start_v4l2_encode_stream()
900 test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) in cx18_start_v4l2_encode_stream()
901 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, in cx18_start_v4l2_encode_stream()
902 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1); in cx18_start_v4l2_encode_stream()
909 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2, in cx18_start_v4l2_encode_stream()
913 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2, in cx18_start_v4l2_encode_stream()
918 if (atomic_read(&cx->tot_capturing) == 0) { in cx18_start_v4l2_encode_stream()
919 cx2341x_handler_set_busy(&cx->cxhdl, 1); in cx18_start_v4l2_encode_stream()
920 clear_bit(CX18_F_I_EOS, &cx->i_flags); in cx18_start_v4l2_encode_stream()
921 cx18_write_reg(cx, 7, CX18_DSP0_INTERRUPT_MASK); 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()
933 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { 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()
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()
947 if (atomic_read(&cx->tot_capturing) == 0) { in cx18_start_v4l2_encode_stream()
948 set_bit(CX18_F_I_EOS, &cx->i_flags); in cx18_start_v4l2_encode_stream()
949 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK); in cx18_start_v4l2_encode_stream()
956 atomic_inc(&cx->ana_capturing); in cx18_start_v4l2_encode_stream()
957 atomic_inc(&cx->tot_capturing); in cx18_start_v4l2_encode_stream()
962 void cx18_stop_all_captures(struct cx18 *cx) in cx18_stop_all_captures() argument
967 struct cx18_stream *s = &cx->streams[i]; in cx18_stop_all_captures()
978 struct cx18 *cx = s->cx; in cx18_stop_v4l2_encode_stream() local
988 if (atomic_read(&cx->tot_capturing) == 0) 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()
1002 atomic_dec(&cx->ana_capturing); in cx18_stop_v4l2_encode_stream()
1003 atomic_dec(&cx->tot_capturing); 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()
1015 if (atomic_read(&cx->tot_capturing) > 0) in cx18_stop_v4l2_encode_stream()
1018 cx2341x_handler_set_busy(&cx->cxhdl, 0); in cx18_stop_v4l2_encode_stream()
1019 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK); in cx18_stop_v4l2_encode_stream()
1026 u32 cx18_find_handle(struct cx18 *cx) in cx18_find_handle() argument
1032 struct cx18_stream *s = &cx->streams[i]; in cx18_find_handle()
1040 struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle) in cx18_handle_to_stream() argument
1049 s = &cx->streams[i]; in cx18_handle_to_stream()