summaryrefslogtreecommitdiff
path: root/isp/omap3isp.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-02-29 12:20:32 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-04-16 23:50:06 +0200
commit594c6519fddcf7c1ecec7a7fea30c96066ec9c4b (patch)
tree9fc2aac7f61b58fabce88661f02a2fedbf47e4db /isp/omap3isp.c
parentdcefa4189bf3b012333771730c2a9b3bd7c1d576 (diff)
omap3isp: Make viewfinder optional
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'isp/omap3isp.c')
-rw-r--r--isp/omap3isp.c73
1 files changed, 64 insertions, 9 deletions
diff --git a/isp/omap3isp.c b/isp/omap3isp.c
index f6ec060..9c60f45 100644
--- a/isp/omap3isp.c
+++ b/isp/omap3isp.c
@@ -381,6 +381,8 @@ static void omap3_isp_pipeline_init(struct omap3_isp_pipeline *pipe)
{
list_init(&pipe->entities);
list_init(&pipe->pools);
+
+ pipe->state = OMAP3_ISP_PIPELINE_STOPPED;
}
static void omap3_isp_pipeline_destroy(struct omap3_isp_pipeline *pipe)
@@ -971,7 +973,7 @@ static void omap3_isp_viewfinder_event(void *priv)
isp->ops->viewfinder_ready(isp, &buffer);
}
-int omap3_isp_viewfinder_start(struct omap3_isp_device *isp)
+static int __omap3_isp_viewfinder_start(struct omap3_isp_device *isp)
{
struct v4l2_video_buffer buffer;
struct omap3_isp_pool *pool;
@@ -1013,8 +1015,7 @@ int omap3_isp_viewfinder_start(struct omap3_isp_device *isp)
return 0;
}
-
-int omap3_isp_viewfinder_stop(struct omap3_isp_device *isp)
+static int __omap3_isp_viewfinder_stop(struct omap3_isp_device *isp)
{
struct omap3_isp_pool *pool;
int ret;
@@ -1146,6 +1147,64 @@ int omap3_isp_viewfinder_put_buffer(struct omap3_isp_device *isp,
return omap3_isp_video_queue_buffer(isp->viewfinder.output, buffer);
}
+int omap3_isp_viewfinder_start(struct omap3_isp_device *isp)
+{
+ int ret;
+
+ ret = __omap3_isp_viewfinder_start(isp);
+ if (ret < 0)
+ return ret;
+
+ isp->viewfinder.state = OMAP3_ISP_PIPELINE_RUNNING;
+ return 0;
+}
+
+int omap3_isp_viewfinder_stop(struct omap3_isp_device *isp)
+{
+ int ret;
+
+ ret = __omap3_isp_viewfinder_stop(isp);
+ if (ret < 0)
+ return ret;
+
+ isp->viewfinder.state = OMAP3_ISP_PIPELINE_STOPPED;
+ return 0;
+}
+
+static int omap3_isp_viewfinder_suspend(struct omap3_isp_device *isp)
+{
+ int ret;
+
+ if (isp->viewfinder.state != OMAP3_ISP_PIPELINE_RUNNING)
+ return 0;
+
+ ret = __omap3_isp_viewfinder_stop(isp);
+ if (ret < 0)
+ return ret;
+
+ isp->viewfinder.state = OMAP3_ISP_PIPELINE_SUSPENDED;
+ return 0;
+}
+
+static int omap3_isp_viewfinder_resume(struct omap3_isp_device *isp)
+{
+ int ret;
+
+ if (isp->viewfinder.state != OMAP3_ISP_PIPELINE_SUSPENDED)
+ return 0;
+
+ ret = omap3_isp_viewfinder_setup_pipeline(isp);
+ if (ret < 0)
+ return ret;
+
+ ret = omap3_isp_viewfinder_start(isp);
+ if (ret < 0)
+ return ret;
+
+ isp->viewfinder.state = OMAP3_ISP_PIPELINE_RUNNING;
+ return 0;
+}
+
/* -----------------------------------------------------------------------------
* Snapshot
*
@@ -1248,11 +1307,7 @@ static void omap3_isp_snapshot_event(void *priv)
isp->ops->snapshot_ready(isp, &buffer);
/* Resume the viewfinder. */
- ret = omap3_isp_viewfinder_setup_pipeline(isp);
- if (ret < 0)
- return;
-
- ret = omap3_isp_viewfinder_start(isp);
+ ret = omap3_isp_viewfinder_resume(isp);
if (ret < 0) {
printf("error: unable to resume viewfinder.\n");
return;
@@ -1275,7 +1330,7 @@ int omap3_isp_snapshot_capture(struct omap3_isp_device *isp)
int ret;
/* Suspend the viewfinder. */
- ret = omap3_isp_viewfinder_stop(isp);
+ ret = omap3_isp_viewfinder_suspend(isp);
if (ret < 0) {
printf("error: unable to suspend viewfinder.\n");
return ret;