@@ -26,6 +26,12 @@
#include "rcar-vin.h"
+static int rvin_group_add_link(struct rvin_dev *vin,
+ struct media_entity *source,
+ unsigned int source_idx,
+ struct media_entity *sink,
+ unsigned int sink_idx,
+ u32 flags);
/* -----------------------------------------------------------------------------
* Media Controller link notification
*/
@@ -418,6 +424,7 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier)
{
struct rvin_dev *vin = notifier_to_vin(notifier);
struct v4l2_subdev *sd = vin_to_source(vin);
+ struct media_entity *source, *sink;
int ret;
/* Verify subdevices mbus format */
@@ -464,7 +471,20 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier)
v4l2_disable_ioctl(&vin->vdev, VIDIOC_ENUMSTD);
}
- return rvin_reset_format(vin);
+ ret = rvin_reset_format(vin);
+ if (ret)
+ return ret;
+
+ /* Link the digital subdev with the VIN instance, if supported */
+ if (vin->info->use_mc && (vin->info->din_mask & BIT(vin->id))) {
+ source = &vin->digital.subdev->entity;
+ sink = &vin->group->vin[vin->id]->vdev.entity;
+
+ ret = rvin_group_add_link(vin, source, 0, sink, 0,
+ MEDIA_LNK_FL_ENABLED);
+ }
+
+ return ret;
}
static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier,
Link digital subdevice to the current VIN instance if the instance support it and we are currently using media controller API. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> --- drivers/media/platform/rcar-vin/rcar-core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)