aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h1
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c29
-rw-r--r--drivers/media/video/ivtv/ivtv-queue.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-vbi.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-version.h2
7 files changed, 16 insertions, 26 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index aea1664948ce..4afc7ea07e86 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -688,7 +688,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
688 spin_lock_init(&itv->lock); 688 spin_lock_init(&itv->lock);
689 spin_lock_init(&itv->dma_reg_lock); 689 spin_lock_init(&itv->dma_reg_lock);
690 690
691 itv->irq_work_queues = create_workqueue(itv->name); 691 itv->irq_work_queues = create_singlethread_workqueue(itv->name);
692 if (itv->irq_work_queues == NULL) { 692 if (itv->irq_work_queues == NULL) {
693 IVTV_ERR("Could not create ivtv workqueue\n"); 693 IVTV_ERR("Could not create ivtv workqueue\n");
694 return -1; 694 return -1;
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index ab287b48fc2b..2ceb5227637c 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -251,6 +251,7 @@ struct ivtv_mailbox_data {
251#define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ 251#define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */
252#define IVTV_F_I_INITED 21 /* set after first open */ 252#define IVTV_F_I_INITED 21 /* set after first open */
253#define IVTV_F_I_FAILED 22 /* set if first open failed */ 253#define IVTV_F_I_FAILED 22 /* set if first open failed */
254#define IVTV_F_I_WORK_INITED 23 /* worker thread was initialized */
254 255
255/* Event notifications */ 256/* Event notifications */
256#define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ 257#define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index fba150a6cd23..34f3ab827858 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -76,6 +76,13 @@ void ivtv_irq_work_handler(struct work_struct *work)
76 76
77 DEFINE_WAIT(wait); 77 DEFINE_WAIT(wait);
78 78
79 if (test_and_clear_bit(IVTV_F_I_WORK_INITED, &itv->i_flags)) {
80 struct sched_param param = { .sched_priority = 99 };
81
82 /* This thread must use the FIFO scheduler as it
83 is realtime sensitive. */
84 sched_setscheduler(current, SCHED_FIFO, &param);
85 }
79 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) 86 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags))
80 ivtv_pio_work_handler(itv); 87 ivtv_pio_work_handler(itv);
81 88
@@ -678,34 +685,14 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv)
678 685
679static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) 686static void ivtv_irq_enc_vbi_cap(struct ivtv *itv)
680{ 687{
681 struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG];
682 u32 data[CX2341X_MBOX_MAX_DATA]; 688 u32 data[CX2341X_MBOX_MAX_DATA];
683 struct ivtv_stream *s; 689 struct ivtv_stream *s;
684 690
685 IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n"); 691 IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n");
686 s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; 692 s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
687 693
688 /* If more than two VBI buffers are pending, then 694 if (!stream_enc_dma_append(s, data))
689 clear the old ones and start with this new one.
690 This can happen during transition stages when MPEG capturing is
691 started, but the first interrupts haven't arrived yet. During
692 that period VBI requests can accumulate without being able to
693 DMA the data. Since at most four VBI DMA buffers are available,
694 we just drop the old requests when there are already three
695 requests queued. */
696 if (s->sg_pending_size > 2) {
697 struct ivtv_buffer *buf;
698 list_for_each_entry(buf, &s->q_predma.list, list)
699 ivtv_buf_sync_for_cpu(s, buf);
700 ivtv_queue_move(s, &s->q_predma, NULL, &s->q_free, 0);
701 s->sg_pending_size = 0;
702 }
703 /* if we can append the data, and the MPEG stream isn't capturing,
704 then start a DMA request for just the VBI data. */
705 if (!stream_enc_dma_append(s, data) &&
706 !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) {
707 set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); 695 set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags);
708 }
709} 696}
710 697
711static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) 698static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv)
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h
index 7cfc0c9ab050..476556afd39a 100644
--- a/drivers/media/video/ivtv/ivtv-queue.h
+++ b/drivers/media/video/ivtv/ivtv-queue.h
@@ -23,7 +23,7 @@
23#define IVTV_QUEUE_H 23#define IVTV_QUEUE_H
24 24
25#define IVTV_DMA_UNMAPPED ((u32) -1) 25#define IVTV_DMA_UNMAPPED ((u32) -1)
26#define SLICED_VBI_PIO 1 26#define SLICED_VBI_PIO 0
27 27
28/* ivtv_buffer utility functions */ 28/* ivtv_buffer utility functions */
29 29
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 54d2023b26c4..730e85d86fc8 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -363,7 +363,7 @@ static void ivtv_vbi_setup(struct ivtv *itv)
363 /* Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) */ 363 /* Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) */
364 data[1] = 1; 364 data[1] = 1;
365 /* The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) */ 365 /* The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) */
366 data[2] = raw ? 4 : 8; 366 data[2] = raw ? 4 : 4 * (itv->vbi.raw_size / itv->vbi.enc_size);
367 /* The start/stop codes determine which VBI lines end up in the raw VBI data area. 367 /* The start/stop codes determine which VBI lines end up in the raw VBI data area.
368 The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line 368 The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line
369 is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video) 369 is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video)
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c
index 71798f0da27f..1ce9deb1104f 100644
--- a/drivers/media/video/ivtv/ivtv-vbi.c
+++ b/drivers/media/video/ivtv/ivtv-vbi.c
@@ -293,6 +293,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8
293 u32 line_size = itv->vbi.sliced_decoder_line_size; 293 u32 line_size = itv->vbi.sliced_decoder_line_size;
294 struct v4l2_decode_vbi_line vbi; 294 struct v4l2_decode_vbi_line vbi;
295 int i; 295 int i;
296 unsigned lines = 0;
296 297
297 /* find the first valid line */ 298 /* find the first valid line */
298 for (i = 0; i < size; i++, buf++) { 299 for (i = 0; i < size; i++, buf++) {
@@ -313,7 +314,8 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8
313 } 314 }
314 vbi.p = p + 4; 315 vbi.p = p + 4;
315 itv->video_dec_func(itv, VIDIOC_INT_DECODE_VBI_LINE, &vbi); 316 itv->video_dec_func(itv, VIDIOC_INT_DECODE_VBI_LINE, &vbi);
316 if (vbi.type) { 317 if (vbi.type && !(lines & (1 << vbi.line))) {
318 lines |= 1 << vbi.line;
317 itv->vbi.sliced_data[line].id = vbi.type; 319 itv->vbi.sliced_data[line].id = vbi.type;
318 itv->vbi.sliced_data[line].field = vbi.is_second_field; 320 itv->vbi.sliced_data[line].field = vbi.is_second_field;
319 itv->vbi.sliced_data[line].line = vbi.line; 321 itv->vbi.sliced_data[line].line = vbi.line;
diff --git a/drivers/media/video/ivtv/ivtv-version.h b/drivers/media/video/ivtv/ivtv-version.h
index 442f43f11b73..8cd753d30bf7 100644
--- a/drivers/media/video/ivtv/ivtv-version.h
+++ b/drivers/media/video/ivtv/ivtv-version.h
@@ -22,7 +22,7 @@
22 22
23#define IVTV_DRIVER_NAME "ivtv" 23#define IVTV_DRIVER_NAME "ivtv"
24#define IVTV_DRIVER_VERSION_MAJOR 1 24#define IVTV_DRIVER_VERSION_MAJOR 1
25#define IVTV_DRIVER_VERSION_MINOR 3 25#define IVTV_DRIVER_VERSION_MINOR 4
26#define IVTV_DRIVER_VERSION_PATCHLEVEL 0 26#define IVTV_DRIVER_VERSION_PATCHLEVEL 0
27 27
28#define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) 28#define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL)