diff mbox series

[v5,09/14] media: cadence: csi2rx: Add link validation

Message ID 20211223191615.17803-10-p.yadav@ti.com (mailing list archive)
State New, archived
Headers show
Series CSI2RX support on J721E | expand

Commit Message

Pratyush Yadav Dec. 23, 2021, 7:16 p.m. UTC
Add media link validation to make sure incorrectly configured pipelines
are caught. Since there is no support for transcoding, rely on the
default link validation function to make sure formats across source and
sink pads are the same.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>

---

Changes in v5:
- New in v5.

 drivers/media/platform/cadence/cdns-csi2rx.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart Dec. 30, 2021, 4:47 a.m. UTC | #1
Hi Pratyush,

Thank you for the patch.

On Fri, Dec 24, 2021 at 12:46:10AM +0530, Pratyush Yadav wrote:
> Add media link validation to make sure incorrectly configured pipelines
> are caught. Since there is no support for transcoding, rely on the
> default link validation function to make sure formats across source and
> sink pads are the same.

I think the commit message is a bit misleading. The default link
validation function ensures that formats on the source and sink sides of
a link match. It doesn't compare the formats on the sink and source pads
of the subdev. Whether the subdev can transcode or not is thus not
relevant here.

> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
> 
> ---
> 
> Changes in v5:
> - New in v5.
> 
>  drivers/media/platform/cadence/cdns-csi2rx.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
> index 53659776a906..119c7540c75a 100644
> --- a/drivers/media/platform/cadence/cdns-csi2rx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2rx.c
> @@ -492,6 +492,10 @@ static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
>  	.pad		= &csi2rx_pad_ops,
>  };
>  
> +static struct media_entity_operations csi2rx_media_ops = {

static const

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	.link_validate = v4l2_subdev_link_validate,
> +};
> +
>  static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,
>  			      struct v4l2_subdev *s_subdev,
>  			      struct v4l2_async_subdev *asd)
> @@ -691,6 +695,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);
diff mbox series

Patch

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 53659776a906..119c7540c75a 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -492,6 +492,10 @@  static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
 	.pad		= &csi2rx_pad_ops,
 };
 
+static 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_subdev *asd)
@@ -691,6 +695,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);