Commit 9b2e5c6b authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (7245): ivtv: start timer for each DMA transfer

The DMA timeout timer was started once for each set of DMA transfers,
but it should be started for each single DMA transfer.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent c9aec06f
...@@ -384,6 +384,8 @@ static void ivtv_dma_enc_start_xfer(struct ivtv_stream *s) ...@@ -384,6 +384,8 @@ static void ivtv_dma_enc_start_xfer(struct ivtv_stream *s)
ivtv_stream_sync_for_device(s); ivtv_stream_sync_for_device(s);
write_reg(s->sg_handle, IVTV_REG_ENCDMAADDR); write_reg(s->sg_handle, IVTV_REG_ENCDMAADDR);
write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER);
itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer);
} }
static void ivtv_dma_dec_start_xfer(struct ivtv_stream *s) static void ivtv_dma_dec_start_xfer(struct ivtv_stream *s)
...@@ -398,6 +400,8 @@ static void ivtv_dma_dec_start_xfer(struct ivtv_stream *s) ...@@ -398,6 +400,8 @@ static void ivtv_dma_dec_start_xfer(struct ivtv_stream *s)
ivtv_stream_sync_for_device(s); ivtv_stream_sync_for_device(s);
write_reg(s->sg_handle, IVTV_REG_DECDMAADDR); write_reg(s->sg_handle, IVTV_REG_DECDMAADDR);
write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER);
itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer);
} }
/* start the encoder DMA */ /* start the encoder DMA */
...@@ -459,8 +463,6 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) ...@@ -459,8 +463,6 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
ivtv_dma_enc_start_xfer(s); ivtv_dma_enc_start_xfer(s);
set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = s->type; itv->cur_dma_stream = s->type;
itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer);
} }
} }
...@@ -481,8 +483,6 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s) ...@@ -481,8 +483,6 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s)
ivtv_dma_dec_start_xfer(s); ivtv_dma_dec_start_xfer(s);
set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = s->type; itv->cur_dma_stream = s->type;
itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer);
} }
static void ivtv_irq_dma_read(struct ivtv *itv) static void ivtv_irq_dma_read(struct ivtv *itv)
...@@ -492,10 +492,11 @@ static void ivtv_irq_dma_read(struct ivtv *itv) ...@@ -492,10 +492,11 @@ static void ivtv_irq_dma_read(struct ivtv *itv)
int hw_stream_type = 0; int hw_stream_type = 0;
IVTV_DEBUG_HI_IRQ("DEC DMA READ\n"); IVTV_DEBUG_HI_IRQ("DEC DMA READ\n");
if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && itv->cur_dma_stream < 0) {
del_timer(&itv->dma_timer); del_timer(&itv->dma_timer);
if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && itv->cur_dma_stream < 0)
return; return;
}
if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags)) {
s = &itv->streams[itv->cur_dma_stream]; s = &itv->streams[itv->cur_dma_stream];
...@@ -543,7 +544,6 @@ static void ivtv_irq_dma_read(struct ivtv *itv) ...@@ -543,7 +544,6 @@ static void ivtv_irq_dma_read(struct ivtv *itv)
} }
wake_up(&s->waitq); wake_up(&s->waitq);
} }
del_timer(&itv->dma_timer);
clear_bit(IVTV_F_I_UDMA, &itv->i_flags); clear_bit(IVTV_F_I_UDMA, &itv->i_flags);
clear_bit(IVTV_F_I_DMA, &itv->i_flags); clear_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = -1; itv->cur_dma_stream = -1;
...@@ -557,10 +557,12 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) ...@@ -557,10 +557,12 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv)
ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data); ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data);
IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d (%d)\n", data[0], data[1], itv->cur_dma_stream); IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d (%d)\n", data[0], data[1], itv->cur_dma_stream);
if (itv->cur_dma_stream < 0) {
del_timer(&itv->dma_timer); del_timer(&itv->dma_timer);
if (itv->cur_dma_stream < 0)
return; return;
}
s = &itv->streams[itv->cur_dma_stream]; s = &itv->streams[itv->cur_dma_stream];
ivtv_stream_sync_for_cpu(s); ivtv_stream_sync_for_cpu(s);
...@@ -585,7 +587,6 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) ...@@ -585,7 +587,6 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv)
ivtv_dma_enc_start_xfer(s); ivtv_dma_enc_start_xfer(s);
return; return;
} }
del_timer(&itv->dma_timer);
clear_bit(IVTV_F_I_DMA, &itv->i_flags); clear_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = -1; itv->cur_dma_stream = -1;
dma_post(s); dma_post(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment