media: v4l: async: Rename v4l2_async_subdev as v4l2_async_connection

Rename v4l2_async_subdev as v4l2_async_connection, in order to
differentiate between the sub-devices and their connections: one
sub-device can have many connections but the V4L2 async framework has so
far allowed just a single one. Connections in this context will later
translate into either MC ancillary or data links.

This patch prepares changing that relation by changing existing users of
v4l2_async_subdev to switch to v4l2_async_connection. Async sub-devices
themselves will not be needed anymore

Additionally, __v4l2_async_nf_add_subdev() has been renamed
__v4l2_async_nf_add_connection().

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-02-16 14:54:53 +01:00
committed by Mauro Carvalho Chehab
parent 1029939b37
commit adb2dcd5f2
70 changed files with 368 additions and 361 deletions

View File

@@ -25,7 +25,7 @@ struct v4l2_async_notifier;
* @V4L2_ASYNC_MATCH_TYPE_I2C: Match will check for I2C adapter ID and address
* @V4L2_ASYNC_MATCH_TYPE_FWNODE: Match will use firmware node
*
* This enum is used by the asynchronous sub-device logic to define the
* This enum is used by the asynchronous connection logic to define the
* algorithm that will be used to match an asynchronous device.
*/
enum v4l2_async_match_type {
@@ -34,7 +34,7 @@ enum v4l2_async_match_type {
};
/**
* struct v4l2_async_match_desc - async sub-device match information
* struct v4l2_async_match_desc - async connection match information
*
* @type: type of match that will be used
* @fwnode: pointer to &struct fwnode_handle to be matched.
@@ -62,21 +62,21 @@ struct v4l2_async_match_desc {
};
/**
* struct v4l2_async_subdev - sub-device descriptor, as known to a bridge
* struct v4l2_async_connection - connection descriptor, as known to a bridge
*
* @match: struct of match type and per-bus type matching data sets
* @asd_entry: used to add struct v4l2_async_subdev objects to the
* master notifier @asd_list
* @waiting_entry: used to link struct v4l2_async_subdev objects, waiting to be
* probed, to a notifier->waiting_list list
* @asc_entry: used to add struct v4l2_async_connection objects to the
* master notifier @asc_list
* @waiting_entry: used to link struct v4l2_async_connection objects, waiting to
* be probed, to a notifier->waiting_list list
*
* When this struct is used as a member in a driver specific struct,
* the driver specific struct shall contain the &struct
* v4l2_async_subdev as its first member.
* v4l2_async_connection as its first member.
*/
struct v4l2_async_subdev {
struct v4l2_async_connection {
struct v4l2_async_match_desc match;
struct list_head asd_entry;
struct list_head asc_entry;
struct list_head waiting_entry;
};
@@ -86,17 +86,17 @@ struct v4l2_async_subdev {
* @complete: All subdevices have been probed successfully. The complete
* callback is only executed for the root notifier.
* @unbind: a subdevice is leaving
* @destroy: the asd is about to be freed
* @destroy: the asc is about to be freed
*/
struct v4l2_async_notifier_operations {
int (*bound)(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_subdev *asd);
struct v4l2_async_connection *asc);
int (*complete)(struct v4l2_async_notifier *notifier);
void (*unbind)(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_subdev *asd);
void (*destroy)(struct v4l2_async_subdev *asd);
struct v4l2_async_connection *asc);
void (*destroy)(struct v4l2_async_connection *asc);
};
/**
@@ -106,8 +106,9 @@ struct v4l2_async_notifier_operations {
* @v4l2_dev: v4l2_device of the root notifier, NULL otherwise
* @sd: sub-device that registered the notifier, NULL otherwise
* @parent: parent notifier
* @asd_list: master list of struct v4l2_async_subdev
* @waiting_list: list of struct v4l2_async_subdev, waiting for their drivers
* @asc_list: master list of struct v4l2_async_connection
* @waiting_list: list of struct v4l2_async_connection, waiting for their
* drivers
* @done_list: list of struct v4l2_subdev, already probed
* @notifier_entry: member in a global list of notifiers
*/
@@ -116,7 +117,7 @@ struct v4l2_async_notifier {
struct v4l2_device *v4l2_dev;
struct v4l2_subdev *sd;
struct v4l2_async_notifier *parent;
struct list_head asd_list;
struct list_head asc_list;
struct list_head waiting_list;
struct list_head done_list;
struct list_head notifier_entry;
@@ -134,53 +135,53 @@ void v4l2_async_debug_init(struct dentry *debugfs_dir);
*
* @notifier: pointer to &struct v4l2_async_notifier
*
* This function initializes the notifier @asd_list. It must be called
* This function initializes the notifier @asc_list. It must be called
* before adding a subdevice to a notifier, using one of:
* v4l2_async_nf_add_fwnode_remote(), v4l2_async_nf_add_fwnode() or
* v4l2_async_nf_add_i2c().
*/
void v4l2_async_nf_init(struct v4l2_async_notifier *notifier);
struct v4l2_async_subdev *
struct v4l2_async_connection *
__v4l2_async_nf_add_fwnode(struct v4l2_async_notifier *notifier,
struct fwnode_handle *fwnode,
unsigned int asd_struct_size);
unsigned int asc_struct_size);
/**
* v4l2_async_nf_add_fwnode - Allocate and add a fwnode async
* subdev to the notifier's master asd_list.
* subdev to the notifier's master asc_list.
*
* @notifier: pointer to &struct v4l2_async_notifier
* @fwnode: fwnode handle of the sub-device to be matched, pointer to
* &struct fwnode_handle
* @type: Type of the driver's async sub-device struct. The &struct
* v4l2_async_subdev shall be the first member of the driver's async
* sub-device struct, i.e. both begin at the same memory address.
* @type: Type of the driver's async sub-device or connection struct. The
* &struct v4l2_async_connection shall be the first member of the
* driver's async struct, i.e. both begin at the same memory address.
*
* Allocate a fwnode-matched asd of size asd_struct_size, and add it to the
* notifiers @asd_list. The function also gets a reference of the fwnode which
* Allocate a fwnode-matched asc of size asc_struct_size, and add it to the
* notifiers @asc_list. The function also gets a reference of the fwnode which
* is released later at notifier cleanup time.
*/
#define v4l2_async_nf_add_fwnode(notifier, fwnode, type) \
((type *)__v4l2_async_nf_add_fwnode(notifier, fwnode, sizeof(type)))
struct v4l2_async_subdev *
struct v4l2_async_connection *
__v4l2_async_nf_add_fwnode_remote(struct v4l2_async_notifier *notif,
struct fwnode_handle *endpoint,
unsigned int asd_struct_size);
unsigned int asc_struct_size);
/**
* v4l2_async_nf_add_fwnode_remote - Allocate and add a fwnode
* remote async subdev to the
* notifier's master asd_list.
* notifier's master asc_list.
*
* @notifier: pointer to &struct v4l2_async_notifier
* @ep: local endpoint pointing to the remote sub-device to be matched,
* @ep: local endpoint pointing to the remote connection to be matched,
* pointer to &struct fwnode_handle
* @type: Type of the driver's async sub-device struct. The &struct
* v4l2_async_subdev shall be the first member of the driver's async
* sub-device struct, i.e. both begin at the same memory address.
* @type: Type of the driver's async connection struct. The &struct
* v4l2_async_connection shall be the first member of the driver's async
* connection struct, i.e. both begin at the same memory address.
*
* Gets the remote endpoint of a given local endpoint, set it up for fwnode
* matching and adds the async sub-device to the notifier's @asd_list. The
* matching and adds the async connection to the notifier's @asc_list. The
* function also gets a reference of the fwnode which is released later at
* notifier cleanup time.
*
@@ -190,23 +191,23 @@ __v4l2_async_nf_add_fwnode_remote(struct v4l2_async_notifier *notif,
#define v4l2_async_nf_add_fwnode_remote(notifier, ep, type) \
((type *)__v4l2_async_nf_add_fwnode_remote(notifier, ep, sizeof(type)))
struct v4l2_async_subdev *
struct v4l2_async_connection *
__v4l2_async_nf_add_i2c(struct v4l2_async_notifier *notifier,
int adapter_id, unsigned short address,
unsigned int asd_struct_size);
unsigned int asc_struct_size);
/**
* v4l2_async_nf_add_i2c - Allocate and add an i2c async
* subdev to the notifier's master asd_list.
* subdev to the notifier's master asc_list.
*
* @notifier: pointer to &struct v4l2_async_notifier
* @adapter: I2C adapter ID to be matched
* @address: I2C address of sub-device to be matched
* @type: Type of the driver's async sub-device struct. The &struct
* v4l2_async_subdev shall be the first member of the driver's async
* sub-device struct, i.e. both begin at the same memory address.
* @address: I2C address of connection to be matched
* @type: Type of the driver's async connection struct. The &struct
* v4l2_async_connection shall be the first member of the driver's async
* connection struct, i.e. both begin at the same memory address.
*
* Same as v4l2_async_nf_add_fwnode() but for I2C matched
* sub-devices.
* connections.
*/
#define v4l2_async_nf_add_i2c(notifier, adapter, address, type) \
((type *)__v4l2_async_nf_add_i2c(notifier, adapter, address, \
@@ -244,7 +245,7 @@ void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier);
* @notifier: the notifier the resources of which are to be cleaned up
*
* Release memory resources related to a notifier, including the async
* sub-devices allocated for the purposes of the notifier but not the notifier
* connections allocated for the purposes of the notifier but not the notifier
* itself. The user is responsible for calling this function to clean up the
* notifier after calling v4l2_async_nf_add_fwnode_remote(),
* v4l2_async_nf_add_fwnode() or v4l2_async_nf_add_i2c().