• Home
  • Raw
  • Download

Lines Matching refs:itv

29 static void ivtv_pcm_work_handler(struct ivtv *itv)  in ivtv_pcm_work_handler()  argument
31 struct ivtv_stream *s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM]; in ivtv_pcm_work_handler()
50 itv->pcm_announce_callback(itv->alsa, in ivtv_pcm_work_handler()
58 static void ivtv_pio_work_handler(struct ivtv *itv) in ivtv_pio_work_handler() argument
60 struct ivtv_stream *s = &itv->streams[itv->cur_pio_stream]; in ivtv_pio_work_handler()
65 if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || in ivtv_pio_work_handler()
67 itv->cur_pio_stream = -1; in ivtv_pio_work_handler()
78 memcpy_fromio(buf->buf, itv->dec_mem + s->sg_processing[i].src - IVTV_DECODER_OFFSET, size); in ivtv_pio_work_handler()
81 memcpy_fromio(buf->buf, itv->enc_mem + s->sg_processing[i].src, size); in ivtv_pio_work_handler()
92 struct ivtv *itv = container_of(work, struct ivtv, irq_work); in ivtv_irq_work_handler() local
94 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) in ivtv_irq_work_handler()
95 ivtv_pio_work_handler(itv); in ivtv_irq_work_handler()
97 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags)) in ivtv_irq_work_handler()
98 ivtv_vbi_work_handler(itv); in ivtv_irq_work_handler()
100 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags)) in ivtv_irq_work_handler()
101 ivtv_yuv_work_handler(itv); in ivtv_irq_work_handler()
103 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PCM, &itv->i_flags)) in ivtv_irq_work_handler()
104 ivtv_pcm_work_handler(itv); in ivtv_irq_work_handler()
113 struct ivtv *itv = s->itv; in stream_enc_dma_append() local
153 if (itv->has_cx23415) in stream_enc_dma_append()
158 size = itv->vbi.enc_size * itv->vbi.fpi; in stream_enc_dma_append()
159 offset = read_enc(itv->vbi.enc_start - 4) + 12; in stream_enc_dma_append()
168 size = read_dec(itv->vbi.dec_start + 4) + 8; in stream_enc_dma_append()
169 offset = read_dec(itv->vbi.dec_start) + itv->vbi.dec_start; in stream_enc_dma_append()
180 if (itv->has_cx23415 && (s->type == IVTV_ENC_STREAM_TYPE_PCM || in stream_enc_dma_append()
248 struct ivtv *itv = s->itv; in dma_post() local
280 if (itv->has_cx23415 && (s->type == IVTV_ENC_STREAM_TYPE_PCM || in dma_post()
305 ivtv_process_vbi_data(itv, buf, 0, s->type); in dma_post()
317 itv->pcm_announce_callback != NULL) { in dma_post()
329 set_bit(IVTV_F_I_WORK_HANDLER_PCM, &itv->i_flags); in dma_post()
330 set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); in dma_post()
339 struct ivtv *itv = s->itv; in ivtv_dma_stream_dec_prepare() local
340 struct yuv_playback_info *yi = &itv->yuv_info; in ivtv_dma_stream_dec_prepare()
400 spin_lock_irqsave(&itv->dma_reg_lock, flags); in ivtv_dma_stream_dec_prepare()
401 if (!test_bit(IVTV_F_I_DMA, &itv->i_flags)) in ivtv_dma_stream_dec_prepare()
405 spin_unlock_irqrestore(&itv->dma_reg_lock, flags); in ivtv_dma_stream_dec_prepare()
407 if (!test_bit(IVTV_F_I_DMA, &itv->i_flags)) in ivtv_dma_stream_dec_prepare()
416 struct ivtv *itv = s->itv; in ivtv_dma_enc_start_xfer() local
426 itv->dma_timer.expires = jiffies + msecs_to_jiffies(300); in ivtv_dma_enc_start_xfer()
427 add_timer(&itv->dma_timer); in ivtv_dma_enc_start_xfer()
432 struct ivtv *itv = s->itv; in ivtv_dma_dec_start_xfer() local
442 itv->dma_timer.expires = jiffies + msecs_to_jiffies(300); in ivtv_dma_dec_start_xfer()
443 add_timer(&itv->dma_timer); in ivtv_dma_dec_start_xfer()
449 struct ivtv *itv = s->itv; in ivtv_dma_enc_start() local
450 struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; in ivtv_dma_enc_start()
495 set_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags); in ivtv_dma_enc_start()
496 set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); in ivtv_dma_enc_start()
497 set_bit(IVTV_F_I_PIO, &itv->i_flags); in ivtv_dma_enc_start()
498 itv->cur_pio_stream = s->type; in ivtv_dma_enc_start()
501 itv->dma_retries = 0; in ivtv_dma_enc_start()
503 set_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_dma_enc_start()
504 itv->cur_dma_stream = s->type; in ivtv_dma_enc_start()
510 struct ivtv *itv = s->itv; in ivtv_dma_dec_start() local
521 itv->dma_retries = 0; in ivtv_dma_dec_start()
523 set_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_dma_dec_start()
524 itv->cur_dma_stream = s->type; in ivtv_dma_dec_start()
527 static void ivtv_irq_dma_read(struct ivtv *itv) in ivtv_irq_dma_read() argument
535 del_timer(&itv->dma_timer); in ivtv_irq_dma_read()
537 if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && itv->cur_dma_stream < 0) in ivtv_irq_dma_read()
540 if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { in ivtv_irq_dma_read()
541 s = &itv->streams[itv->cur_dma_stream]; in ivtv_irq_dma_read()
547 s->sg_processed, s->sg_processing_size, itv->dma_retries); in ivtv_irq_dma_read()
549 if (itv->dma_retries == 3) { in ivtv_irq_dma_read()
551 itv->dma_retries = 0; in ivtv_irq_dma_read()
558 itv->dma_retries++; in ivtv_irq_dma_read()
576 ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, s->q_dma.bytesused, in ivtv_irq_dma_read()
586 clear_bit(IVTV_F_I_UDMA, &itv->i_flags); in ivtv_irq_dma_read()
587 clear_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_irq_dma_read()
588 itv->cur_dma_stream = -1; in ivtv_irq_dma_read()
589 wake_up(&itv->dma_waitq); in ivtv_irq_dma_read()
592 static void ivtv_irq_enc_dma_complete(struct ivtv *itv) in ivtv_irq_enc_dma_complete() argument
597 ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); in ivtv_irq_enc_dma_complete()
598 IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d (%d)\n", data[0], data[1], itv->cur_dma_stream); in ivtv_irq_enc_dma_complete()
600 del_timer(&itv->dma_timer); in ivtv_irq_enc_dma_complete()
602 if (itv->cur_dma_stream < 0) in ivtv_irq_enc_dma_complete()
605 s = &itv->streams[itv->cur_dma_stream]; in ivtv_irq_enc_dma_complete()
610 s->dma_offset, s->sg_processed, s->sg_processing_size, itv->dma_retries); in ivtv_irq_enc_dma_complete()
612 if (itv->dma_retries == 3) { in ivtv_irq_enc_dma_complete()
614 itv->dma_retries = 0; in ivtv_irq_enc_dma_complete()
621 itv->dma_retries++; in ivtv_irq_enc_dma_complete()
629 clear_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_irq_enc_dma_complete()
630 itv->cur_dma_stream = -1; in ivtv_irq_enc_dma_complete()
633 s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; in ivtv_irq_enc_dma_complete()
638 wake_up(&itv->dma_waitq); in ivtv_irq_enc_dma_complete()
641 static void ivtv_irq_enc_pio_complete(struct ivtv *itv) in ivtv_irq_enc_pio_complete() argument
645 if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS) { in ivtv_irq_enc_pio_complete()
646 itv->cur_pio_stream = -1; in ivtv_irq_enc_pio_complete()
649 s = &itv->streams[itv->cur_pio_stream]; in ivtv_irq_enc_pio_complete()
651 clear_bit(IVTV_F_I_PIO, &itv->i_flags); in ivtv_irq_enc_pio_complete()
652 itv->cur_pio_stream = -1; in ivtv_irq_enc_pio_complete()
655 ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 0); in ivtv_irq_enc_pio_complete()
657 ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 1); in ivtv_irq_enc_pio_complete()
659 ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 2); in ivtv_irq_enc_pio_complete()
660 clear_bit(IVTV_F_I_PIO, &itv->i_flags); in ivtv_irq_enc_pio_complete()
662 s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; in ivtv_irq_enc_pio_complete()
665 wake_up(&itv->dma_waitq); in ivtv_irq_enc_pio_complete()
668 static void ivtv_irq_dma_err(struct ivtv *itv) in ivtv_irq_dma_err() argument
673 del_timer(&itv->dma_timer); in ivtv_irq_dma_err()
675 ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); in ivtv_irq_dma_err()
678 status, itv->cur_dma_stream); in ivtv_irq_dma_err()
692 if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && in ivtv_irq_dma_err()
693 itv->cur_dma_stream >= 0 && itv->cur_dma_stream < IVTV_MAX_STREAMS) { in ivtv_irq_dma_err()
694 struct ivtv_stream *s = &itv->streams[itv->cur_dma_stream]; in ivtv_irq_dma_err()
710 itv->dma_timer.expires = in ivtv_irq_dma_err()
712 add_timer(&itv->dma_timer); in ivtv_irq_dma_err()
716 if (itv->dma_retries < 3) { in ivtv_irq_dma_err()
724 itv->dma_retries++; in ivtv_irq_dma_err()
732 if (test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { in ivtv_irq_dma_err()
733 ivtv_udma_start(itv); in ivtv_irq_dma_err()
736 clear_bit(IVTV_F_I_UDMA, &itv->i_flags); in ivtv_irq_dma_err()
737 clear_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_irq_dma_err()
738 itv->cur_dma_stream = -1; in ivtv_irq_dma_err()
739 wake_up(&itv->dma_waitq); in ivtv_irq_dma_err()
742 static void ivtv_irq_enc_start_cap(struct ivtv *itv) in ivtv_irq_enc_start_cap() argument
748 ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, 7, data); in ivtv_irq_enc_start_cap()
756 s = &itv->streams[ivtv_stream_map[data[0]]]; in ivtv_irq_enc_start_cap()
762 static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) in ivtv_irq_enc_vbi_cap() argument
768 s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; in ivtv_irq_enc_vbi_cap()
774 static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) in ivtv_irq_dec_vbi_reinsert() argument
777 struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; in ivtv_irq_dec_vbi_reinsert()
786 static void ivtv_irq_dec_data_req(struct ivtv *itv) in ivtv_irq_dec_data_req() argument
793 if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags)) { in ivtv_irq_dec_data_req()
794 ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 2, data); in ivtv_irq_dec_data_req()
795 itv->dma_data_req_size = in ivtv_irq_dec_data_req()
796 1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31); in ivtv_irq_dec_data_req()
797 itv->dma_data_req_offset = data[1]; in ivtv_irq_dec_data_req()
798 if (atomic_read(&itv->yuv_info.next_dma_frame) >= 0) in ivtv_irq_dec_data_req()
799 ivtv_yuv_frame_complete(itv); in ivtv_irq_dec_data_req()
800 s = &itv->streams[IVTV_DEC_STREAM_TYPE_YUV]; in ivtv_irq_dec_data_req()
803 ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 3, data); in ivtv_irq_dec_data_req()
804 itv->dma_data_req_size = min_t(u32, data[2], 0x10000); in ivtv_irq_dec_data_req()
805 itv->dma_data_req_offset = data[1]; in ivtv_irq_dec_data_req()
806 s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; in ivtv_irq_dec_data_req()
809 itv->dma_data_req_offset, itv->dma_data_req_size); in ivtv_irq_dec_data_req()
810 if (itv->dma_data_req_size == 0 || s->q_full.bytesused < itv->dma_data_req_size) { in ivtv_irq_dec_data_req()
814 if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags)) in ivtv_irq_dec_data_req()
815 ivtv_yuv_setup_stream_frame(itv); in ivtv_irq_dec_data_req()
817 ivtv_queue_move(s, &s->q_full, NULL, &s->q_predma, itv->dma_data_req_size); in ivtv_irq_dec_data_req()
818 ivtv_dma_stream_dec_prepare(s, itv->dma_data_req_offset + IVTV_DECODER_OFFSET, 0); in ivtv_irq_dec_data_req()
822 static void ivtv_irq_vsync(struct ivtv *itv) in ivtv_irq_vsync() argument
832 struct yuv_playback_info *yi = &itv->yuv_info; in ivtv_irq_vsync()
839 ((itv->last_vsync_field & 1) ^ f->sync_field)) || in ivtv_irq_vsync()
840 (frame != (itv->last_vsync_field & 1) && !f->interlaced)) { in ivtv_irq_vsync()
856 if (frame != (itv->last_vsync_field & 1)) { in ivtv_irq_vsync()
865 struct ivtv_stream *s = ivtv_get_output_stream(itv); in ivtv_irq_vsync()
867 itv->last_vsync_field += 1; in ivtv_irq_vsync()
869 clear_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags); in ivtv_irq_vsync()
870 clear_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags); in ivtv_irq_vsync()
873 set_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags); in ivtv_irq_vsync()
875 if (test_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags)) { in ivtv_irq_vsync()
876 set_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags); in ivtv_irq_vsync()
877 wake_up(&itv->event_waitq); in ivtv_irq_vsync()
883 wake_up(&itv->vsync_waitq); in ivtv_irq_vsync()
886 if (frame && (itv->output_mode == OUT_PASSTHROUGH || in ivtv_irq_vsync()
887 test_bit(IVTV_F_I_UPDATE_WSS, &itv->i_flags) || in ivtv_irq_vsync()
888 test_bit(IVTV_F_I_UPDATE_VPS, &itv->i_flags) || in ivtv_irq_vsync()
889 test_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags))) { in ivtv_irq_vsync()
890 set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags); in ivtv_irq_vsync()
891 set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); in ivtv_irq_vsync()
907 set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags); in ivtv_irq_vsync()
908 set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); in ivtv_irq_vsync()
920 struct ivtv *itv = (struct ivtv *)dev_id; in ivtv_irq_handler() local
926 spin_lock(&itv->dma_reg_lock); in ivtv_irq_handler()
930 combo = ~itv->irqmask & stat; in ivtv_irq_handler()
939 if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) { in ivtv_irq_handler()
941 if ((itv->last_vsync_field & 1) != in ivtv_irq_handler()
952 spin_unlock(&itv->dma_reg_lock); in ivtv_irq_handler()
967 ivtv_irq_dma_read(itv); in ivtv_irq_handler()
971 ivtv_irq_enc_dma_complete(itv); in ivtv_irq_handler()
975 ivtv_irq_enc_pio_complete(itv); in ivtv_irq_handler()
979 ivtv_irq_dma_err(itv); in ivtv_irq_handler()
983 ivtv_irq_enc_start_cap(itv); in ivtv_irq_handler()
987 ivtv_irq_enc_vbi_cap(itv); in ivtv_irq_handler()
991 ivtv_irq_dec_vbi_reinsert(itv); in ivtv_irq_handler()
996 set_bit(IVTV_F_I_EOS, &itv->i_flags); in ivtv_irq_handler()
997 wake_up(&itv->eos_waitq); in ivtv_irq_handler()
1001 ivtv_irq_dec_data_req(itv); in ivtv_irq_handler()
1005 if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) { in ivtv_irq_handler()
1006 ivtv_irq_vsync(itv); in ivtv_irq_handler()
1018 if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_DMA, &itv->i_flags)) { in ivtv_irq_handler()
1019 itv->irq_rr_idx++; in ivtv_irq_handler()
1021 int idx = (i + itv->irq_rr_idx) % IVTV_MAX_STREAMS; in ivtv_irq_handler()
1022 struct ivtv_stream *s = &itv->streams[idx]; in ivtv_irq_handler()
1034 test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags)) in ivtv_irq_handler()
1035 ivtv_udma_start(itv); in ivtv_irq_handler()
1038 if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) { in ivtv_irq_handler()
1039 itv->irq_rr_idx++; in ivtv_irq_handler()
1041 int idx = (i + itv->irq_rr_idx) % IVTV_MAX_STREAMS; in ivtv_irq_handler()
1042 struct ivtv_stream *s = &itv->streams[idx]; in ivtv_irq_handler()
1052 if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags)) { in ivtv_irq_handler()
1053 kthread_queue_work(&itv->irq_worker, &itv->irq_work); in ivtv_irq_handler()
1056 spin_unlock(&itv->dma_reg_lock); in ivtv_irq_handler()
1067 struct ivtv *itv = from_timer(itv, t, dma_timer); in ivtv_unfinished_dma() local
1069 if (!test_bit(IVTV_F_I_DMA, &itv->i_flags)) in ivtv_unfinished_dma()
1071 IVTV_ERR("DMA TIMEOUT %08x %d\n", read_reg(IVTV_REG_DMASTATUS), itv->cur_dma_stream); in ivtv_unfinished_dma()
1074 clear_bit(IVTV_F_I_UDMA, &itv->i_flags); in ivtv_unfinished_dma()
1075 clear_bit(IVTV_F_I_DMA, &itv->i_flags); in ivtv_unfinished_dma()
1076 itv->cur_dma_stream = -1; in ivtv_unfinished_dma()
1077 wake_up(&itv->dma_waitq); in ivtv_unfinished_dma()