media: v4l: async: Support fwnode endpoint list matching for subdevs

Support matching V4L2 async sub-devices based on particular fwnode
endpoint. This makes it possible to instantiate multiple V4L2 sub-devices
based on given fwnode endpoints from a single device, based on driver
needs.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Sakari Ailus
2023-04-28 15:58:42 +02:00
committed by Mauro Carvalho Chehab
parent 765f60568f
commit e74f7a9678
4 changed files with 90 additions and 2 deletions

View File

@@ -125,6 +125,18 @@ struct v4l2_async_notifier {
struct list_head notifier_entry;
};
/**
* struct v4l2_async_subdev_endpoint - Entry in sub-device's fwnode list
*
* @async_subdev_endpoint_entry: An entry in async_subdev_endpoint_list of
* &struct v4l2_subdev
* @endpoint: Endpoint fwnode agains which to match the sub-device
*/
struct v4l2_async_subdev_endpoint {
struct list_head async_subdev_endpoint_entry;
struct fwnode_handle *endpoint;
};
/**
* v4l2_async_debug_init - Initialize debugging tools.
*
@@ -215,6 +227,24 @@ __v4l2_async_nf_add_i2c(struct v4l2_async_notifier *notifier,
((type *)__v4l2_async_nf_add_i2c(notifier, adapter, address, \
sizeof(type)))
/**
* v4l2_async_subdev_endpoint_add - Add an endpoint fwnode to async sub-device
* matching list
*
* @sd: the sub-device
* @fwnode: the endpoint fwnode to match
*
* Add a fwnode to the async sub-device's matching list. This allows registering
* multiple async sub-devices from a single device.
*
* Note that calling v4l2_subdev_cleanup() as part of the sub-device's cleanup
* if endpoints have been added to the sub-device's fwnode matching list.
*
* Returns an error on failure, 0 on success.
*/
int v4l2_async_subdev_endpoint_add(struct v4l2_subdev *sd,
struct fwnode_handle *fwnode);
/**
* v4l2_async_connection_unique - return a unique &struct v4l2_async_connection
* for a sub-device