Lines Matching refs:itv

119 void ivtv_set_osd_alpha(struct ivtv *itv)
121 ivtv_vapi(itv, CX2341X_OSD_SET_GLOBAL_ALPHA, 3,
122 itv->osd_global_alpha_state, itv->osd_global_alpha, !itv->osd_local_alpha_state);
123 ivtv_vapi(itv, CX2341X_OSD_SET_CHROMA_KEY, 2, itv->osd_chroma_key_state, itv->osd_chroma_key);
126 int ivtv_set_speed(struct ivtv *itv, int speed)
135 if (speed == itv->speed && !single_step)
138 if (single_step && (speed < 0) == (itv->speed < 0)) {
140 ivtv_vapi(itv, CX2341X_DEC_STEP_VIDEO, 1, 0);
141 itv->speed = speed;
152 data[3] = v4l2_ctrl_g_ctrl(itv->cxhdl.video_b_frames);
153 data[4] = (speed == 1500 || speed == 500) ? itv->speed_mute_audio : 0;
163 if (atomic_read(&itv->decoding) > 0) {
167 ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, 0);
170 mutex_unlock(&itv->serialize_lock);
171 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
172 while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) {
179 finish_wait(&itv->dma_waitq, &wait);
180 mutex_lock(&itv->serialize_lock);
185 ivtv_api(itv, CX2341X_DEC_SET_PLAYBACK_SPEED, 7, data);
191 ivtv_vapi(itv, CX2341X_DEC_STEP_VIDEO, 1, 0);
193 itv->speed = speed;
236 static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
239 struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
241 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
247 dc->start.speed = ivtv_validate_speed(itv->speed, dc->start.speed);
257 itv->speed_mute_audio = dc->flags & V4L2_DEC_CMD_START_MUTE_AUDIO;
258 if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG)
260 if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
262 itv->speed = 0;
272 if (atomic_read(&itv->decoding) == 0)
274 if (itv->output_mode != OUT_MPG)
277 itv->output_mode = OUT_NONE;
283 if (!atomic_read(&itv->decoding))
285 if (itv->output_mode != OUT_MPG)
287 if (atomic_read(&itv->decoding) > 0) {
288 ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1,
290 set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
297 if (!atomic_read(&itv->decoding))
299 if (itv->output_mode != OUT_MPG)
301 if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
302 int speed = itv->speed;
303 itv->speed = 0;
316 struct ivtv *itv = fh2id(fh)->itv;
321 if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
325 if (itv->is_60hz) {
339 struct ivtv *itv = id->itv;
342 pixfmt->width = itv->cxhdl.width;
343 pixfmt->height = itv->cxhdl.height;
361 struct ivtv *itv = fh2id(fh)->itv;
366 vbifmt->samples_per_line = itv->vbi.raw_decoder_line_size - 4;
368 vbifmt->start[0] = itv->vbi.start[0];
369 vbifmt->start[1] = itv->vbi.start[1];
370 vbifmt->count[0] = vbifmt->count[1] = itv->vbi.count;
381 struct ivtv *itv = id->itv;
388 vbifmt->service_set = itv->is_50hz ? V4L2_SLICED_VBI_625 :
390 ivtv_expand_service_set(vbifmt, itv->is_50hz);
395 v4l2_subdev_call(itv->sd_video, vbi, g_sliced_fmt, vbifmt);
403 struct ivtv *itv = id->itv;
406 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
408 pixfmt->width = itv->main_rect.width;
409 pixfmt->height = itv->main_rect.height;
413 switch (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) {
415 pixfmt->field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ?
427 pixfmt->width = itv->yuv_info.v4l2_src_w;
428 pixfmt->height = itv->yuv_info.v4l2_src_h;
442 struct ivtv *itv = fh2id(fh)->itv;
443 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
448 if (!itv->osd_video_pbase)
450 winfmt->chromakey = itv->osd_chroma_key;
451 winfmt->global_alpha = itv->osd_global_alpha;
457 winfmt->w.width = itv->osd_rect.width;
458 winfmt->w.height = itv->osd_rect.height;
470 struct ivtv *itv = id->itv;
482 h = min(h, itv->is_50hz ? 576 : 480);
499 struct ivtv *itv = id->itv;
510 ivtv_expand_service_set(vbifmt, itv->is_50hz);
511 check_service_set(vbifmt, itv->is_50hz);
552 struct ivtv *itv = fh2id(fh)->itv;
553 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
559 if (!itv->osd_video_pbase)
575 struct ivtv *itv = id->itv;
586 if (itv->cxhdl.width == w && itv->cxhdl.height == h)
589 if (atomic_read(&itv->capturing) > 0)
592 itv->cxhdl.width = w;
593 itv->cxhdl.height = h;
594 if (v4l2_ctrl_g_ctrl(itv->cxhdl.video_encoding) == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
599 v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
605 struct ivtv *itv = fh2id(fh)->itv;
607 if (!ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0)
609 itv->vbi.sliced_in->service_set = 0;
610 itv->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE;
611 v4l2_subdev_call(itv->sd_video, vbi, s_raw_fmt, &fmt->fmt.vbi);
619 struct ivtv *itv = id->itv;
625 check_service_set(vbifmt, itv->is_50hz);
626 if (ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0)
628 itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
629 v4l2_subdev_call(itv->sd_video, vbi, s_sliced_fmt, vbifmt);
630 memcpy(itv->vbi.sliced_in, vbifmt, sizeof(*itv->vbi.sliced_in));
637 struct ivtv *itv = id->itv;
638 struct yuv_playback_info *yi = &itv->yuv_info;
672 if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags))
673 itv->dma_data_req_size =
681 struct ivtv *itv = fh2id(fh)->itv;
685 itv->osd_chroma_key = fmt->fmt.win.chromakey;
686 itv->osd_global_alpha = fmt->fmt.win.global_alpha;
687 ivtv_set_osd_alpha(itv);
693 static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, u64 *val)
700 reg_start = itv->reg_mem - IVTV_REG_OFFSET;
701 else if (itv->has_cx23415 && reg >= IVTV_DECODER_OFFSET &&
703 reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
705 reg_start = itv->enc_mem;
718 struct ivtv *itv = fh2id(fh)->itv;
721 return ivtv_itvc(itv, true, reg->reg, &reg->val);
726 struct ivtv *itv = fh2id(fh)->itv;
729 return ivtv_itvc(itv, false, reg->reg, &val);
736 struct ivtv *itv = id->itv;
739 strscpy(vcap->card, itv->card_name, sizeof(vcap->card));
740 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
741 vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
747 struct ivtv *itv = fh2id(fh)->itv;
749 return ivtv_get_audio_input(itv, vin->index, vin);
754 struct ivtv *itv = fh2id(fh)->itv;
756 vin->index = itv->audio_input;
757 return ivtv_get_audio_input(itv, vin->index, vin);
762 struct ivtv *itv = fh2id(fh)->itv;
764 if (vout->index >= itv->nof_audio_inputs)
767 itv->audio_input = vout->index;
768 ivtv_audio_set_io(itv);
775 struct ivtv *itv = fh2id(fh)->itv;
778 return ivtv_get_audio_output(itv, vin->index, vin);
783 struct ivtv *itv = fh2id(fh)->itv;
786 return ivtv_get_audio_output(itv, vin->index, vin);
791 struct ivtv *itv = fh2id(fh)->itv;
793 if (itv->card->video_outputs == NULL || vout->index != 0)
800 struct ivtv *itv = fh2id(fh)->itv;
803 return ivtv_get_input(itv, vin->index, vin);
808 struct ivtv *itv = fh2id(fh)->itv;
810 return ivtv_get_output(itv, vout->index, vout);
817 struct ivtv *itv = id->itv;
820 f->numerator = itv->is_50hz ? 54 : 11;
821 f->denominator = itv->is_50hz ? 59 : 10;
823 f->numerator = itv->is_out_50hz ? 54 : 11;
824 f->denominator = itv->is_out_50hz ? 59 : 10;
835 struct ivtv *itv = id->itv;
836 struct yuv_playback_info *yi = &itv->yuv_info;
841 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
849 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
852 r.height = itv->is_out_50hz ? 576 : 480;
866 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
868 itv->main_rect = sel->r;
878 struct ivtv *itv = id->itv;
879 struct yuv_playback_info *yi = &itv->yuv_info;
889 sel->r.height = itv->is_50hz ? 576 : 480;
897 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
905 sel->r = itv->main_rect;
909 r.height = itv->is_out_50hz ? 576 : 480;
933 struct ivtv *itv = fh2id(fh)->itv;
934 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
960 struct ivtv *itv = fh2id(fh)->itv;
961 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
976 struct ivtv *itv = fh2id(fh)->itv;
978 *i = itv->active_input;
985 struct ivtv *itv = fh2id(fh)->itv;
989 if (inp >= itv->nof_inputs)
992 if (inp == itv->active_input) {
997 if (atomic_read(&itv->capturing) > 0) {
1002 itv->active_input, inp);
1004 itv->active_input = inp;
1007 itv->audio_input = itv->card->video_inputs[inp].audio_index;
1009 if (itv->card->video_inputs[inp].video_type == IVTV_CARD_INPUT_VID_TUNER)
1010 std = itv->tuner_std;
1014 itv->streams[i].vdev.tvnorms = std;
1018 ivtv_mute(itv);
1019 ivtv_video_set_io(itv);
1020 ivtv_audio_set_io(itv);
1021 ivtv_unmute(itv);
1028 struct ivtv *itv = fh2id(fh)->itv;
1030 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1033 *i = itv->active_output;
1040 struct ivtv *itv = fh2id(fh)->itv;
1042 if (outp >= itv->card->nof_outputs)
1045 if (outp == itv->active_output) {
1050 itv->active_output, outp);
1052 itv->active_output = outp;
1053 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing,
1055 itv->card->video_outputs[outp].video_output, 0);
1062 struct ivtv *itv = fh2id(fh)->itv;
1063 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1070 ivtv_call_all(itv, tuner, g_frequency, vf);
1076 struct ivtv *itv = fh2id(fh)->itv;
1077 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1084 ivtv_mute(itv);
1086 ivtv_call_all(itv, tuner, s_frequency, vf);
1087 ivtv_unmute(itv);
1093 struct ivtv *itv = fh2id(fh)->itv;
1095 *std = itv->std;
1099 void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std)
1101 itv->std = std;
1102 itv->is_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
1103 itv->is_50hz = !itv->is_60hz;
1104 cx2341x_handler_set_50hz(&itv->cxhdl, itv->is_50hz);
1105 itv->cxhdl.width = 720;
1106 itv->cxhdl.height = itv->is_50hz ? 576 : 480;
1107 itv->vbi.count = itv->is_50hz ? 18 : 12;
1108 itv->vbi.start[0] = itv->is_50hz ? 6 : 10;
1109 itv->vbi.start[1] = itv->is_50hz ? 318 : 273;
1111 if (itv->hw_flags & IVTV_HW_CX25840)
1112 itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284;
1115 ivtv_call_all(itv, video, s_std, itv->std);
1118 void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std)
1120 struct yuv_playback_info *yi = &itv->yuv_info;
1125 itv->std_out = std;
1126 itv->is_out_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
1127 itv->is_out_50hz = !itv->is_out_60hz;
1128 ivtv_call_all(itv, video, s_std_output, itv->std_out);
1136 mutex_unlock(&itv->serialize_lock);
1138 prepare_to_wait(&itv->vsync_waitq, &wait,
1144 finish_wait(&itv->vsync_waitq, &wait);
1145 mutex_lock(&itv->serialize_lock);
1150 ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz);
1151 itv->main_rect.left = 0;
1152 itv->main_rect.top = 0;
1153 itv->main_rect.width = 720;
1154 itv->main_rect.height = itv->is_out_50hz ? 576 : 480;
1155 ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
1156 720, itv->main_rect.height, 0, 0);
1157 yi->main_rect = itv->main_rect;
1158 if (!itv->osd_info) {
1160 yi->osd_full_h = itv->is_out_50hz ? 576 : 480;
1166 struct ivtv *itv = fh2id(fh)->itv;
1171 if (std == itv->std)
1174 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ||
1175 atomic_read(&itv->capturing) > 0 ||
1176 atomic_read(&itv->decoding) > 0) {
1183 (unsigned long long)itv->std);
1185 ivtv_s_std_enc(itv, std);
1186 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
1187 ivtv_s_std_dec(itv, std);
1195 struct ivtv *itv = id->itv;
1200 ivtv_call_all(itv, tuner, s_tuner, vt);
1207 struct ivtv *itv = fh2id(fh)->itv;
1212 ivtv_call_all(itv, tuner, g_tuner, vt);
1223 struct ivtv *itv = fh2id(fh)->itv;
1224 int set = itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525;
1230 if (valid_service_line(f, l, itv->is_50hz))
1235 if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
1237 if (itv->is_60hz) {
1258 struct ivtv *itv = fh2id(fh)->itv;
1263 entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) %
1269 if (!atomic_read(&itv->capturing))
1272 *e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX];
1278 itv->pgm_info_read_idx = (itv->pgm_info_read_idx + idx->entries) % IVTV_MAX_PGM_INDEX;
1285 struct ivtv *itv = id->itv;
1304 if (!atomic_read(&itv->capturing))
1306 if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
1309 ivtv_mute(itv);
1310 ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 0);
1317 if (!atomic_read(&itv->capturing))
1320 if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
1323 ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1);
1324 ivtv_unmute(itv);
1336 struct ivtv *itv = fh2id(fh)->itv;
1366 struct ivtv *itv = fh2id(fh)->itv;
1367 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1369 struct yuv_playback_info *yi = &itv->yuv_info;
1393 if (!itv->osd_video_pbase)
1399 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);
1404 fb->fmt.width = itv->osd_rect.width;
1405 fb->fmt.height = itv->osd_rect.height;
1416 fb->base = (void *)itv->osd_video_pbase;
1419 if (itv->osd_chroma_key_state)
1422 if (itv->osd_global_alpha_state)
1440 if (itv->osd_local_alpha_state) {
1454 struct ivtv *itv = id->itv;
1455 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1456 struct yuv_playback_info *yi = &itv->yuv_info;
1460 if (!itv->osd_video_pbase)
1463 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1464 itv->osd_local_alpha_state =
1466 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1467 ivtv_set_osd_alpha(itv);
1475 struct ivtv *itv = id->itv;
1476 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1480 if (!itv->osd_video_pbase)
1483 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0);
1501 struct ivtv *itv = fh2id(fh)->itv;
1504 int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT;
1509 IVTV_INFO("Version: %s Card: %s\n", IVTV_VERSION, itv->card_name);
1510 if (itv->hw_flags & IVTV_HW_TVEEPROM) {
1513 ivtv_read_eeprom(itv, &tv);
1515 ivtv_call_all(itv, core, log_status);
1516 ivtv_get_input(itv, itv->active_input, &vidin);
1517 ivtv_get_audio_input(itv, itv->audio_input, &audin);
1520 itv->dualwatch_stereo_mode == V4L2_MPEG_AUDIO_MODE_DUAL ?
1525 int mode = itv->output_mode;
1558 ivtv_get_output(itv, itv->active_output, &vidout);
1559 ivtv_get_audio_output(itv, 0, &audout);
1564 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);
1572 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV");
1573 v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name);
1574 IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags);
1576 struct ivtv_stream *s = &itv->streams[i];
1586 (long long)itv->mpg_data_received,
1587 (long long)itv->vbi_data_inserted);
1594 struct ivtv *itv = id->itv;
1597 return ivtv_video_command(itv, id, dec, false);
1603 struct ivtv *itv = id->itv;
1606 return ivtv_video_command(itv, id, dec, true);
1635 struct ivtv *itv = id->itv;
1636 struct ivtv_stream *s = &itv->streams[id->type];
1647 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1651 if (itv->output_mode == OUT_UDMA_YUV && args->y_source == NULL)
1656 if (ivtv_set_output_mode(itv, OUT_UDMA_YUV) != OUT_UDMA_YUV) {
1664 return ivtv_yuv_prep_frame(itv, args);
1669 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1671 return ivtv_passthrough_mode(itv, *(int *)arg != 0);
1682 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1684 return ivtv_g_pts_frame(itv, pts, &frame);
1696 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1698 return ivtv_g_pts_frame(itv, &pts, frame);
1707 return ivtv_video_command(itv, id, &dc, 0);
1717 return ivtv_video_command(itv, id, &dc, 0);
1726 return ivtv_video_command(itv, id, &dc, 0);
1735 return ivtv_video_command(itv, id, &dc, 0);
1749 return ivtv_video_command(itv, id, dc, try);
1763 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1766 set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags);
1769 if (test_and_clear_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags))
1771 else if (test_and_clear_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags)) {
1775 vsync_field = test_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags) ?
1777 if (itv->output_mode == OUT_UDMA_YUV &&
1778 (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) ==
1796 mutex_unlock(&itv->serialize_lock);
1797 prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE);
1798 if (!test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags) &&
1799 !test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags))
1801 finish_wait(&itv->event_waitq, &wait);
1802 mutex_lock(&itv->serialize_lock);
1814 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1816 return ivtv_passthrough_mode(itv, iarg == VIDEO_SOURCE_DEMUX);
1820 itv->speed_mute_audio = iarg;
1827 return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg + 1);
1833 return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg + 1);
1844 struct ivtv *itv = fh2id(fh)->itv;
1868 if ((val == 0 && itv->options.newi2c) || (val & 0x01))
1869 ivtv_reset_ir_gpio(itv);
1871 v4l2_subdev_call(itv->sd_video, core, reset, 0);