From b0f46ad6ed4af5eca481fad18825baafa0453a49 Mon Sep 17 00:00:00 2001
From: Pratyush Yadav
Date: Mon, 9 Oct 2023 18:39:37 +0530
Subject: media: cadence: csi2rx: Add link validation
Add media link validation to make sure incorrectly configured pipelines
are caught.
Signed-off-by: Pratyush Yadav
Tested-by: Julien Massot
Reviewed-by: Laurent Pinchart
Reviewed-by: Tomi Valkeinen
Reviewed-by: Maxime Ripard
Signed-off-by: Jai Luthra
Signed-off-by: Sakari Ailus
Signed-off-by: Hans Verkuil
---
drivers/media/platform/cadence/cdns-csi2rx.c | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'drivers/media')
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index d0c2a5b3d0d5..889f4fbbafb3 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -453,6 +453,10 @@ static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
.pad = &csi2rx_pad_ops,
};
+static const struct media_entity_operations csi2rx_media_ops = {
+ .link_validate = v4l2_subdev_link_validate,
+};
+
static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *s_subdev,
struct v4l2_async_connection *asd)
@@ -669,6 +673,7 @@ static int csi2rx_probe(struct platform_device *pdev)
for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++)
csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE;
csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ csi2rx->subdev.entity.ops = &csi2rx_media_ops;
ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX,
csi2rx->pads);
--
cgit v1.2.3