aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc/vimc-common.c
diff options
context:
space:
mode:
authorHelen Fornazier <helen.koike@collabora.com>2017-06-19 13:00:13 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-23 08:03:37 -0400
commitbf5fb95c261de259e912e49973c66347a0a5b3d3 (patch)
treeaa82d288682f0c3b58ab9ae938e96c67ababb387 /drivers/media/platform/vimc/vimc-common.c
parentc149543ef46e3dcc80280a4cc9fbcd05294d3c58 (diff)
[media] vimc: common: Add vimc_pipeline_s_stream helper
Move the vimc_cap_pipeline_s_stream from the vimc-cap.c to vimc-common.c as this core will be reused by other subdevices to activate the stream in their directly connected nodes Signed-off-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-common.c')
-rw-r--r--drivers/media/platform/vimc/vimc-common.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c
index 3afbabd739a5..f809a9d756b9 100644
--- a/drivers/media/platform/vimc/vimc-common.c
+++ b/drivers/media/platform/vimc/vimc-common.c
@@ -220,6 +220,38 @@ struct media_pad *vimc_pads_init(u16 num_pads, const unsigned long *pads_flag)
220 return pads; 220 return pads;
221} 221}
222 222
223int vimc_pipeline_s_stream(struct media_entity *ent, int enable)
224{
225 struct v4l2_subdev *sd;
226 struct media_pad *pad;
227 unsigned int i;
228 int ret;
229
230 for (i = 0; i < ent->num_pads; i++) {
231 if (ent->pads[i].flags & MEDIA_PAD_FL_SOURCE)
232 continue;
233
234 /* Start the stream in the subdevice direct connected */
235 pad = media_entity_remote_pad(&ent->pads[i]);
236
237 /*
238 * if this is a raw node from vimc-core, then there is
239 * nothing to activate
240 * TODO: remove this when there are no more raw nodes in the
241 * core and return error instead
242 */
243 if (pad->entity->obj_type == MEDIA_ENTITY_TYPE_BASE)
244 continue;
245
246 sd = media_entity_to_v4l2_subdev(pad->entity);
247 ret = v4l2_subdev_call(sd, video, s_stream, enable);
248 if (ret && ret != -ENOIOCTLCMD)
249 return ret;
250 }
251
252 return 0;
253}
254
223static const struct media_entity_operations vimc_ent_sd_mops = { 255static const struct media_entity_operations vimc_ent_sd_mops = {
224 .link_validate = v4l2_subdev_link_validate, 256 .link_validate = v4l2_subdev_link_validate,
225}; 257};