media: v4l: async: Allow multiple connections between entities

When the v4l2-async framework was introduced, the use case for it was to
connect a camera sensor with a parallel receiver. Both tended to be rather
simple devices with a single connection between them.

The framework has been since improved in multiple ways but there are
limitations that have remained, for instance the assumption an async
sub-device is connected towards a single notifier and via a single link
only.

This patch enables connecting a sub-device to one or more notifiers
simultaneously, with one or more connections per notifier. The notifier
information is moved from the sub-device to the connection and the
connections in sub-device are no longer a pointer but a linked list.

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-05-19 13:44:03 +02:00
committed by Mauro Carvalho Chehab
parent c91fd7b7a8
commit 28a1295795
3 changed files with 90 additions and 83 deletions

View File

@@ -62,27 +62,32 @@ struct v4l2_async_match_desc {
};
/**
* struct v4l2_async_connection - connection descriptor, as known to a bridge
* struct v4l2_async_connection - sub-device connection descriptor, as known to
* a bridge
*
* @match: struct of match type and per-bus type matching data sets
* @notifier: the async notifier the connection is related to
* @asc_entry: used to add struct v4l2_async_connection objects to the
* notifier @waiting_list or @done_list
* @asc_subdev_entry: entry in struct v4l2_async_subdev.asc_list list
* @sd: the related sub-device
*
* When this struct is used as a member in a driver specific struct,
* the driver specific struct shall contain the &struct
* v4l2_async_connection as its first member.
* When this struct is used as a member in a driver specific struct, the driver
* specific struct shall contain the &struct v4l2_async_connection as its first
* member.
*/
struct v4l2_async_connection {
struct v4l2_async_match_desc match;
struct v4l2_async_notifier *notifier;
struct list_head asc_entry;
struct list_head asc_subdev_entry;
struct v4l2_subdev *sd;
};
/**
* struct v4l2_async_notifier_operations - Asynchronous V4L2 notifier operations
* @bound: a subdevice driver has successfully probed one of the subdevices
* @complete: All subdevices have been probed successfully. The complete
* @bound: a sub-device has been bound by the given connection
* @complete: All connections have been bound successfully. The complete
* callback is only executed for the root notifier.
* @unbind: a subdevice is leaving
* @destroy: the asc is about to be freed