[PATCH v6 2/9] media: subdev: Add set_pad_by_ep() callback to internal ops

From: Frank . Li

Date: Wed Jun 24 2026 - 16:40:33 EST


From: Frank Li <Frank.Li@xxxxxxx>

Add a set_pad_by_ep() callback to struct v4l2_subdev_internal_ops. The
callback is invoked while parsing firmware node endpoints and allows
subdevice drivers to configure media pad properties based on endpoint
information.

Typical uses include setting media pad flags according to the endpoint's
port number or type, and validating that the endpoint configuration is
supported by the underlying hardware. This provides a common mechanism
for endpoint-aware pad initialization during graph construction.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
change in v6
- new patch
---
include/media/v4l2-subdev.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d256b7ec8f848..eb652eb76d33f 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -935,6 +935,10 @@ struct v4l2_subdev_ops {
* the v4l2_subdev structure. It is almost certainly required for any
* sub-device that sets the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
*
+ * @set_pad_by_ep: Set pad informaiton by fwnode endpoint, parsed fwnode already
+ * saved into pad->vep. return < 0 means can't support this type
+ * endpoint. Set pad->flags according to pad->vep information.
+ *
* .. note::
* Never call this from drivers, only the v4l2 framework can call
* these ops.
@@ -947,6 +951,7 @@ struct v4l2_subdev_internal_ops {
int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
void (*release)(struct v4l2_subdev *sd);
+ int (*set_pad_by_ep)(struct v4l2_subdev *sd, struct media_pad *pad);
};

/* Set this flag if this subdev is a i2c device. */

--
2.43.0