Lines Matching full:cx

32 	struct cx18 *cx = id->cx;  in cx18_claim_stream()  local
33 struct cx18_stream *s = &cx->streams[type]; in cx18_claim_stream()
73 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_claim_stream()
74 if (cx->vbi.insert_mpeg && !cx18_raw_vbi(cx)) in cx18_claim_stream()
75 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_claim_stream()
91 struct cx18 *cx = s->cx; in cx18_release_stream() local
125 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_release_stream()
132 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_release_stream()
146 static void cx18_dualwatch(struct cx18 *cx) in cx18_dualwatch() argument
152 new_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode); in cx18_dualwatch()
154 cx18_call_all(cx, tuner, g_tuner, &vt); in cx18_dualwatch()
159 if (new_stereo_mode == cx->dualwatch_stereo_mode) in cx18_dualwatch()
163 cx->dualwatch_stereo_mode, new_stereo_mode); in cx18_dualwatch()
164 if (v4l2_ctrl_s_ctrl(cx->cxhdl.audio_mode, new_stereo_mode)) in cx18_dualwatch()
172 struct cx18 *cx = s->cx; in cx18_get_mdl() local
173 struct cx18_stream *s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_get_mdl()
181 if (time_after(jiffies, cx->dualwatch_jiffies + msecs_to_jiffies(1000))) { in cx18_get_mdl()
182 cx->dualwatch_jiffies = jiffies; in cx18_get_mdl()
183 cx18_dualwatch(cx); in cx18_get_mdl()
190 cx18_process_vbi_data(cx, mdl, in cx18_get_mdl()
195 mdl = &cx->vbi.sliced_mpeg_mdl; in cx18_get_mdl()
211 cx18_process_vbi_data(cx, mdl, s->type); in cx18_get_mdl()
244 static void cx18_setup_sliced_vbi_mdl(struct cx18 *cx) in cx18_setup_sliced_vbi_mdl() argument
246 struct cx18_mdl *mdl = &cx->vbi.sliced_mpeg_mdl; in cx18_setup_sliced_vbi_mdl()
247 struct cx18_buffer *buf = &cx->vbi.sliced_mpeg_buf; in cx18_setup_sliced_vbi_mdl()
248 int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; in cx18_setup_sliced_vbi_mdl()
250 buf->buf = cx->vbi.sliced_mpeg_data[idx]; in cx18_setup_sliced_vbi_mdl()
251 buf->bytesused = cx->vbi.sliced_mpeg_size[idx]; in cx18_setup_sliced_vbi_mdl()
255 mdl->bytesused = cx->vbi.sliced_mpeg_size[idx]; in cx18_setup_sliced_vbi_mdl()
262 struct cx18 *cx = s->cx; in cx18_copy_buf_to_user() local
268 if (cx->vbi.insert_mpeg && s->type == CX18_ENC_STREAM_TYPE_MPG && in cx18_copy_buf_to_user()
269 !cx18_raw_vbi(cx) && buf != &cx->vbi.sliced_mpeg_buf) { in cx18_copy_buf_to_user()
292 u8 ch = cx->search_pack_header ? 0xba : 0xe0; in cx18_copy_buf_to_user()
311 if (!cx->search_pack_header) { in cx18_copy_buf_to_user()
322 cx->search_pack_header = 1; in cx18_copy_buf_to_user()
343 cx->search_pack_header = 0; /* expect vid PES */ in cx18_copy_buf_to_user()
345 cx18_setup_sliced_vbi_mdl(cx); in cx18_copy_buf_to_user()
358 buf != &cx->vbi.sliced_mpeg_buf) in cx18_copy_buf_to_user()
359 cx->mpg_data_received += len; in cx18_copy_buf_to_user()
408 struct cx18 *cx = s->cx; in cx18_read() local
412 if (atomic_read(&cx->ana_capturing) == 0 && s->id == -1) { in cx18_read()
422 if (s->type == CX18_ENC_STREAM_TYPE_VBI && !cx18_raw_vbi(cx)) in cx18_read()
448 if (mdl != &cx->vbi.sliced_mpeg_mdl) { in cx18_read()
454 int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; in cx18_read()
456 cx->vbi.sliced_mpeg_size[idx] = 0; in cx18_read()
457 cx->vbi.inserted_frame++; in cx18_read()
458 cx->vbi_data_inserted += mdl->bytesused; in cx18_read()
474 struct cx18 *cx = s->cx; in cx18_read_pos() local
484 struct cx18 *cx = id->cx; in cx18_start_capture() local
485 struct cx18_stream *s = &cx->streams[id->type]; in cx18_start_capture()
507 s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_start_capture()
508 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_start_capture()
540 if (test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) in cx18_start_capture()
541 cx18_vapi(cx, CX18_CPU_CAPTURE_PAUSE, 1, s->handle); in cx18_start_capture()
575 struct cx18 *cx = id->cx; in cx18_v4l2_read() local
576 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_read()
581 mutex_lock(&cx->serialize_lock); in cx18_v4l2_read()
583 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_read()
594 struct cx18 *cx = id->cx; in cx18_v4l2_enc_poll() local
595 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_enc_poll()
604 mutex_lock(&cx->serialize_lock); in cx18_v4l2_enc_poll()
606 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_enc_poll()
642 struct cx18 *cx = s->cx; in cx18_stop_capture() local
643 struct cx18_stream *s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_stop_capture()
644 struct cx18_stream *s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_stop_capture()
683 struct cx18 *cx = id->cx; in cx18_v4l2_close() local
684 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_close()
689 mutex_lock(&cx->serialize_lock); in cx18_v4l2_close()
694 cx18_mute(cx); in cx18_v4l2_close()
696 clear_bit(CX18_F_I_RADIO_USER, &cx->i_flags); in cx18_v4l2_close()
698 cx18_call_all(cx, video, s_std, cx->std); in cx18_v4l2_close()
700 cx18_audio_set_io(cx); in cx18_v4l2_close()
701 if (atomic_read(&cx->ana_capturing) > 0) { in cx18_v4l2_close()
703 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, in cx18_v4l2_close()
704 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute) | in cx18_v4l2_close()
705 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8))); in cx18_v4l2_close()
708 cx18_unmute(cx); in cx18_v4l2_close()
723 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_close()
729 struct cx18 *cx = s->cx; in cx18_serialized_open() local
742 item->cx = cx; in cx18_serialized_open()
745 item->open_id = cx->open_id++; in cx18_serialized_open()
751 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { in cx18_serialized_open()
752 if (atomic_read(&cx->ana_capturing) > 0) { in cx18_serialized_open()
763 set_bit(CX18_F_I_RADIO_USER, &cx->i_flags); in cx18_serialized_open()
765 cx18_mute(cx); in cx18_serialized_open()
767 cx18_call_all(cx, tuner, s_radio); in cx18_serialized_open()
769 cx18_audio_set_io(cx); in cx18_serialized_open()
771 cx18_unmute(cx); in cx18_serialized_open()
781 struct cx18 *cx = s->cx; in cx18_v4l2_open() local
783 mutex_lock(&cx->serialize_lock); in cx18_v4l2_open()
784 if (cx18_init_on_first_open(cx)) { in cx18_v4l2_open()
787 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_open()
791 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_open()
795 void cx18_mute(struct cx18 *cx) in cx18_mute() argument
798 if (atomic_read(&cx->ana_capturing)) { in cx18_mute()
799 h = cx18_find_handle(cx); in cx18_mute()
801 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 1); in cx18_mute()
808 void cx18_unmute(struct cx18 *cx) in cx18_unmute() argument
811 if (atomic_read(&cx->ana_capturing)) { in cx18_unmute()
812 h = cx18_find_handle(cx); in cx18_unmute()
815 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, h, 12); in cx18_unmute()
816 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 0); in cx18_unmute()