diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-07-05 02:20:20 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-10-20 21:28:24 +0200 |
commit | e63c0b37164a07c1a944a6597a550472abfeac75 (patch) | |
tree | a17be4047442c2bedaa962538ce91c7e6b44d917 /isp/omap3isp.c | |
parent | 45b5a7fe12df5b4975cb60629675a0693eb675a6 (diff) |
isp: Protect against starting viewfinder and snapshot at the same time
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'isp/omap3isp.c')
-rw-r--r-- | isp/omap3isp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/isp/omap3isp.c b/isp/omap3isp.c index 0c677b4..ed5094c 100644 --- a/isp/omap3isp.c +++ b/isp/omap3isp.c @@ -1001,6 +1001,7 @@ struct omap3_isp_device *omap3_isp_open(const char *devname, return NULL; memset(isp, 0, sizeof *isp); + isp->state = OMAP3_ISP_IDLE; isp->ops = ops; omap3_isp_pipeline_init(&isp->viewfinder); @@ -1217,6 +1218,9 @@ int omap3_isp_viewfinder_start(struct omap3_isp_device *isp, unsigned int bufs) unsigned int i; int ret; + if (isp->state != OMAP3_ISP_IDLE) + return -EBUSY; + /* Setup the pipeline. */ ret = omap3_isp_viewfinder_setup_pipeline(isp); if (ret < 0) @@ -1260,6 +1264,7 @@ int omap3_isp_viewfinder_start(struct omap3_isp_device *isp, unsigned int bufs) } isp->viewfinder.state = OMAP3_ISP_PIPELINE_RUNNING; + isp->state = OMAP3_ISP_VIEWFINDER; return 0; } @@ -1283,6 +1288,7 @@ int omap3_isp_viewfinder_stop(struct omap3_isp_device *isp) omap3_isp_pool_stop(pool); isp->viewfinder.state = OMAP3_ISP_PIPELINE_STOPPED; + isp->state = OMAP3_ISP_IDLE; return 0; } @@ -1387,6 +1393,9 @@ int omap3_isp_snapshot_capture(struct omap3_isp_device *isp) { int ret; + if (isp->state != OMAP3_ISP_IDLE) + return -EBUSY; + /* Configure the pipeline. */ ret = omap3_isp_pipeline_activate(isp, &isp->snapshot); if (ret < 0) { @@ -1410,6 +1419,7 @@ int omap3_isp_snapshot_capture(struct omap3_isp_device *isp) return ret; } + isp->state = OMAP3_ISP_SNAPSHOT; return 0; } @@ -1430,6 +1440,8 @@ int omap3_isp_snapshot_done(struct omap3_isp_device *isp) return ret; } + isp->state = OMAP3_ISP_IDLE; + /* Queue all buffers for the next snapshot. */ for (i = 0; i < isp->snapshot.output->video->nbufs; ++i) { buffer.index = i; |