[PATCH v7 1/8] media: subdev: Add set_pad_by_ep() callback to internal ops

Frank.Li at oss.nxp.com Frank.Li at oss.nxp.com
Thu Jul 2 09:03:57 PDT 2026


From: Frank Li <Frank.Li at nxp.com>

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 at nxp.com>
---
change in v7
- add vep argument

change in v6
- new patch
---
 include/media/v4l2-subdev.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d256b7ec8f848..05b3ccfc856ee 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -34,6 +34,7 @@ struct v4l2_ctrl_handler;
 struct v4l2_event;
 struct v4l2_event_subscription;
 struct v4l2_fh;
+struct v4l2_fwnode_endpoint;
 struct v4l2_subdev;
 struct v4l2_subdev_fh;
 struct v4l2_subdev_stream_config;
@@ -935,6 +936,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 media pad information by parsed fwnode endpoint vep.
+ *		   return < 0 means can't support this type endpoint. Set
+ *		   pad->flags according to vep information.
+ *
  * .. note::
  *	Never call this from drivers, only the v4l2 framework can call
  *	these ops.
@@ -947,6 +952,8 @@ 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,
+			     struct v4l2_fwnode_endpoint *vep);
 };
 
 /* Set this flag if this subdev is a i2c device. */

-- 
2.43.0




More information about the linux-arm-kernel mailing list