diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-07-24 22:17:24 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-09-04 15:36:00 +0200 |
commit | d3e7371b152c98ebac4c5202223c1c962bf390c6 (patch) | |
tree | b96248f467279b44c1f51a5efe8e40385237c227 | |
parent | ab75d6ab59d1bccd08204dd5fe7bddae2e19e1ee (diff) |
Add omap3_isp_pipeline_activate()
The function activates all links in the given pipeline. Replace manual
link activation by calls to omap3_isp_pipeline_activate().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | isp/omap3isp.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/isp/omap3isp.c b/isp/omap3isp.c index 3d0872f..04d69ad 100644 --- a/isp/omap3isp.c +++ b/isp/omap3isp.c @@ -210,6 +210,30 @@ done: return ret; } +static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp, + struct omap3_isp_pipeline *pipe) +{ + struct omap3_isp_entity *entity; + int ret; + + ret = media_reset_links(isp->mdev); + if (ret < 0) + return ret; + + list_for_each_entry(entity, &pipe->entities, list) { + if (entity->link_source == NULL) + break; + + ret = setup_link(isp, entity->link_source->source->entity, + entity->link_source->sink->entity, + MEDIA_LNK_FL_ENABLED); + if (ret < 0) + return ret; + } + + return 0; +} + static int omap3_isp_pipeline_set_format(struct omap3_isp_device *isp, struct v4l2_mbus_framefmt *ofmt, enum omap3_isp_scaler scaler, @@ -619,22 +643,7 @@ int omap3_isp_viewfinder_put_buffer(struct omap3_isp_device *isp, static int omap3_isp_snapshot_restore_pipeline(struct omap3_isp_device *isp) { - int ret; - - ret = setup_link(isp, isp->snapshot.output.subdev, isp->snapshot.output.node, 0); - if (ret < 0) - return ret; - - if (isp->snapshot.output.format.code == V4L2_MBUS_FMT_UYVY8_1X16 || - isp->snapshot.output.format.code == V4L2_MBUS_FMT_YUYV8_1X16) - ret = setup_link(isp, isp->viewfinder.output.subdev, isp->viewfinder.output.node, - MEDIA_LNK_FL_ENABLED); - else - ret = setup_link(isp, isp->ccdc, isp->preview, MEDIA_LNK_FL_ENABLED); - if (ret < 0) - return ret; - - return 0; + return omap3_isp_pipeline_activate(isp, &isp->viewfinder); } static int omap3_isp_snapshot_setup_pipeline(struct omap3_isp_device *isp, @@ -644,16 +653,7 @@ static int omap3_isp_snapshot_setup_pipeline(struct omap3_isp_device *isp, int ret; /* Setup the links. */ - if (ofmt->code == V4L2_MBUS_FMT_UYVY8_1X16 || - ofmt->code == V4L2_MBUS_FMT_YUYV8_1X16) - ret = setup_link(isp, isp->viewfinder.output.subdev, isp->viewfinder.output.node, 0); - else - ret = setup_link(isp, isp->ccdc, isp->preview, 0); - if (ret < 0) - return ret; - - ret = setup_link(isp, isp->snapshot.output.subdev, isp->snapshot.output.node, - MEDIA_LNK_FL_ENABLED); + ret = omap3_isp_pipeline_activate(isp, &isp->snapshot); if (ret < 0) return ret; |