Commit 5fa71f6b authored by Enrico Scholz's avatar Enrico Scholz

media:mxc-mipi-csi2_yav: link sensor pads on bind()

Signed-off-by: Enrico Scholz's avatarEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
parent e56f69ca
......@@ -523,6 +523,9 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
struct v4l2_async_subdev *asd)
{
struct mxc_mipi_csi2_dev *csi2dev = notifier_to_mipi_dev(notifier);
struct media_entity *source = &subdev->entity;
struct media_entity *sink = &csi2dev->sd.entity;
int rc;
/* Find platform data for this sensor subdev */
if (csi2dev->asd.match.fwnode.fwnode == of_fwnode_handle(subdev->dev->of_node))
......@@ -531,10 +534,20 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
if (subdev == NULL)
return -EINVAL;
rc = media_entity_call(source, link_setup, &source->pads[0],
&sink->pads[0], MEDIA_LNK_FL_ENABLED);
if (rc < 0 && rc != -ENOIOCTLCMD) {
v4l2_err(&csi2dev->v4l2_dev, "failed to link pads: %d\n", rc);
goto out;
}
v4l2_info(&csi2dev->v4l2_dev, "Registered sensor subdevice: %s\n",
subdev->name);
return 0;
rc = 0;
out:
return rc;
}
static void subdev_notifier_unbind(struct v4l2_async_notifier *notifier,
......@@ -542,10 +555,18 @@ static void subdev_notifier_unbind(struct v4l2_async_notifier *notifier,
struct v4l2_async_subdev *asd)
{
struct mxc_mipi_csi2_dev *csi2dev = notifier_to_mipi_dev(notifier);
struct media_entity *source = &subdev->entity;
struct media_entity *sink = &csi2dev->sd.entity;
int rc;
if (csi2dev->sensor_sd != subdev)
return;
rc = media_entity_call(source, link_setup, &source->pads[0],
&sink->pads[0], 0);
if (rc < 0 && rc != -ENOIOCTLCMD)
v4l2_warn(&csi2dev->v4l2_dev, "failed to unlink pads: %d\n", rc);
csi2dev->sensor_sd = NULL;
v4l2_info(&csi2dev->v4l2_dev, "Unregistered sensor subdevice: %s\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment