summaryrefslogtreecommitdiff
path: root/isp
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
parentdcefa4189bf3b012333771730c2a9b3bd7c1d576 (diff)
omap3isp: Make viewfinder optional
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'isp')
-rw-r--r--isp/omap3isp-priv.h8
-rw-r--r--isp/omap3isp.c73
2 files changed, 72 insertions, 9 deletions
diff --git a/isp/omap3isp-priv.h b/isp/omap3isp-priv.h
index b6484de..18fbf76 100644
--- a/isp/omap3isp-priv.h
+++ b/isp/omap3isp-priv.h
@@ -111,18 +111,26 @@ struct omap3_isp_pool {
#define to_omap3_isp_pool(e) container_of(e, struct omap3_isp_pool, entity)
+enum omap3_isp_pipeline_state {
+ OMAP3_ISP_PIPELINE_STOPPED,
+ OMAP3_ISP_PIPELINE_RUNNING,
+ OMAP3_ISP_PIPELINE_SUSPENDED,
+};
+
/*
* struct omap3_isp_pipeline - OMAP3 pipeline
* @entitites: Entities in the pipeline
* @scaler: Whether scaling should be performed on the ISP or the sensor
* @pools: Pools in the pipeline
* @output: Video device at the output of the pipeline
+ * @state: Pipeline state
*/
struct omap3_isp_pipeline {
struct list_entry entities;
enum omap3_isp_scaler scaler;
struct list_entry pools;
struct omap3_isp_video *output;
+ enum omap3_isp_pipeline_state state;
};
struct omap3_isp_device {
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;