Lines Matching refs:cx

117         struct cx18 *cx = s->cx;
133 buf->tvnorm != cx->std) {
138 buf->tvnorm = cx->std;
160 buf->tvnorm = cx->std;
192 struct cx18 *cx = s->cx;
194 *size = 2 * cx->cxhdl.width * cx->cxhdl.height;
214 struct cx18 *cx = s->cx;
217 cx->cxhdl.width, cx->cxhdl.height, field);
248 static void cx18_stream_init(struct cx18 *cx, int type)
250 struct cx18_stream *s = &cx->streams[type];
259 s->cx = cx;
265 s->buffers = cx->stream_buffers[type];
266 s->buf_size = cx->stream_buf_size[type];
294 &cx->pci_dev->dev, &s->vbuf_q_lock,
298 s, &cx->serialize_lock);
302 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2;
306 static int cx18_prep_dev(struct cx18 *cx, int type)
308 struct cx18_stream *s = &cx->streams[type];
309 u32 cap = cx->v4l2_cap;
311 int num = cx->instance + cx18_first_minor + num_offset;
322 s->cx = cx;
338 cx->stream_buffers[type] == 0) {
343 cx18_stream_init(cx, type);
347 if (cx->card->hw_all & CX18_HW_DVB) {
372 cx->v4l2_dev.name, s->name);
375 s->video_dev->v4l2_dev = &cx->v4l2_dev;
385 int cx18_streams_setup(struct cx18 *cx)
392 ret = cx18_prep_dev(cx, type);
397 ret = cx18_stream_alloc(&cx->streams[type]);
405 cx18_streams_cleanup(cx, 0);
409 static int cx18_reg_dev(struct cx18 *cx, int type)
411 struct cx18_stream *s = &cx->streams[type];
430 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
453 name, s->name, cx->stream_buffers[type],
454 cx->stream_buf_size[type] / 1024,
455 (cx->stream_buf_size[type] * 100 / 1024) % 100);
463 if (cx->stream_buffers[type])
466 name, s->name, cx->stream_buffers[type],
467 cx->stream_buf_size[type]);
478 int cx18_streams_register(struct cx18 *cx)
486 err = cx18_reg_dev(cx, type);
495 cx18_streams_cleanup(cx, 1);
500 void cx18_streams_cleanup(struct cx18 *cx, int unregister)
510 if (cx->streams[type].dvb != NULL) {
512 cx18_dvb_unregister(&cx->streams[type]);
513 kfree(cx->streams[type].dvb);
514 cx->streams[type].dvb = NULL;
515 cx18_stream_free(&cx->streams[type]);
523 if (cx->stream_buffers[type] != 0) {
524 cx->stream_buffers[type] = 0;
531 if (cx->streams[type].buffers != 0)
532 cx18_stream_free(&cx->streams[type]);
538 vdev = cx->streams[type].video_dev;
540 cx->streams[type].video_dev = NULL;
545 videobuf_mmap_free(&cx->streams[type].vbuf_q);
547 cx18_stream_free(&cx->streams[type]);
559 struct cx18 *cx = s->cx;
560 int raw = cx18_raw_vbi(cx);
564 if (cx->is_60hz) {
565 cx->vbi.count = 12;
566 cx->vbi.start[0] = 10;
567 cx->vbi.start[1] = 273;
569 cx->vbi.count = 18;
570 cx->vbi.start[0] = 6;
571 cx->vbi.start[1] = 318;
576 v4l2_subdev_call(cx->sd_av, vbi, s_raw_fmt, &cx->vbi.in.fmt.vbi);
578 v4l2_subdev_call(cx->sd_av, vbi, s_sliced_fmt, &cx->vbi.in.fmt.sliced);
589 lines = cx->vbi.count * 2;
605 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2;
613 : (cx->is_60hz ? vbi_hblank_samples_60Hz
664 cx18_api(cx, CX18_CPU_SET_RAW_VBI_PARAM, 6, data);
667 void cx18_stream_rotate_idx_mdls(struct cx18 *cx)
669 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
697 struct cx18 *cx = s->cx;
711 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
712 (void __iomem *) &cx->scb->cpu_mdl[mdl->id] - cx->enc_mem,
757 s->mdl_size = 720 * s->cx->cxhdl.height * 3 / 2;
759 s->mdl_size = 720 * s->cx->cxhdl.height * 2;
766 if (cx18_raw_vbi(s->cx)) {
767 s->mdl_size = (s->cx->is_60hz ? 12 : 18)
775 s->mdl_size = s->cx->is_60hz
792 struct cx18 *cx = s->cx;
804 cx->mpg_data_received = cx->vbi_data_inserted = 0;
805 cx->dualwatch_jiffies = jiffies;
806 cx->dualwatch_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode);
807 cx->search_pack_header = 0;
824 captype = cx18_raw_vbi(cx) ?
833 cx->vbi.frame = 0;
834 cx->vbi.inserted_frame = 0;
835 memset(cx->vbi.sliced_mpeg_size,
836 0, sizeof(cx->vbi.sliced_mpeg_size));
845 cx18_vapi_result(cx, data, CX18_CREATE_TASK, 1, CPU_CMD_MASK_CAPTURE);
847 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
861 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
862 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
863 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 8, 0);
864 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 4, 1);
870 if (atomic_read(&cx->ana_capturing) == 0)
871 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2,
880 cx18_vapi(cx, CX18_CPU_SET_CAPTURE_LINE_NO, 3,
883 if (cx->v4l2_cap & V4L2_CAP_VBI_CAPTURE)
891 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
892 cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 2,
896 cx->cxhdl.priv = s;
897 cx2341x_handler_setup(&cx->cxhdl);
903 if (!cx->cxhdl.video_mute &&
904 test_bit(CX18_F_I_RADIO_USER, &cx->i_flags))
905 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle,
906 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1);
913 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
917 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
922 if (atomic_read(&cx->tot_capturing) == 0) {
923 cx2341x_handler_set_busy(&cx->cxhdl, 1);
924 clear_bit(CX18_F_I_EOS, &cx->i_flags);
925 cx18_write_reg(cx, 7, CX18_DSP0_INTERRUPT_MASK);
928 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle,
929 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem,
930 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem);
937 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) {
942 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1);
944 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
947 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
948 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
951 if (atomic_read(&cx->tot_capturing) == 0) {
952 set_bit(CX18_F_I_EOS, &cx->i_flags);
953 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
960 atomic_inc(&cx->ana_capturing);
961 atomic_inc(&cx->tot_capturing);
966 void cx18_stop_all_captures(struct cx18 *cx)
971 struct cx18_stream *s = &cx->streams[i];
982 struct cx18 *cx = s->cx;
993 if (atomic_read(&cx->tot_capturing) == 0)
998 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, !gop_end);
1000 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
1009 atomic_dec(&cx->ana_capturing);
1010 atomic_dec(&cx->tot_capturing);
1016 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
1018 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
1022 if (atomic_read(&cx->tot_capturing) > 0)
1025 cx2341x_handler_set_busy(&cx->cxhdl, 0);
1026 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
1033 u32 cx18_find_handle(struct cx18 *cx)
1039 struct cx18_stream *s = &cx->streams[i];
1047 struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
1056 s = &cx->streams[i];