@@ -738,23 +738,20 @@ static int rcsi2_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_async_subdev *asd)
{
struct rcar_csi2 *priv = notifier_to_csi2(notifier);
- int pad;
+ int ret;
- pad = media_entity_get_fwnode_pad(&subdev->entity, asd->match.fwnode,
- MEDIA_PAD_FL_SOURCE);
- if (pad < 0) {
- dev_err(priv->dev, "Failed to find pad for %s\n", subdev->name);
- return pad;
- }
+ ret = media_create_fwnode_pad_links(&priv->subdev.entity.pads[0],
+ dev_fwnode(priv->dev),
+ &subdev->entity,
+ dev_fwnode(subdev->dev),
+ MEDIA_LNK_FL_ENABLED |
+ MEDIA_LNK_FL_IMMUTABLE);
+ if (ret)
+ return ret;
priv->remote = subdev;
- dev_dbg(priv->dev, "Bound %s pad: %d\n", subdev->name, pad);
-
- return media_create_pad_link(&subdev->entity, pad,
- &priv->subdev.entity, 0,
- MEDIA_LNK_FL_ENABLED |
- MEDIA_LNK_FL_IMMUTABLE);
+ return 0;
}
static void rcsi2_notify_unbind(struct v4l2_async_notifier *notifier,
rcsi2_notify_bound() passes the bound subdev's match fwnode to media_entity_get_fwnode_pad() to determine the subdev's source pad for creating the media link to it. When the bound subdev is the adv748x-csi2 transmitter, this is in fact correctly the endpoint fwnode. For other subdevices this likely will not be the case, the asd match fwnode is usually not an endpoint fwnode but rather the port parent fwnode. So rcar-csi2 will fail to get the correct source pad for bound subdev's other than the adv748x. To fix and make rcar-csi2 connect more generally to other subdevices, replace the calls to media_entity_get_fwnode_pad() and media_create_pad_link() with a call to media_create_fwnode_pad_links(). Fixes: 769afd212b160 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> --- drivers/media/platform/rcar-vin/rcar-csi2.c | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-)