Lines Matching refs:cx

110 	struct cx18 *cx = s->cx;
126 buf->tvnorm != cx->std) {
131 buf->tvnorm = cx->std;
153 buf->tvnorm = cx->std;
185 struct cx18 *cx = s->cx;
187 *size = 2 * cx->cxhdl.width * cx->cxhdl.height;
207 struct cx18 *cx = s->cx;
210 cx->cxhdl.width, cx->cxhdl.height, field);
241 static void cx18_stream_init(struct cx18 *cx, int type)
243 struct cx18_stream *s = &cx->streams[type];
249 s->cx = cx;
256 s->buffers = cx->stream_buffers[type];
257 s->buf_size = cx->stream_buf_size[type];
283 &cx->pci_dev->dev, &s->vbuf_q_lock,
287 s, &cx->serialize_lock);
291 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2;
296 static int cx18_prep_dev(struct cx18 *cx, int type)
298 struct cx18_stream *s = &cx->streams[type];
299 u32 cap = cx->v4l2_cap;
301 int num = cx->instance + cx18_first_minor + num_offset;
312 s->cx = cx;
328 cx->stream_buffers[type] == 0) {
333 cx18_stream_init(cx, type);
337 if (cx->card->hw_all & CX18_HW_DVB) {
355 cx->v4l2_dev.name, s->name);
358 s->video_dev.v4l2_dev = &cx->v4l2_dev;
361 if (cx->card->video_inputs->video_type == CX18_CARD_INPUT_VID_TUNER)
362 s->video_dev.tvnorms = cx->tuner_std;
365 s->video_dev.lock = &cx->serialize_lock;
371 int cx18_streams_setup(struct cx18 *cx)
378 ret = cx18_prep_dev(cx, type);
383 ret = cx18_stream_alloc(&cx->streams[type]);
391 cx18_streams_cleanup(cx, 0);
395 static int cx18_reg_dev(struct cx18 *cx, int type)
397 struct cx18_stream *s = &cx->streams[type];
417 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
439 name, s->name, cx->stream_buffers[type],
440 cx->stream_buf_size[type] / 1024,
441 (cx->stream_buf_size[type] * 100 / 1024) % 100);
449 if (cx->stream_buffers[type])
451 name, s->name, cx->stream_buffers[type],
452 cx->stream_buf_size[type]);
463 int cx18_streams_register(struct cx18 *cx)
471 err = cx18_reg_dev(cx, type);
480 cx18_streams_cleanup(cx, 1);
485 void cx18_streams_cleanup(struct cx18 *cx, int unregister)
495 if (cx->streams[type].dvb != NULL) {
497 cx18_dvb_unregister(&cx->streams[type]);
498 kfree(cx->streams[type].dvb);
499 cx->streams[type].dvb = NULL;
500 cx18_stream_free(&cx->streams[type]);
508 if (cx->stream_buffers[type] != 0) {
509 cx->stream_buffers[type] = 0;
516 if (cx->streams[type].buffers != 0)
517 cx18_stream_free(&cx->streams[type]);
523 vdev = &cx->streams[type].video_dev;
529 videobuf_mmap_free(&cx->streams[type].vbuf_q);
531 cx18_stream_free(&cx->streams[type]);
539 struct cx18 *cx = s->cx;
540 int raw = cx18_raw_vbi(cx);
544 if (cx->is_60hz) {
545 cx->vbi.count = 12;
546 cx->vbi.start[0] = 10;
547 cx->vbi.start[1] = 273;
549 cx->vbi.count = 18;
550 cx->vbi.start[0] = 6;
551 cx->vbi.start[1] = 318;
556 v4l2_subdev_call(cx->sd_av, vbi, s_raw_fmt, &cx->vbi.in.fmt.vbi);
558 v4l2_subdev_call(cx->sd_av, vbi, s_sliced_fmt, &cx->vbi.in.fmt.sliced);
569 lines = cx->vbi.count * 2;
585 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2;
593 : (cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ
644 cx18_api(cx, CX18_CPU_SET_RAW_VBI_PARAM, 6, data);
647 void cx18_stream_rotate_idx_mdls(struct cx18 *cx)
649 struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
677 struct cx18 *cx = s->cx;
691 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
692 (void __iomem *) &cx->scb->cpu_mdl[mdl->id] - cx->enc_mem,
737 s->mdl_size = 720 * s->cx->cxhdl.height * 3 / 2;
739 s->mdl_size = 720 * s->cx->cxhdl.height * 2;
746 if (cx18_raw_vbi(s->cx)) {
747 s->mdl_size = (s->cx->is_60hz ? 12 : 18)
755 s->mdl_size = s->cx->is_60hz
772 struct cx18 *cx = s->cx;
784 cx->mpg_data_received = cx->vbi_data_inserted = 0;
785 cx->dualwatch_jiffies = jiffies;
786 cx->dualwatch_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode);
787 cx->search_pack_header = 0;
804 captype = cx18_raw_vbi(cx) ?
813 cx->vbi.frame = 0;
814 cx->vbi.inserted_frame = 0;
815 memset(cx->vbi.sliced_mpeg_size,
816 0, sizeof(cx->vbi.sliced_mpeg_size));
825 cx18_vapi_result(cx, data, CX18_CREATE_TASK, 1, CPU_CMD_MASK_CAPTURE);
827 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
841 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
842 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
843 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 8, 0);
844 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 4, 1);
850 if (atomic_read(&cx->ana_capturing) == 0)
851 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2,
860 cx18_vapi(cx, CX18_CPU_SET_CAPTURE_LINE_NO, 3,
863 if (cx->v4l2_cap & V4L2_CAP_VBI_CAPTURE)
871 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
872 cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 2,
876 cx->cxhdl.priv = s;
877 cx2341x_handler_setup(&cx->cxhdl);
883 if (!cx->cxhdl.video_mute &&
884 test_bit(CX18_F_I_RADIO_USER, &cx->i_flags))
885 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle,
886 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1);
893 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
897 cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2,
902 if (atomic_read(&cx->tot_capturing) == 0) {
903 cx2341x_handler_set_busy(&cx->cxhdl, 1);
904 clear_bit(CX18_F_I_EOS, &cx->i_flags);
905 cx18_write_reg(cx, 7, CX18_DSP0_INTERRUPT_MASK);
908 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle,
909 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem,
910 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem);
917 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) {
922 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1);
924 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
927 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
928 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
931 if (atomic_read(&cx->tot_capturing) == 0) {
932 set_bit(CX18_F_I_EOS, &cx->i_flags);
933 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
940 atomic_inc(&cx->ana_capturing);
941 atomic_inc(&cx->tot_capturing);
946 void cx18_stop_all_captures(struct cx18 *cx)
951 struct cx18_stream *s = &cx->streams[i];
962 struct cx18 *cx = s->cx;
972 if (atomic_read(&cx->tot_capturing) == 0)
977 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, !gop_end);
979 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
986 atomic_dec(&cx->ana_capturing);
987 atomic_dec(&cx->tot_capturing);
993 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
995 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
999 if (atomic_read(&cx->tot_capturing) > 0)
1002 cx2341x_handler_set_busy(&cx->cxhdl, 0);
1003 cx18_write_reg(cx, 5, CX18_DSP0_INTERRUPT_MASK);
1010 u32 cx18_find_handle(struct cx18 *cx)
1016 struct cx18_stream *s = &cx->streams[i];
1024 struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
1033 s = &cx->streams[i];