Lines Matching refs:cx
46 struct cx18 *cx = id->cx; in cx18_claim_stream() local
47 struct cx18_stream *s = &cx->streams[type]; in cx18_claim_stream()
88 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_claim_stream()
89 if (cx->vbi.insert_mpeg && !cx18_raw_vbi(cx)) in cx18_claim_stream()
90 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_claim_stream()
106 struct cx18 *cx = s->cx; in cx18_release_stream() local
140 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_release_stream()
147 s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_release_stream()
161 static void cx18_dualwatch(struct cx18 *cx) in cx18_dualwatch() argument
167 new_stereo_mode = v4l2_ctrl_g_ctrl(cx->cxhdl.audio_mode); in cx18_dualwatch()
169 cx18_call_all(cx, tuner, g_tuner, &vt); in cx18_dualwatch()
174 if (new_stereo_mode == cx->dualwatch_stereo_mode) in cx18_dualwatch()
178 cx->dualwatch_stereo_mode, new_stereo_mode); in cx18_dualwatch()
179 if (v4l2_ctrl_s_ctrl(cx->cxhdl.audio_mode, new_stereo_mode)) in cx18_dualwatch()
187 struct cx18 *cx = s->cx; in cx18_get_mdl() local
188 struct cx18_stream *s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_get_mdl()
196 if (time_after(jiffies, cx->dualwatch_jiffies + msecs_to_jiffies(1000))) { in cx18_get_mdl()
197 cx->dualwatch_jiffies = jiffies; in cx18_get_mdl()
198 cx18_dualwatch(cx); in cx18_get_mdl()
205 cx18_process_vbi_data(cx, mdl, in cx18_get_mdl()
210 mdl = &cx->vbi.sliced_mpeg_mdl; in cx18_get_mdl()
226 cx18_process_vbi_data(cx, mdl, s->type); in cx18_get_mdl()
259 static void cx18_setup_sliced_vbi_mdl(struct cx18 *cx) in cx18_setup_sliced_vbi_mdl() argument
261 struct cx18_mdl *mdl = &cx->vbi.sliced_mpeg_mdl; in cx18_setup_sliced_vbi_mdl()
262 struct cx18_buffer *buf = &cx->vbi.sliced_mpeg_buf; in cx18_setup_sliced_vbi_mdl()
263 int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; in cx18_setup_sliced_vbi_mdl()
265 buf->buf = cx->vbi.sliced_mpeg_data[idx]; in cx18_setup_sliced_vbi_mdl()
266 buf->bytesused = cx->vbi.sliced_mpeg_size[idx]; in cx18_setup_sliced_vbi_mdl()
270 mdl->bytesused = cx->vbi.sliced_mpeg_size[idx]; in cx18_setup_sliced_vbi_mdl()
277 struct cx18 *cx = s->cx; in cx18_copy_buf_to_user() local
283 if (cx->vbi.insert_mpeg && s->type == CX18_ENC_STREAM_TYPE_MPG && in cx18_copy_buf_to_user()
284 !cx18_raw_vbi(cx) && buf != &cx->vbi.sliced_mpeg_buf) { in cx18_copy_buf_to_user()
307 u8 ch = cx->search_pack_header ? 0xba : 0xe0; in cx18_copy_buf_to_user()
326 if (!cx->search_pack_header) { in cx18_copy_buf_to_user()
337 cx->search_pack_header = 1; in cx18_copy_buf_to_user()
358 cx->search_pack_header = 0; /* expect vid PES */ in cx18_copy_buf_to_user()
360 cx18_setup_sliced_vbi_mdl(cx); in cx18_copy_buf_to_user()
373 buf != &cx->vbi.sliced_mpeg_buf) in cx18_copy_buf_to_user()
374 cx->mpg_data_received += len; in cx18_copy_buf_to_user()
423 struct cx18 *cx = s->cx; in cx18_read() local
427 if (atomic_read(&cx->ana_capturing) == 0 && s->id == -1) { in cx18_read()
437 if (s->type == CX18_ENC_STREAM_TYPE_VBI && !cx18_raw_vbi(cx)) in cx18_read()
463 if (mdl != &cx->vbi.sliced_mpeg_mdl) { in cx18_read()
469 int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; in cx18_read()
471 cx->vbi.sliced_mpeg_size[idx] = 0; in cx18_read()
472 cx->vbi.inserted_frame++; in cx18_read()
473 cx->vbi_data_inserted += mdl->bytesused; in cx18_read()
489 struct cx18 *cx = s->cx; in cx18_read_pos() local
499 struct cx18 *cx = id->cx; in cx18_start_capture() local
500 struct cx18_stream *s = &cx->streams[id->type]; in cx18_start_capture()
522 s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_start_capture()
523 s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_start_capture()
555 if (test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) in cx18_start_capture()
556 cx18_vapi(cx, CX18_CPU_CAPTURE_PAUSE, 1, s->handle); in cx18_start_capture()
590 struct cx18 *cx = id->cx; in cx18_v4l2_read() local
591 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_read()
596 mutex_lock(&cx->serialize_lock); in cx18_v4l2_read()
598 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_read()
615 struct cx18 *cx = id->cx; in cx18_v4l2_enc_poll() local
616 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_enc_poll()
625 mutex_lock(&cx->serialize_lock); in cx18_v4l2_enc_poll()
627 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_enc_poll()
664 struct cx18 *cx = id->cx; in cx18_v4l2_mmap() local
665 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_mmap()
675 mutex_lock(&cx->serialize_lock); in cx18_v4l2_mmap()
677 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_mmap()
715 struct cx18 *cx = id->cx; in cx18_stop_capture() local
716 struct cx18_stream *s = &cx->streams[id->type]; in cx18_stop_capture()
717 struct cx18_stream *s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI]; in cx18_stop_capture()
718 struct cx18_stream *s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; in cx18_stop_capture()
758 struct cx18 *cx = id->cx; in cx18_v4l2_close() local
759 struct cx18_stream *s = &cx->streams[id->type]; in cx18_v4l2_close()
763 mutex_lock(&cx->serialize_lock); in cx18_v4l2_close()
768 cx18_mute(cx); in cx18_v4l2_close()
770 clear_bit(CX18_F_I_RADIO_USER, &cx->i_flags); in cx18_v4l2_close()
772 cx18_call_all(cx, video, s_std, cx->std); in cx18_v4l2_close()
774 cx18_audio_set_io(cx); in cx18_v4l2_close()
775 if (atomic_read(&cx->ana_capturing) > 0) { in cx18_v4l2_close()
777 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, in cx18_v4l2_close()
778 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute) | in cx18_v4l2_close()
779 (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8))); in cx18_v4l2_close()
782 cx18_unmute(cx); in cx18_v4l2_close()
792 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_close()
798 struct cx18 *cx = s->cx; in cx18_serialized_open() local
811 item->cx = cx; in cx18_serialized_open()
814 item->open_id = cx->open_id++; in cx18_serialized_open()
820 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { in cx18_serialized_open()
821 if (atomic_read(&cx->ana_capturing) > 0) { in cx18_serialized_open()
832 set_bit(CX18_F_I_RADIO_USER, &cx->i_flags); in cx18_serialized_open()
834 cx18_mute(cx); in cx18_serialized_open()
836 cx18_call_all(cx, tuner, s_radio); in cx18_serialized_open()
838 cx18_audio_set_io(cx); in cx18_serialized_open()
840 cx18_unmute(cx); in cx18_serialized_open()
850 struct cx18 *cx = s->cx; in cx18_v4l2_open() local
852 mutex_lock(&cx->serialize_lock); in cx18_v4l2_open()
853 if (cx18_init_on_first_open(cx)) { in cx18_v4l2_open()
856 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_open()
860 mutex_unlock(&cx->serialize_lock); in cx18_v4l2_open()
864 void cx18_mute(struct cx18 *cx) in cx18_mute() argument
867 if (atomic_read(&cx->ana_capturing)) { in cx18_mute()
868 h = cx18_find_handle(cx); in cx18_mute()
870 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 1); in cx18_mute()
877 void cx18_unmute(struct cx18 *cx) in cx18_unmute() argument
880 if (atomic_read(&cx->ana_capturing)) { in cx18_unmute()
881 h = cx18_find_handle(cx); in cx18_unmute()
884 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, h, 12); in cx18_unmute()
885 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 0); in cx18_unmute()