aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJassi Brar <jaswinder.singh@linaro.org>2011-05-03 12:17:58 +0800
committerRicardo Salveti de Araujo <ricardo.salveti@canonical.com>2011-05-16 22:42:10 -0300
commita61d5cb72f3c976ac1f5e0b39b33b4ec217c2426 (patch)
tree493492aa1d22daa10eb757c7011e6ed79c5a2592 /drivers
parentd4038ce99242cabfc5e3f10394e7f86f7e747352 (diff)
downloadlinux-linaro-android-a61d5cb72f3c976ac1f5e0b39b33b4ec217c2426.tar.gz
V4L2: OMAP: Make it work for OMAP4
Some logical optimization and redundat checks removed. Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/omap/omap_vout.c94
1 files changed, 50 insertions, 44 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index 029a4babfd6..8cd08d1b350 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -825,6 +825,43 @@ int omapvid_apply_changes(struct omap_vout_device *vout)
return 0;
}
+static int _program_cur(struct omap_vout_device *vout)
+{
+ int ret;
+ u32 addr = (unsigned long) vout->queued_buf_addr[vout->cur_frm->i]
+ + vout->cropped_offset;
+
+ /* First save the configuration in ovelray structure */
+ ret = omapvid_init(vout, addr);
+ if (ret) {
+ printk(KERN_ERR VOUT_NAME
+ "failed to set overlay info\n");
+ return ret;
+ }
+ /* Enable the pipeline and set the Go bit */
+ ret = omapvid_apply_changes(vout);
+ if (ret)
+ printk(KERN_ERR VOUT_NAME
+ "failed to change mode\n");
+
+ return ret;
+}
+
+static struct videobuf_buffer * _get_next_frm(struct omap_vout_device *vout)
+{
+ struct videobuf_buffer *frm;
+
+ if (list_empty(&vout->dma_queue))
+ return NULL;
+
+ frm = list_entry(vout->dma_queue.next,
+ struct videobuf_buffer, queue);
+
+ list_del(&frm->queue);
+
+ return frm;
+}
+
void omap_vout_isr(void *arg, unsigned int irqstatus)
{
int ret;
@@ -894,45 +931,18 @@ void omap_vout_isr(void *arg, unsigned int irqstatus)
goto vout_isr_err;
vout->field_id ^= 1;
- if (fid != vout->field_id) {
- if (0 == fid)
- vout->field_id = fid;
-
- goto vout_isr_err;
- }
if (0 == fid) {
- if (vout->cur_frm == vout->next_frm)
- goto vout_isr_err;
-
- vout->cur_frm->ts = timevalue;
- vout->cur_frm->state = VIDEOBUF_DONE;
- wake_up_interruptible(&vout->cur_frm->done);
- vout->cur_frm = vout->next_frm;
- } else if (1 == fid) {
- if (list_empty(&vout->dma_queue) ||
- (vout->cur_frm != vout->next_frm))
- goto vout_isr_err;
-
- vout->next_frm = list_entry(vout->dma_queue.next,
- struct videobuf_buffer, queue);
- list_del(&vout->next_frm->queue);
-
- vout->next_frm->state = VIDEOBUF_ACTIVE;
- addr = (unsigned long)
- vout->queued_buf_addr[vout->next_frm->i] +
- vout->cropped_offset;
- /* First save the configuration in ovelray structure */
- ret = omapvid_init(vout, addr);
- if (ret)
- printk(KERN_ERR VOUT_NAME
- "failed to set overlay info\n");
- /* Enable the pipeline and set the Go bit */
- ret = omapvid_apply_changes(vout);
- if (ret)
- printk(KERN_ERR VOUT_NAME
- "failed to change mode\n");
+ if (vout->cur_frm) {
+ vout->cur_frm->ts = timevalue;
+ vout->cur_frm->state = VIDEOBUF_DONE;
+ wake_up_interruptible(&vout->cur_frm->done);
+ }
}
-
+ vout->cur_frm = _get_next_frm(vout);
+ if (!vout->cur_frm)
+ goto vout_isr_err;
+ vout->cur_frm->state = VIDEOBUF_ACTIVE;
+ _program_cur(vout);
}
vout_isr_err:
@@ -1922,16 +1932,12 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
if (ret)
goto streamon_err;
- if (list_empty(&vout->dma_queue)) {
+ /* Get the next frame from the buffer queue */
+ vout->cur_frm = _get_next_frm(vout);
+ if (!vout->cur_frm) {
ret = -EIO;
goto streamon_err1;
}
-
- /* Get the next frame from the buffer queue */
- vout->next_frm = vout->cur_frm = list_entry(vout->dma_queue.next,
- struct videobuf_buffer, queue);
- /* Remove buffer from the buffer queue */
- list_del(&vout->cur_frm->queue);
/* Mark state of the current frame to active */
vout->cur_frm->state = VIDEOBUF_ACTIVE;
/* Initialize field_id and started member */