Lines Matching defs:itv
313 void ivtv_clear_irq_mask(struct ivtv *itv, u32 mask)
315 itv->irqmask &= ~mask;
316 write_reg_sync(itv->irqmask, IVTV_REG_IRQMASK);
319 void ivtv_set_irq_mask(struct ivtv *itv, u32 mask)
321 itv->irqmask |= mask;
322 write_reg_sync(itv->irqmask, IVTV_REG_IRQMASK);
325 int ivtv_set_output_mode(struct ivtv *itv, int mode)
329 spin_lock(&itv->lock);
330 old_mode = itv->output_mode;
332 itv->output_mode = old_mode = mode;
333 spin_unlock(&itv->lock);
337 struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv)
339 switch (itv->output_mode) {
341 return &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
343 return &itv->streams[IVTV_DEC_STREAM_TYPE_YUV];
378 static void ivtv_iounmap(struct ivtv *itv)
380 if (itv == NULL)
384 if (itv->reg_mem != NULL) {
386 iounmap(itv->reg_mem);
387 itv->reg_mem = NULL;
390 if (itv->has_cx23415 && itv->dec_mem != NULL) {
392 iounmap(itv->dec_mem);
394 itv->dec_mem = NULL;
397 if (itv->enc_mem != NULL) {
399 iounmap(itv->enc_mem);
400 itv->enc_mem = NULL;
405 void ivtv_read_eeprom(struct ivtv *itv, struct tveeprom *tv)
409 itv->i2c_client.addr = 0xA0 >> 1;
410 tveeprom_read(&itv->i2c_client, eedata, sizeof(eedata));
414 static void ivtv_process_eeprom(struct ivtv *itv)
417 int pci_slot = PCI_SLOT(itv->pdev->devfn);
419 ivtv_read_eeprom(itv, &tv);
431 itv->card = ivtv_get_card(IVTV_CARD_PVR_250);
435 itv->card = ivtv_get_card(IVTV_CARD_PVR_350);
440 itv->card = ivtv_get_card(IVTV_CARD_PVR_150);
447 itv->card = ivtv_get_card(IVTV_CARD_PVR_150);
455 itv->card = ivtv_get_card(IVTV_CARD_PVR_350_V1);
461 itv->v4l2_cap = itv->card->v4l2_capabilities;
462 itv->card_name = itv->card->name;
463 itv->card_i2c = itv->card->i2c;
487 itv->card_name = "WinTV PVR 500";
488 itv->card_i2c = &ivtv_i2c_radio;
492 itv->card_name = is_first ? "WinTV PVR 500 (unit #1)" :
500 IVTV_INFO("Autodetected %s\n", itv->card_name);
506 itv->pvr150_workaround = 1;
514 if (itv->options.tuner == -1)
515 itv->options.tuner = tv.tuner_type;
516 if (itv->options.radio == -1)
517 itv->options.radio = (tv.has_radio != 0);
519 if (itv->options.newi2c == -1 && tv.has_ir) {
520 itv->options.newi2c = (tv.has_ir & 4) ? 1 : 0;
521 if (itv->options.newi2c) {
523 exit_ivtv_i2c(itv);
524 init_ivtv_i2c(itv);
528 if (itv->std != 0)
535 itv->std |= V4L2_STD_PAL_BG | V4L2_STD_PAL_H;
538 itv->std |= V4L2_STD_NTSC_M;
541 itv->std |= V4L2_STD_SECAM_L;
544 itv->std |= V4L2_STD_NTSC_M;
548 static v4l2_std_id ivtv_parse_std(struct ivtv *itv)
641 static void ivtv_process_options(struct ivtv *itv)
646 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_MPG] = enc_mpg_buffers * 1024;
647 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_YUV] = enc_yuv_buffers * 1024;
648 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_VBI] = enc_vbi_buffers * 1024;
649 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_PCM] = enc_pcm_buffers;
650 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_MPG] = dec_mpg_buffers * 1024;
651 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_YUV] = dec_yuv_buffers * 1024;
652 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_VBI] = dec_vbi_buffers;
653 itv->options.cardtype = cardtype[itv->instance];
654 itv->options.tuner = tuner[itv->instance];
655 itv->options.radio = radio[itv->instance];
657 itv->options.i2c_clock_period = i2c_clock_period[itv->instance];
658 if (itv->options.i2c_clock_period == -1)
659 itv->options.i2c_clock_period = IVTV_DEFAULT_I2C_CLOCK_PERIOD;
660 else if (itv->options.i2c_clock_period < 10)
661 itv->options.i2c_clock_period = 10;
662 else if (itv->options.i2c_clock_period > 4500)
663 itv->options.i2c_clock_period = 4500;
665 itv->options.newi2c = newi2c;
670 itv->std = ivtv_parse_std(itv);
671 if (itv->std == 0 && tunertype >= 0)
672 itv->std = tunertype ? V4L2_STD_MN : (V4L2_STD_ALL & ~V4L2_STD_MN);
673 itv->has_cx23415 = (itv->pdev->device == PCI_DEVICE_ID_IVTV15);
674 chipname = itv->has_cx23415 ? "cx23415" : "cx23416";
675 if (itv->options.cardtype == -1) {
679 if ((itv->card = ivtv_get_card(itv->options.cardtype - 1))) {
681 itv->card->name, chipname);
682 } else if (itv->options.cardtype != 0) {
685 if (itv->card == NULL) {
686 if (itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE ||
687 itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT1 ||
688 itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT2) {
689 itv->card = ivtv_get_card(itv->has_cx23415 ? IVTV_CARD_PVR_350 : IVTV_CARD_PVR_150);
694 if (itv->card == NULL) {
695 for (i = 0; (itv->card = ivtv_get_card(i)); i++) {
696 if (itv->card->pci_list == NULL)
698 for (j = 0; itv->card->pci_list[j].device; j++) {
699 if (itv->pdev->device !=
700 itv->card->pci_list[j].device)
702 if (itv->pdev->subsystem_vendor !=
703 itv->card->pci_list[j].subsystem_vendor)
705 if (itv->pdev->subsystem_device !=
706 itv->card->pci_list[j].subsystem_device)
709 itv->card->name, chipname);
716 if (itv->card == NULL) {
717 itv->card = ivtv_get_card(IVTV_CARD_PVR_150);
719 itv->pdev->vendor, itv->pdev->device);
721 itv->pdev->subsystem_vendor, itv->pdev->subsystem_device);
723 IVTV_ERR("Defaulting to %s card\n", itv->card->name);
728 itv->v4l2_cap = itv->card->v4l2_capabilities;
729 itv->card_name = itv->card->name;
730 itv->card_i2c = itv->card->i2c;
738 static int ivtv_init_struct1(struct ivtv *itv)
740 itv->base_addr = pci_resource_start(itv->pdev, 0);
741 itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */
742 itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */
744 mutex_init(&itv->serialize_lock);
745 mutex_init(&itv->i2c_bus_lock);
746 mutex_init(&itv->udma.lock);
748 spin_lock_init(&itv->lock);
749 spin_lock_init(&itv->dma_reg_lock);
751 kthread_init_worker(&itv->irq_worker);
752 itv->irq_worker_task = kthread_run(kthread_worker_fn, &itv->irq_worker,
753 "%s", itv->v4l2_dev.name);
754 if (IS_ERR(itv->irq_worker_task)) {
759 sched_set_fifo(itv->irq_worker_task);
761 kthread_init_work(&itv->irq_work, ivtv_irq_work_handler);
764 itv->cxhdl.port = CX2341X_PORT_MEMORY;
765 itv->cxhdl.capabilities = CX2341X_CAP_HAS_SLICED_VBI;
766 init_waitqueue_head(&itv->eos_waitq);
767 init_waitqueue_head(&itv->event_waitq);
768 init_waitqueue_head(&itv->vsync_waitq);
769 init_waitqueue_head(&itv->dma_waitq);
770 timer_setup(&itv->dma_timer, ivtv_unfinished_dma, 0);
772 itv->cur_dma_stream = -1;
773 itv->cur_pio_stream = -1;
776 itv->speed = 1000;
779 itv->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE;
780 itv->vbi.sliced_in = &itv->vbi.in.fmt.sliced;
783 sg_init_table(itv->udma.SGlist, IVTV_DMA_SG_OSD_ENT);
786 itv->osd_global_alpha_state = 1;
787 itv->osd_global_alpha = 255;
790 atomic_set(&itv->yuv_info.next_dma_frame, -1);
791 itv->yuv_info.lace_mode = ivtv_yuv_mode;
792 itv->yuv_info.lace_threshold = ivtv_yuv_threshold;
793 itv->yuv_info.max_frames_buffered = 3;
794 itv->yuv_info.track_osd = 1;
800 static void ivtv_init_struct2(struct ivtv *itv)
805 if (itv->card->video_inputs[i].video_type == 0)
807 itv->nof_inputs = i;
809 if (itv->card->audio_inputs[i].audio_type == 0)
811 itv->nof_audio_inputs = i;
813 if (itv->card->hw_all & IVTV_HW_CX25840) {
814 itv->vbi.sliced_size = 288; /* multiple of 16, real size = 284 */
816 itv->vbi.sliced_size = 64; /* multiple of 16, real size = 52 */
820 for (i = 0; i < itv->nof_inputs; i++) {
821 if (itv->card->video_inputs[i].video_type ==
825 if (i >= itv->nof_inputs)
827 itv->active_input = i;
828 itv->audio_input = itv->card->video_inputs[i].audio_index;
831 static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev,
847 if (!request_mem_region(itv->base_addr, IVTV_ENCODER_SIZE, "ivtv encoder")) {
852 if (!request_mem_region(itv->base_addr + IVTV_REG_OFFSET,
855 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
859 if (itv->has_cx23415 &&
860 !request_mem_region(itv->base_addr + IVTV_DECODER_OFFSET,
863 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
864 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
898 pdev->irq, pci_latency, (u64)itv->base_addr);
903 static void ivtv_load_and_init_modules(struct ivtv *itv)
905 u32 hw = itv->card->hw_all;
916 itv->hw_flags |= device;
919 if (ivtv_i2c_register(itv, i) == 0)
920 itv->hw_flags |= device;
924 if ((itv->hw_flags & IVTV_HW_IR_ANY) == 0)
925 ivtv_i2c_new_ir_legacy(itv);
927 if (itv->card->hw_all & IVTV_HW_CX25840)
928 itv->sd_video = ivtv_find_hw(itv, IVTV_HW_CX25840);
929 else if (itv->card->hw_all & IVTV_HW_SAA717X)
930 itv->sd_video = ivtv_find_hw(itv, IVTV_HW_SAA717X);
931 else if (itv->card->hw_all & IVTV_HW_SAA7114)
932 itv->sd_video = ivtv_find_hw(itv, IVTV_HW_SAA7114);
934 itv->sd_video = ivtv_find_hw(itv, IVTV_HW_SAA7115);
935 itv->sd_audio = ivtv_find_hw(itv, itv->card->hw_audio_ctrl);
936 itv->sd_muxer = ivtv_find_hw(itv, itv->card->hw_muxer);
938 hw = itv->hw_flags;
940 if (itv->card->type == IVTV_CARD_CX23416GYC) {
944 itv->card = ivtv_get_card(IVTV_CARD_CX23416GYC_NOGRYCS);
946 itv->card = ivtv_get_card(IVTV_CARD_CX23416GYC_NOGR);
948 else if (itv->card->type == IVTV_CARD_GV_MVPRX ||
949 itv->card->type == IVTV_CARD_GV_MVPRX2E) {
951 v4l2_subdev_call(itv->sd_video, video, s_crystal_freq,
956 itv->vbi.raw_decoder_line_size = 1444;
957 itv->vbi.raw_decoder_sav_odd_field = 0x20;
958 itv->vbi.raw_decoder_sav_even_field = 0x60;
959 itv->vbi.sliced_decoder_line_size = 272;
960 itv->vbi.sliced_decoder_sav_odd_field = 0xB0;
961 itv->vbi.sliced_decoder_sav_even_field = 0xF0;
966 itv->hw_flags &= ~IVTV_HW_SAA711X;
968 if (strstr(itv->sd_video->name, "saa7114")) {
969 itv->hw_flags |= IVTV_HW_SAA7114;
971 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE);
973 itv->hw_flags |= IVTV_HW_SAA7115;
975 itv->vbi.raw_decoder_line_size = 1443;
976 itv->vbi.raw_decoder_sav_odd_field = 0x25;
977 itv->vbi.raw_decoder_sav_even_field = 0x62;
978 itv->vbi.sliced_decoder_line_size = 51;
979 itv->vbi.sliced_decoder_sav_odd_field = 0xAB;
980 itv->vbi.sliced_decoder_sav_even_field = 0xEC;
984 itv->vbi.raw_decoder_line_size = 1443;
985 itv->vbi.raw_decoder_sav_odd_field = 0x25;
986 itv->vbi.raw_decoder_sav_even_field = 0x62;
987 itv->vbi.sliced_decoder_line_size = 51;
988 itv->vbi.sliced_decoder_sav_odd_field = 0xAB;
989 itv->vbi.sliced_decoder_sav_even_field = 0xEC;
997 struct ivtv *itv;
999 itv = kzalloc(sizeof(struct ivtv), GFP_KERNEL);
1000 if (itv == NULL)
1002 itv->pdev = pdev;
1003 itv->instance = v4l2_device_set_name(&itv->v4l2_dev, "ivtv",
1006 retval = v4l2_device_register(&pdev->dev, &itv->v4l2_dev);
1008 kfree(itv);
1011 IVTV_INFO("Initializing card %d\n", itv->instance);
1013 ivtv_process_options(itv);
1014 if (itv->options.cardtype == -1) {
1018 if (ivtv_init_struct1(itv)) {
1022 retval = cx2341x_handler_init(&itv->cxhdl, 50);
1025 itv->v4l2_dev.ctrl_handler = &itv->cxhdl.hdl;
1026 itv->cxhdl.ops = &ivtv_cxhdl_ops;
1027 itv->cxhdl.priv = itv;
1028 itv->cxhdl.func = ivtv_api_func;
1030 IVTV_DEBUG_INFO("base addr: 0x%llx\n", (u64)itv->base_addr);
1033 retval = ivtv_setup_pci(itv, pdev, pci_id);
1041 (u64)itv->base_addr + IVTV_ENCODER_OFFSET, IVTV_ENCODER_SIZE);
1042 itv->enc_mem = ioremap(itv->base_addr + IVTV_ENCODER_OFFSET,
1044 if (!itv->enc_mem) {
1053 if (itv->has_cx23415) {
1055 (u64)itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1056 itv->dec_mem = ioremap(itv->base_addr + IVTV_DECODER_OFFSET,
1058 if (!itv->dec_mem) {
1068 itv->dec_mem = itv->enc_mem;
1073 (u64)itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1074 itv->reg_mem =
1075 ioremap(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1076 if (!itv->reg_mem) {
1085 retval = ivtv_gpio_init(itv);
1091 if (init_ivtv_i2c(itv)) {
1096 if (itv->card->hw_all & IVTV_HW_TVEEPROM) {
1099 ivtv_process_eeprom(itv);
1101 if (itv->card->comment)
1102 IVTV_INFO("%s", itv->card->comment);
1103 if (itv->card->v4l2_capabilities == 0) {
1109 if (itv->std == 0) {
1110 itv->std = V4L2_STD_NTSC_M;
1113 if (itv->options.tuner == -1) {
1117 if ((itv->std & itv->card->tuners[i].std) == 0)
1119 itv->options.tuner = itv->card->tuners[i].tuner;
1124 if (itv->options.tuner == -1 && itv->card->tuners[0].std) {
1125 itv->std = itv->card->tuners[0].std;
1126 if (itv->std & V4L2_STD_PAL)
1127 itv->std = V4L2_STD_PAL_BG | V4L2_STD_PAL_H;
1128 else if (itv->std & V4L2_STD_NTSC)
1129 itv->std = V4L2_STD_NTSC_M;
1130 else if (itv->std & V4L2_STD_SECAM)
1131 itv->std = V4L2_STD_SECAM_L;
1132 itv->options.tuner = itv->card->tuners[0].tuner;
1134 if (itv->options.radio == -1)
1135 itv->options.radio = (itv->card->radio_input.audio_type != 0);
1139 ivtv_init_struct2(itv);
1141 ivtv_load_and_init_modules(itv);
1143 if (itv->std & V4L2_STD_525_60) {
1144 itv->is_60hz = 1;
1145 itv->is_out_60hz = 1;
1147 itv->is_50hz = 1;
1148 itv->is_out_50hz = 1;
1151 itv->yuv_info.osd_full_w = 720;
1152 itv->yuv_info.osd_full_h = itv->is_out_50hz ? 576 : 480;
1153 itv->yuv_info.v4l2_src_w = itv->yuv_info.osd_full_w;
1154 itv->yuv_info.v4l2_src_h = itv->yuv_info.osd_full_h;
1156 cx2341x_handler_set_50hz(&itv->cxhdl, itv->is_50hz);
1158 itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_MPG] = 0x08000;
1159 itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_PCM] = 0x01200;
1160 itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_MPG] = 0x10000;
1161 itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_YUV] = 0x10000;
1162 itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_YUV] = 0x08000;
1168 itv->vbi.raw_size = 1456;
1175 vbi_buf_size = itv->vbi.raw_size * (itv->is_60hz ? 24 : 36) / 2;
1176 itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_VBI] = vbi_buf_size;
1177 itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_VBI] = sizeof(struct v4l2_sliced_vbi_data) * 36;
1179 if (itv->options.radio > 0)
1180 itv->v4l2_cap |= V4L2_CAP_RADIO;
1182 if (itv->options.tuner > -1) {
1186 setup.type = itv->options.tuner;
1188 if (itv->options.radio > 0)
1192 ivtv_call_all(itv, tuner, s_type_addr, &setup);
1199 .tuner = itv->options.tuner,
1202 ivtv_call_all(itv, tuner, s_config, &cfg);
1208 itv->tuner_std = itv->std;
1210 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
1211 struct v4l2_ctrl_handler *hdl = itv->v4l2_dev.ctrl_handler;
1213 itv->ctrl_pts = v4l2_ctrl_new_std(hdl, &ivtv_hdl_out_ops,
1215 itv->ctrl_frame = v4l2_ctrl_new_std(hdl, &ivtv_hdl_out_ops,
1219 itv->ctrl_audio_playback =
1225 itv->ctrl_audio_multilingual_playback =
1235 v4l2_ctrl_cluster(2, &itv->ctrl_pts);
1236 v4l2_ctrl_cluster(2, &itv->ctrl_audio_playback);
1237 ivtv_call_all(itv, video, s_std_output, itv->std);
1241 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_stream, 0);
1245 ivtv_set_irq_mask(itv, 0xffffffff);
1248 retval = request_irq(itv->pdev->irq, ivtv_irq_handler,
1249 IRQF_SHARED, itv->v4l2_dev.name, (void *)itv);
1255 retval = ivtv_streams_setup(itv);
1260 retval = ivtv_streams_register(itv);
1265 IVTV_INFO("Initialized card: %s\n", itv->card_name);
1268 request_modules(itv);
1272 ivtv_streams_cleanup(itv);
1274 free_irq(itv->pdev->irq, (void *)itv);
1276 v4l2_ctrl_handler_free(&itv->cxhdl.hdl);
1277 exit_ivtv_i2c(itv);
1279 ivtv_iounmap(itv);
1281 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
1282 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1283 if (itv->has_cx23415)
1284 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1286 kthread_stop(itv->irq_worker_task);
1292 v4l2_device_unregister(&itv->v4l2_dev);
1293 kfree(itv);
1297 int ivtv_init_on_first_open(struct ivtv *itv)
1305 fh.itv = itv;
1308 if (test_bit(IVTV_F_I_FAILED, &itv->i_flags))
1311 if (test_and_set_bit(IVTV_F_I_INITED, &itv->i_flags))
1316 if (ivtv_firmware_init(itv) == 0)
1323 set_bit(IVTV_F_I_FAILED, &itv->i_flags);
1329 ivtv_firmware_versions(itv);
1331 if (itv->card->hw_all & IVTV_HW_CX25840)
1332 v4l2_subdev_call(itv->sd_video, core, load_fw);
1340 if (itv->std == V4L2_STD_NTSC_M_JP) {
1343 else if (itv->std & V4L2_STD_NTSC_M) {
1347 video_input = itv->active_input;
1348 itv->active_input++; /* Force update of input */
1353 itv->std++; /* Force full standard initialization */
1354 itv->std_out = itv->std;
1357 if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
1361 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_stream, 1);
1362 ivtv_init_mpeg_decoder(itv);
1366 if (!itv->has_cx23415)
1369 ivtv_s_std_enc(itv, itv->tuner_std);
1376 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
1377 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
1378 ivtv_set_osd_alpha(itv);
1379 ivtv_s_std_dec(itv, itv->tuner_std);
1381 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
1385 cx2341x_handler_setup(&itv->cxhdl);
1392 struct ivtv *itv = to_ivtv(v4l2_dev);
1397 flush_request_modules(itv);
1399 if (test_bit(IVTV_F_I_INITED, &itv->i_flags)) {
1402 if (atomic_read(&itv->capturing) > 0)
1403 ivtv_stop_all_captures(itv);
1409 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
1410 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_stream, 0);
1411 if (atomic_read(&itv->decoding) > 0) {
1414 if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags))
1418 ivtv_stop_v4l2_decode_stream(&itv->streams[type],
1421 ivtv_halt_firmware(itv);
1425 ivtv_set_irq_mask(itv, 0xffffffff);
1426 del_timer_sync(&itv->dma_timer);
1429 kthread_flush_worker(&itv->irq_worker);
1430 kthread_stop(itv->irq_worker_task);
1432 ivtv_streams_cleanup(itv);
1433 ivtv_udma_free(itv);
1435 v4l2_ctrl_handler_free(&itv->cxhdl.hdl);
1437 exit_ivtv_i2c(itv);
1439 free_irq(itv->pdev->irq, (void *)itv);
1440 ivtv_iounmap(itv);
1442 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
1443 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1444 if (itv->has_cx23415)
1445 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1447 pci_disable_device(itv->pdev);
1449 kfree(itv->vbi.sliced_mpeg_data[i]);
1451 pr_info("Removed %s\n", itv->card_name);
1453 v4l2_device_unregister(&itv->v4l2_dev);
1454 kfree(itv);