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 <sakari.ai...@iki.fi>
---
 drivers/media/video/omap3isp/isp.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/omap3isp/isp.c 
b/drivers/media/video/omap3isp/isp.c
index f54953d..0718b0a 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -1744,6 +1744,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)
@@ -1791,7 +1792,17 @@ 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,
+                               "no source pads in external entities\n");
+                       ret = -EINVAL;
+                       goto done;
+               }
+
+               ret = media_entity_create_link(&sensor->entity, i, input, pad,
                                               flags);
                if (ret < 0)
                        goto done;
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to