Lines Matching refs:cx
108 struct cx18 *cx = s->cx;
116 szimage = cx->cxhdl.height * 720 * 3 / 2;
118 szimage = cx->cxhdl.height * 720 * 2;
155 struct cx18 *cx = s->cx;
163 size = cx->cxhdl.height * 720 * 3 / 2;
165 size = cx->cxhdl.height * 720 * 2;
235 static int cx18_stream_init(struct cx18 *cx, int type)
237 struct cx18_stream *s = &cx->streams[type];
244 s->cx = cx;
251 s->buffers = cx->stream_buffers[type];
252 s->buf_size = cx->stream_buf_size[type];
279 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2;
291 s->vidq.dev = &cx->pci_dev->dev;
292 s->vidq.lock = &cx->serialize_lock;
296 v4l2_err(&cx->v4l2_dev, "cannot init vb2 queue\n");
302 static int cx18_prep_dev(struct cx18 *cx, int type)
304 struct cx18_stream *s = &cx->streams[type];
305 u32 cap = cx->v4l2_cap;
307 int num = cx->instance + cx18_first_minor + num_offset;
319 s->cx = cx;
335 cx->stream_buffers[type] == 0) {
340 err = cx18_stream_init(cx, type);
346 if (cx->card->hw_all & CX18_HW_DVB) {
364 cx->v4l2_dev.name, s->name);
367 s->video_dev.v4l2_dev = &cx->v4l2_dev;
373 if (cx->card->video_inputs->video_type == CX18_CARD_INPUT_VID_TUNER)
374 s->video_dev.tvnorms = cx->tuner_std;
377 s->video_dev.lock = &cx->serialize_lock;
383 int cx18_streams_setup(struct cx18 *cx)
390 ret = cx18_prep_dev(cx, type);
395 ret = cx18_stream_alloc(&cx->streams[type]);
403 cx18_streams_cleanup(cx, 0);
407 static int cx18_reg_dev(struct cx18 *cx, int type)
409 struct cx18_stream *s = &cx->streams[type];
429 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
451 name, s->name, cx->stream_buffers[type],
452 cx->stream_buf_size[type] / 1024,
453 (cx->stream_buf_size[type] * 100 / 1024) % 100);
461 if (cx->stream_buffers[type])
463 name, s->name, cx->stream_buffers[type],
464 cx->stream_buf_size[type]);
475 int cx18_streams_register(struct cx18 *cx)
483 err = cx18_reg_dev(cx, type);
492 cx18_streams_cleanup(cx, 1);
497 void cx18_streams_cleanup(struct cx18 *cx, int unregister)
507 if (cx->streams[type].dvb != NULL) {
509 cx18_dvb_unregister(&cx->streams[type]);
510 kfree(cx->streams[type].dvb);
511 cx->streams[type].dvb = NULL;
512 cx18_stream_free(&cx->streams[type]);
520 if (cx->stream_buffers[type] != 0) {
521 cx->stream_buffers[type] = 0;
528 if (cx->streams[type].buffers != 0)
529 cx18_stream_free(&cx->streams[type]);
535 vdev = &cx->streams[type].video_dev;
540 cx18_stream_free(&cx->streams[type]);
551 struct cx18 *cx = s->cx;
552 int raw = cx18_raw_vbi(cx);
556 if (cx->is_60hz) {
557 cx->vbi.count = 12;
558 cx->vbi.start[0] = 10;
559 cx->vbi.start[1] = 273;
561 cx->vbi.count = 18;
562 cx->vbi.start[0] = 6;
563 cx->vbi.start[1] = 318;
568 v4l2_subdev_call(cx->sd_av, vbi, s_raw_fmt, &cx->vbi.in.fmt.vbi);
570 v4l2_subdev_call(cx->sd_av, vbi, s_sliced_fmt, &cx->vbi.in.fmt.sliced);
581 lines = cx->vbi.count * 2;
597 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2;
605 : (cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ
656 cx18_api(cx, CX18_CPU_SET_RAW_VBI_PARAM, 6, data);
659 void cx18_stream_rotate_idx_mdls(struct cx18 *cx)
661 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
689 struct cx18 *cx = s->cx;
703 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
704 (void __iomem *) &cx->scb->cpu_mdl[mdl->id] - cx->enc_mem,
749 s->mdl_size = 720 * s->cx->cxhdl.height * 3 / 2;
751 s->mdl_size = 720 * s->cx->cxhdl.height * 2;
758 if (cx18_raw_vbi(s->cx)) {
759 s->mdl_size = (s->cx->is_60hz ? 12 : 18)
767 s->mdl_size = s->cx->is_60hz
784 struct cx18 *cx = s->cx;
796 cx->mpg_data_received = cx->vbi_data_inserted = 0;
797 cx->dualwatch_jiffies = jiffies;
798 cx->dualwatch_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode);
799 cx->search_pack_header = 0;
816 captype = cx18_raw_vbi(cx) ?
825 cx->vbi.frame = 0;
826 cx->vbi.inserted_frame = 0;
827 memset(cx->vbi.sliced_mpeg_size,
828 0, sizeof(cx->vbi.sliced_mpeg_size));
837 cx18_vapi_result(cx, data, CX18_CREATE_TASK, 1, CPU_CMD_MASK_CAPTURE);
839 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
853 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
854 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
855 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 8, 0);
856 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 4, 1);
862 if (atomic_read(&cx->ana_capturing) == 0)
863 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2,
872 cx18_vapi(cx, CX18_CPU_SET_CAPTURE_LINE_NO, 3,
875 if (cx->v4l2_cap & V4L2_CAP_VBI_CAPTURE)
883 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
884 cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 2,
888 cx->cxhdl.priv = s;
889 cx2341x_handler_setup(&cx->cxhdl);
895 if (!cx->cxhdl.video_mute &&
896 test_bit(CX18_F_I_RADIO_USER, &cx->i_flags))
897 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle,
898 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1);
905 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
909 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
914 if (atomic_read(&cx->tot_capturing) == 0) {
915 cx2341x_handler_set_busy(&cx->cxhdl, 1);
916 clear_bit(CX18_F_I_EOS, &cx->i_flags);
917 cx18_write_reg(cx, 7, CX18_DSP0_INTERRUPT_MASK);
920 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle,
921 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem,
922 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem);
929 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) {
934 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1);
936 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
939 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
940 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
943 if (atomic_read(&cx->tot_capturing) == 0) {
944 set_bit(CX18_F_I_EOS, &cx->i_flags);
945 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
952 atomic_inc(&cx->ana_capturing);
953 atomic_inc(&cx->tot_capturing);
958 void cx18_stop_all_captures(struct cx18 *cx)
963 struct cx18_stream *s = &cx->streams[i];
974 struct cx18 *cx = s->cx;
984 if (atomic_read(&cx->tot_capturing) == 0)
989 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, !gop_end);
991 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
998 atomic_dec(&cx->ana_capturing);
999 atomic_dec(&cx->tot_capturing);
1005 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
1007 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
1011 if (atomic_read(&cx->tot_capturing) > 0)
1014 cx2341x_handler_set_busy(&cx->cxhdl, 0);
1015 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
1022 u32 cx18_find_handle(struct cx18 *cx)
1028 struct cx18_stream *s = &cx->streams[i];
1036 struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
1045 s = &cx->streams[i];