diff options
author | Jonathan Corbet <corbet@lwn.net> | 2007-04-27 11:32:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:03 -0400 |
commit | 5b50ed7ca2432e7ea3caf8cc2ef5ac805c082519 (patch) | |
tree | 3978ac629ea8cef2bc14483d3c218e81e6cf4fb8 /drivers/media/video/cafe_ccic.c | |
parent | 76f4a12000254d460e947d2a95ab422ee6e598bf (diff) |
V4L/DVB (5466): Fix up some Cafe CCIC delay issues
Fix up unsociable Cafe CCIC delays.
The Cafe CCIC driver contains some lengthy delays, some of which are
unnecessary and some of which are done under lock. Some were marked
with comments, but the comments somehow failed to make the issue go
away. So fix it for real.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cafe_ccic.c')
-rw-r--r-- | drivers/media/video/cafe_ccic.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index f629c559e7dd..bfae5d2fd744 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -705,7 +705,13 @@ static void cafe_ctlr_init(struct cafe_camera *cam) | |||
705 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ | 705 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ |
706 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); | 706 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); |
707 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); | 707 | cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); |
708 | /* | ||
709 | * Here we must wait a bit for the controller to come around. | ||
710 | */ | ||
711 | spin_unlock_irqrestore(&cam->dev_lock, flags); | ||
708 | mdelay(5); /* FIXME revisit this */ | 712 | mdelay(5); /* FIXME revisit this */ |
713 | spin_lock_irqsave(&cam->dev_lock, flags); | ||
714 | |||
709 | cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); | 715 | cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); |
710 | cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); | 716 | cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); |
711 | /* | 717 | /* |
@@ -773,9 +779,9 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam) | |||
773 | * Control 1 is power down, set to 0 to operate. | 779 | * Control 1 is power down, set to 0 to operate. |
774 | */ | 780 | */ |
775 | cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ | 781 | cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ |
776 | mdelay(1); /* Marvell says 1ms will do it */ | 782 | // mdelay(1); /* Marvell says 1ms will do it */ |
777 | cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); | 783 | cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); |
778 | mdelay(1); /* Enough? */ | 784 | // mdelay(1); /* Enough? */ |
779 | spin_unlock_irqrestore(&cam->dev_lock, flags); | 785 | spin_unlock_irqrestore(&cam->dev_lock, flags); |
780 | } | 786 | } |
781 | 787 | ||
@@ -1796,18 +1802,19 @@ static void cafe_frame_tasklet(unsigned long data) | |||
1796 | if (list_empty(&cam->sb_avail)) | 1802 | if (list_empty(&cam->sb_avail)) |
1797 | break; /* Leave it valid, hope for better later */ | 1803 | break; /* Leave it valid, hope for better later */ |
1798 | clear_bit(bufno, &cam->flags); | 1804 | clear_bit(bufno, &cam->flags); |
1799 | /* | ||
1800 | * We could perhaps drop the spinlock during this | ||
1801 | * big copy. Something to consider. | ||
1802 | */ | ||
1803 | sbuf = list_entry(cam->sb_avail.next, | 1805 | sbuf = list_entry(cam->sb_avail.next, |
1804 | struct cafe_sio_buffer, list); | 1806 | struct cafe_sio_buffer, list); |
1807 | /* | ||
1808 | * Drop the lock during the big copy. This *should* be safe... | ||
1809 | */ | ||
1810 | spin_unlock_irqrestore(&cam->dev_lock, flags); | ||
1805 | memcpy(sbuf->buffer, cam->dma_bufs[bufno], | 1811 | memcpy(sbuf->buffer, cam->dma_bufs[bufno], |
1806 | cam->pix_format.sizeimage); | 1812 | cam->pix_format.sizeimage); |
1807 | sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; | 1813 | sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; |
1808 | sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; | 1814 | sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; |
1809 | sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; | 1815 | sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; |
1810 | sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; | 1816 | sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; |
1817 | spin_lock_irqsave(&cam->dev_lock, flags); | ||
1811 | list_move_tail(&sbuf->list, &cam->sb_full); | 1818 | list_move_tail(&sbuf->list, &cam->sb_full); |
1812 | } | 1819 | } |
1813 | if (! list_empty(&cam->sb_full)) | 1820 | if (! list_empty(&cam->sb_full)) |