Commit a962a804 authored by Jacopo Mondi's avatar Jacopo Mondi Committed by Mauro Carvalho Chehab

media: rcar-vin: Link parallel input media entities

When running with media-controller link the parallel input
media entities with the VIN entities at 'complete' callback time.

To create media links the v4l2_device should be registered first.
Check if the device is already registered, to avoid double registrations.
Signed-off-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent a597a772
...@@ -474,6 +474,8 @@ static void rvin_parallel_subdevice_detach(struct rvin_dev *vin) ...@@ -474,6 +474,8 @@ static void rvin_parallel_subdevice_detach(struct rvin_dev *vin)
static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier) static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
{ {
struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev);
struct media_entity *source;
struct media_entity *sink;
int ret; int ret;
ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
...@@ -482,7 +484,26 @@ static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier) ...@@ -482,7 +484,26 @@ static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
return ret; return ret;
} }
return rvin_v4l2_register(vin); if (!video_is_registered(&vin->vdev)) {
ret = rvin_v4l2_register(vin);
if (ret < 0)
return ret;
}
if (!vin->info->use_mc)
return 0;
/* If we're running with media-controller, link the subdevs. */
source = &vin->parallel->subdev->entity;
sink = &vin->vdev.entity;
ret = media_create_pad_link(source, vin->parallel->source_pad,
sink, vin->parallel->sink_pad, 0);
if (ret)
vin_err(vin, "Error adding link from %s to %s: %d\n",
source->name, sink->name, ret);
return ret;
} }
static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier, static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier,
...@@ -604,7 +625,8 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) ...@@ -604,7 +625,8 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
/* Register all video nodes for the group. */ /* Register all video nodes for the group. */
for (i = 0; i < RCAR_VIN_NUM; i++) { for (i = 0; i < RCAR_VIN_NUM; i++) {
if (vin->group->vin[i]) { if (vin->group->vin[i] &&
!video_is_registered(&vin->group->vin[i]->vdev)) {
ret = rvin_v4l2_register(vin->group->vin[i]); ret = rvin_v4l2_register(vin->group->vin[i]);
if (ret) if (ret)
return ret; return ret;
......
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