From aab84f55d45ff6838e708f0cb8e1c0166d339ef6 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 20 Oct 2012 18:48:18 -0300 Subject: [PATCH] [media] omap3isp: Find source pad from external entity No longer assume pad number 0 is the source pad of the external entity. Find the source pad from the external entity and use it instead. Signed-off-by: Sakari Ailus Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/omap3isp/isp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 5ea5520ff467..cb9bc3436135 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1767,6 +1767,7 @@ static int isp_register_entities(struct isp_device *isp) struct media_entity *input; unsigned int flags; unsigned int pad; + unsigned int i; sensor = isp_register_subdev_group(isp, subdevs->subdevs); if (sensor == NULL) @@ -1814,7 +1815,19 @@ static int isp_register_entities(struct isp_device *isp) goto done; } - ret = media_entity_create_link(&sensor->entity, 0, input, pad, + for (i = 0; i < sensor->entity.num_pads; i++) { + if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE) + break; + } + if (i == sensor->entity.num_pads) { + dev_err(isp->dev, + "%s: no source pad in external entity\n", + __func__); + ret = -EINVAL; + goto done; + } + + ret = media_entity_create_link(&sensor->entity, i, input, pad, flags); if (ret < 0) goto done; -- 2.39.5