Lines Matching refs:itv
114 void ivtv_set_osd_alpha(struct ivtv *itv)
116 ivtv_vapi(itv, CX2341X_OSD_SET_GLOBAL_ALPHA, 3,
117 itv->osd_global_alpha_state, itv->osd_global_alpha, !itv->osd_local_alpha_state);
118 ivtv_vapi(itv, CX2341X_OSD_SET_CHROMA_KEY, 2, itv->osd_chroma_key_state, itv->osd_chroma_key);
121 int ivtv_set_speed(struct ivtv *itv, int speed)
130 if (speed == itv->speed && !single_step)
133 if (single_step && (speed < 0) == (itv->speed < 0)) {
135 ivtv_vapi(itv, CX2341X_DEC_STEP_VIDEO, 1, 0);
136 itv->speed = speed;
147 data[3] = v4l2_ctrl_g_ctrl(itv->cxhdl.video_b_frames);
148 data[4] = (speed == 1500 || speed == 500) ? itv->speed_mute_audio : 0;
158 if (atomic_read(&itv->decoding) > 0) {
162 ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, 0);
165 mutex_unlock(&itv->serialize_lock);
166 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
167 while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) {
174 finish_wait(&itv->dma_waitq, &wait);
175 mutex_lock(&itv->serialize_lock);
180 ivtv_api(itv, CX2341X_DEC_SET_PLAYBACK_SPEED, 7, data);
186 ivtv_vapi(itv, CX2341X_DEC_STEP_VIDEO, 1, 0);
188 itv->speed = speed;
231 static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
234 struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
236 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
242 dc->start.speed = ivtv_validate_speed(itv->speed, dc->start.speed);
252 itv->speed_mute_audio = dc->flags & V4L2_DEC_CMD_START_MUTE_AUDIO;
253 if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG)
255 if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
257 itv->speed = 0;
267 if (atomic_read(&itv->decoding) == 0)
269 if (itv->output_mode != OUT_MPG)
272 itv->output_mode = OUT_NONE;
278 if (!atomic_read(&itv->decoding))
280 if (itv->output_mode != OUT_MPG)
282 if (atomic_read(&itv->decoding) > 0) {
283 ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1,
285 set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
292 if (!atomic_read(&itv->decoding))
294 if (itv->output_mode != OUT_MPG)
296 if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
297 int speed = itv->speed;
298 itv->speed = 0;
311 struct ivtv *itv = fh2id(fh)->itv;
316 if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
320 if (itv->is_60hz) {
334 struct ivtv *itv = id->itv;
337 pixfmt->width = itv->cxhdl.width;
338 pixfmt->height = itv->cxhdl.height;
356 struct ivtv *itv = fh2id(fh)->itv;
361 vbifmt->samples_per_line = itv->vbi.raw_decoder_line_size - 4;
363 vbifmt->start[0] = itv->vbi.start[0];
364 vbifmt->start[1] = itv->vbi.start[1];
365 vbifmt->count[0] = vbifmt->count[1] = itv->vbi.count;
376 struct ivtv *itv = id->itv;
383 vbifmt->service_set = itv->is_50hz ? V4L2_SLICED_VBI_625 :
385 ivtv_expand_service_set(vbifmt, itv->is_50hz);
390 v4l2_subdev_call(itv->sd_video, vbi, g_sliced_fmt, vbifmt);
398 struct ivtv *itv = id->itv;
401 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
403 pixfmt->width = itv->main_rect.width;
404 pixfmt->height = itv->main_rect.height;
408 switch (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) {
410 pixfmt->field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ?
422 pixfmt->width = itv->yuv_info.v4l2_src_w;
423 pixfmt->height = itv->yuv_info.v4l2_src_h;
437 struct ivtv *itv = fh2id(fh)->itv;
438 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
443 if (!itv->osd_video_pbase)
445 winfmt->chromakey = itv->osd_chroma_key;
446 winfmt->global_alpha = itv->osd_global_alpha;
452 winfmt->w.width = itv->osd_rect.width;
453 winfmt->w.height = itv->osd_rect.height;
465 struct ivtv *itv = id->itv;
477 h = min(h, itv->is_50hz ? 576 : 480);
494 struct ivtv *itv = id->itv;
505 ivtv_expand_service_set(vbifmt, itv->is_50hz);
506 check_service_set(vbifmt, itv->is_50hz);
547 struct ivtv *itv = fh2id(fh)->itv;
548 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
554 if (!itv->osd_video_pbase)
570 struct ivtv *itv = id->itv;
581 if (itv->cxhdl.width == w && itv->cxhdl.height == h)
584 if (atomic_read(&itv->capturing) > 0)
587 itv->cxhdl.width = w;
588 itv->cxhdl.height = h;
589 if (v4l2_ctrl_g_ctrl(itv->cxhdl.video_encoding) == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
594 v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
600 struct ivtv *itv = fh2id(fh)->itv;
602 if (!ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0)
604 itv->vbi.sliced_in->service_set = 0;
605 itv->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE;
606 v4l2_subdev_call(itv->sd_video, vbi, s_raw_fmt, &fmt->fmt.vbi);
614 struct ivtv *itv = id->itv;
620 check_service_set(vbifmt, itv->is_50hz);
621 if (ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0)
623 itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
624 v4l2_subdev_call(itv->sd_video, vbi, s_sliced_fmt, vbifmt);
625 memcpy(itv->vbi.sliced_in, vbifmt, sizeof(*itv->vbi.sliced_in));
632 struct ivtv *itv = id->itv;
633 struct yuv_playback_info *yi = &itv->yuv_info;
667 if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags))
668 itv->dma_data_req_size =
676 struct ivtv *itv = fh2id(fh)->itv;
680 itv->osd_chroma_key = fmt->fmt.win.chromakey;
681 itv->osd_global_alpha = fmt->fmt.win.global_alpha;
682 ivtv_set_osd_alpha(itv);
688 static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, u64 *val)
695 reg_start = itv->reg_mem - IVTV_REG_OFFSET;
696 else if (itv->has_cx23415 && reg >= IVTV_DECODER_OFFSET &&
698 reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
700 reg_start = itv->enc_mem;
713 struct ivtv *itv = fh2id(fh)->itv;
716 return ivtv_itvc(itv, true, reg->reg, ®->val);
721 struct ivtv *itv = fh2id(fh)->itv;
724 return ivtv_itvc(itv, false, reg->reg, &val);
731 struct ivtv *itv = id->itv;
734 strscpy(vcap->card, itv->card_name, sizeof(vcap->card));
735 vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
741 struct ivtv *itv = fh2id(fh)->itv;
743 return ivtv_get_audio_input(itv, vin->index, vin);
748 struct ivtv *itv = fh2id(fh)->itv;
750 vin->index = itv->audio_input;
751 return ivtv_get_audio_input(itv, vin->index, vin);
756 struct ivtv *itv = fh2id(fh)->itv;
758 if (vout->index >= itv->nof_audio_inputs)
761 itv->audio_input = vout->index;
762 ivtv_audio_set_io(itv);
769 struct ivtv *itv = fh2id(fh)->itv;
772 return ivtv_get_audio_output(itv, vin->index, vin);
777 struct ivtv *itv = fh2id(fh)->itv;
780 return ivtv_get_audio_output(itv, vin->index, vin);
785 struct ivtv *itv = fh2id(fh)->itv;
787 if (itv->card->video_outputs == NULL || vout->index != 0)
794 struct ivtv *itv = fh2id(fh)->itv;
797 return ivtv_get_input(itv, vin->index, vin);
802 struct ivtv *itv = fh2id(fh)->itv;
804 return ivtv_get_output(itv, vout->index, vout);
811 struct ivtv *itv = id->itv;
814 f->numerator = itv->is_50hz ? 54 : 11;
815 f->denominator = itv->is_50hz ? 59 : 10;
817 f->numerator = itv->is_out_50hz ? 54 : 11;
818 f->denominator = itv->is_out_50hz ? 59 : 10;
829 struct ivtv *itv = id->itv;
830 struct yuv_playback_info *yi = &itv->yuv_info;
835 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
843 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
846 r.height = itv->is_out_50hz ? 576 : 480;
860 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
862 itv->main_rect = sel->r;
872 struct ivtv *itv = id->itv;
873 struct yuv_playback_info *yi = &itv->yuv_info;
883 sel->r.height = itv->is_50hz ? 576 : 480;
891 !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
899 sel->r = itv->main_rect;
903 r.height = itv->is_out_50hz ? 576 : 480;
927 struct ivtv *itv = fh2id(fh)->itv;
928 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
954 struct ivtv *itv = fh2id(fh)->itv;
955 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
970 struct ivtv *itv = fh2id(fh)->itv;
972 *i = itv->active_input;
979 struct ivtv *itv = fh2id(fh)->itv;
983 if (inp >= itv->nof_inputs)
986 if (inp == itv->active_input) {
991 if (atomic_read(&itv->capturing) > 0) {
996 itv->active_input, inp);
998 itv->active_input = inp;
1001 itv->audio_input = itv->card->video_inputs[inp].audio_index;
1003 if (itv->card->video_inputs[inp].video_type == IVTV_CARD_INPUT_VID_TUNER)
1004 std = itv->tuner_std;
1008 itv->streams[i].vdev.tvnorms = std;
1012 ivtv_mute(itv);
1013 ivtv_video_set_io(itv);
1014 ivtv_audio_set_io(itv);
1015 ivtv_unmute(itv);
1022 struct ivtv *itv = fh2id(fh)->itv;
1024 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1027 *i = itv->active_output;
1034 struct ivtv *itv = fh2id(fh)->itv;
1036 if (outp >= itv->card->nof_outputs)
1039 if (outp == itv->active_output) {
1044 itv->active_output, outp);
1046 itv->active_output = outp;
1047 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing,
1049 itv->card->video_outputs[outp].video_output, 0);
1056 struct ivtv *itv = fh2id(fh)->itv;
1057 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1064 ivtv_call_all(itv, tuner, g_frequency, vf);
1070 struct ivtv *itv = fh2id(fh)->itv;
1071 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1078 ivtv_mute(itv);
1080 ivtv_call_all(itv, tuner, s_frequency, vf);
1081 ivtv_unmute(itv);
1087 struct ivtv *itv = fh2id(fh)->itv;
1089 *std = itv->std;
1093 void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std)
1095 itv->std = std;
1096 itv->is_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
1097 itv->is_50hz = !itv->is_60hz;
1098 cx2341x_handler_set_50hz(&itv->cxhdl, itv->is_50hz);
1099 itv->cxhdl.width = 720;
1100 itv->cxhdl.height = itv->is_50hz ? 576 : 480;
1101 itv->vbi.count = itv->is_50hz ? 18 : 12;
1102 itv->vbi.start[0] = itv->is_50hz ? 6 : 10;
1103 itv->vbi.start[1] = itv->is_50hz ? 318 : 273;
1105 if (itv->hw_flags & IVTV_HW_CX25840)
1106 itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284;
1109 ivtv_call_all(itv, video, s_std, itv->std);
1112 void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std)
1114 struct yuv_playback_info *yi = &itv->yuv_info;
1119 itv->std_out = std;
1120 itv->is_out_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
1121 itv->is_out_50hz = !itv->is_out_60hz;
1122 ivtv_call_all(itv, video, s_std_output, itv->std_out);
1130 mutex_unlock(&itv->serialize_lock);
1132 prepare_to_wait(&itv->vsync_waitq, &wait,
1138 finish_wait(&itv->vsync_waitq, &wait);
1139 mutex_lock(&itv->serialize_lock);
1144 ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz);
1145 itv->main_rect.left = 0;
1146 itv->main_rect.top = 0;
1147 itv->main_rect.width = 720;
1148 itv->main_rect.height = itv->is_out_50hz ? 576 : 480;
1149 ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
1150 720, itv->main_rect.height, 0, 0);
1151 yi->main_rect = itv->main_rect;
1152 if (!itv->osd_info) {
1154 yi->osd_full_h = itv->is_out_50hz ? 576 : 480;
1160 struct ivtv *itv = fh2id(fh)->itv;
1165 if (std == itv->std)
1168 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ||
1169 atomic_read(&itv->capturing) > 0 ||
1170 atomic_read(&itv->decoding) > 0) {
1177 (unsigned long long)itv->std);
1179 ivtv_s_std_enc(itv, std);
1180 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
1181 ivtv_s_std_dec(itv, std);
1189 struct ivtv *itv = id->itv;
1194 ivtv_call_all(itv, tuner, s_tuner, vt);
1201 struct ivtv *itv = fh2id(fh)->itv;
1206 ivtv_call_all(itv, tuner, g_tuner, vt);
1217 struct ivtv *itv = fh2id(fh)->itv;
1218 int set = itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525;
1224 if (valid_service_line(f, l, itv->is_50hz))
1229 if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
1231 if (itv->is_60hz) {
1252 struct ivtv *itv = fh2id(fh)->itv;
1257 entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) %
1263 if (!atomic_read(&itv->capturing))
1266 *e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX];
1272 itv->pgm_info_read_idx = (itv->pgm_info_read_idx + idx->entries) % IVTV_MAX_PGM_INDEX;
1279 struct ivtv *itv = id->itv;
1298 if (!atomic_read(&itv->capturing))
1300 if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
1303 ivtv_mute(itv);
1304 ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 0);
1311 if (!atomic_read(&itv->capturing))
1314 if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
1317 ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1);
1318 ivtv_unmute(itv);
1330 struct ivtv *itv = fh2id(fh)->itv;
1360 struct ivtv *itv = fh2id(fh)->itv;
1361 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1363 struct yuv_playback_info *yi = &itv->yuv_info;
1387 if (!itv->osd_video_pbase)
1393 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);
1398 fb->fmt.width = itv->osd_rect.width;
1399 fb->fmt.height = itv->osd_rect.height;
1410 fb->base = (void *)itv->osd_video_pbase;
1413 if (itv->osd_chroma_key_state)
1416 if (itv->osd_global_alpha_state)
1434 if (itv->osd_local_alpha_state) {
1448 struct ivtv *itv = id->itv;
1449 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1450 struct yuv_playback_info *yi = &itv->yuv_info;
1454 if (!itv->osd_video_pbase)
1457 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1458 itv->osd_local_alpha_state =
1460 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1461 ivtv_set_osd_alpha(itv);
1469 struct ivtv *itv = id->itv;
1470 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1474 if (!itv->osd_video_pbase)
1477 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0);
1495 struct ivtv *itv = fh2id(fh)->itv;
1498 int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT;
1503 IVTV_INFO("Version: %s Card: %s\n", IVTV_VERSION, itv->card_name);
1504 if (itv->hw_flags & IVTV_HW_TVEEPROM) {
1507 ivtv_read_eeprom(itv, &tv);
1509 ivtv_call_all(itv, core, log_status);
1510 ivtv_get_input(itv, itv->active_input, &vidin);
1511 ivtv_get_audio_input(itv, itv->audio_input, &audin);
1514 itv->dualwatch_stereo_mode == V4L2_MPEG_AUDIO_MODE_DUAL ?
1519 int mode = itv->output_mode;
1552 ivtv_get_output(itv, itv->active_output, &vidout);
1553 ivtv_get_audio_output(itv, 0, &audout);
1558 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);
1566 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV");
1567 v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name);
1568 IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags);
1570 struct ivtv_stream *s = &itv->streams[i];
1580 (long long)itv->mpg_data_received,
1581 (long long)itv->vbi_data_inserted);
1588 struct ivtv *itv = id->itv;
1591 return ivtv_video_command(itv, id, dec, false);
1597 struct ivtv *itv = id->itv;
1600 return ivtv_video_command(itv, id, dec, true);
1606 struct ivtv *itv = id->itv;
1607 struct ivtv_stream *s = &itv->streams[id->type];
1614 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1618 if (itv->output_mode == OUT_UDMA_YUV && args->y_source == NULL)
1623 if (ivtv_set_output_mode(itv, OUT_UDMA_YUV) != OUT_UDMA_YUV) {
1631 return ivtv_yuv_prep_frame(itv, args);
1636 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
1638 return ivtv_passthrough_mode(itv, *(int *)arg != 0);
1648 struct ivtv *itv = fh2id(fh)->itv;
1661 if ((val == 0 && itv->options.newi2c) || (val & 0x01))
1662 ivtv_reset_ir_gpio(itv);
1664 v4l2_subdev_call(itv->sd_video, core, reset, 0);