Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * V4L2 asynchronous subdevice registration API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef V4L2_ASYNC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define V4L2_ASYNC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct device_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct v4l2_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct v4l2_subdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) struct v4l2_async_notifier;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * enum v4l2_async_match_type - type of asynchronous subdevice logic to be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *	in order to identify a match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @V4L2_ASYNC_MATCH_CUSTOM: Match will use the logic provided by &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *	v4l2_async_subdev.match ops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * @V4L2_ASYNC_MATCH_DEVNAME: Match will use the device name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @V4L2_ASYNC_MATCH_I2C: Match will check for I2C adapter ID and address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * @V4L2_ASYNC_MATCH_FWNODE: Match will use firmware node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * This enum is used by the asyncrhronous sub-device logic to define the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * algorithm that will be used to match an asynchronous device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) enum v4l2_async_match_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	V4L2_ASYNC_MATCH_CUSTOM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	V4L2_ASYNC_MATCH_DEVNAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	V4L2_ASYNC_MATCH_I2C,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	V4L2_ASYNC_MATCH_FWNODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * struct v4l2_async_subdev - sub-device descriptor, as known to a bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * @match_type:	type of match that will be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * @match:	union of per-bus type matching data sets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @match.fwnode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *		pointer to &struct fwnode_handle to be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  *		Used if @match_type is %V4L2_ASYNC_MATCH_FWNODE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * @match.device_name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  *		string containing the device name to be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  *		Used if @match_type is %V4L2_ASYNC_MATCH_DEVNAME.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * @match.i2c:	embedded struct with I2C parameters to be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  *		Both @match.i2c.adapter_id and @match.i2c.address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  *		should be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  *		Used if @match_type is %V4L2_ASYNC_MATCH_I2C.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * @match.i2c.adapter_id:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  *		I2C adapter ID to be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  *		Used if @match_type is %V4L2_ASYNC_MATCH_I2C.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * @match.i2c.address:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  *		I2C address to be matched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  *		Used if @match_type is %V4L2_ASYNC_MATCH_I2C.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * @match.custom:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  *		Driver-specific match criteria.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *		Used if @match_type is %V4L2_ASYNC_MATCH_CUSTOM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @match.custom.match:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *		Driver-specific match function to be used if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  *		%V4L2_ASYNC_MATCH_CUSTOM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @match.custom.priv:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  *		Driver-specific private struct with match parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  *		to be used if %V4L2_ASYNC_MATCH_CUSTOM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * @asd_list:	used to add struct v4l2_async_subdev objects to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *		master notifier @asd_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * @list:	used to link struct v4l2_async_subdev objects, waiting to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  *		probed, to a notifier->waiting list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * When this struct is used as a member in a driver specific struct,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  * the driver specific struct shall contain the &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * v4l2_async_subdev as its first member.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) struct v4l2_async_subdev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	enum v4l2_async_match_type match_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		struct fwnode_handle *fwnode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		const char *device_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			int adapter_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			unsigned short address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		} i2c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			bool (*match)(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 				      struct v4l2_async_subdev *sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		} custom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	} match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	/* v4l2-async core private: not to be used by drivers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	struct list_head asd_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * struct v4l2_async_notifier_operations - Asynchronous V4L2 notifier operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * @bound:	a subdevice driver has successfully probed one of the subdevices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * @complete:	All subdevices have been probed successfully. The complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  *		callback is only executed for the root notifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * @unbind:	a subdevice is leaving
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct v4l2_async_notifier_operations {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	int (*bound)(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		     struct v4l2_subdev *subdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		     struct v4l2_async_subdev *asd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	int (*complete)(struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	void (*unbind)(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		       struct v4l2_subdev *subdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		       struct v4l2_async_subdev *asd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * struct v4l2_async_notifier - v4l2_device notifier data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * @ops:	notifier operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * @v4l2_dev:	v4l2_device of the root notifier, NULL otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * @sd:		sub-device that registered the notifier, NULL otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * @parent:	parent notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * @asd_list:	master list of struct v4l2_async_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * @waiting:	list of struct v4l2_async_subdev, waiting for their drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * @done:	list of struct v4l2_subdev, already probed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * @list:	member in a global list of notifiers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct v4l2_async_notifier {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	const struct v4l2_async_notifier_operations *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	struct v4l2_device *v4l2_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	struct v4l2_subdev *sd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct v4l2_async_notifier *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	struct list_head asd_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	struct list_head waiting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	struct list_head done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * v4l2_async_notifier_init - Initialize a notifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * This function initializes the notifier @asd_list. It must be called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * before the first call to @v4l2_async_notifier_add_subdev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) void v4l2_async_notifier_init(struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  * v4l2_async_notifier_add_subdev - Add an async subdev to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  *				notifier's master asd list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  * @asd: pointer to &struct v4l2_async_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * Call this function before registering a notifier to link the provided @asd to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * the notifiers master @asd_list. The @asd must be allocated with k*alloc() as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * it will be freed by the framework when the notifier is destroyed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int v4l2_async_notifier_add_subdev(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 				   struct v4l2_async_subdev *asd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * v4l2_async_notifier_add_fwnode_subdev - Allocate and add a fwnode async
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *				subdev to the notifier's master asd_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * @fwnode: fwnode handle of the sub-device to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * @asd_struct_size: size of the driver's async sub-device struct, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  *		     sizeof(struct v4l2_async_subdev). The &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *		     v4l2_async_subdev shall be the first member of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *		     the driver's async sub-device struct, i.e. both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  *		     begin at the same memory address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * Allocate a fwnode-matched asd of size asd_struct_size, and add it to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  * notifiers @asd_list. The function also gets a reference of the fwnode which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * is released later at notifier cleanup time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct v4l2_async_subdev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) v4l2_async_notifier_add_fwnode_subdev(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				      struct fwnode_handle *fwnode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				      unsigned int asd_struct_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * v4l2_async_notifier_add_fwnode_remote_subdev - Allocate and add a fwnode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  *						  remote async subdev to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  *						  notifier's master asd_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * @notif: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * @endpoint: local endpoint pointing to the remote sub-device to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * @asd_struct_size: size of the driver's async sub-device struct, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  *		     sizeof(struct v4l2_async_subdev). The &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  *		     v4l2_async_subdev shall be the first member of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  *		     the driver's async sub-device struct, i.e. both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  *		     begin at the same memory address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * Gets the remote endpoint of a given local endpoint, set it up for fwnode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * matching and adds the async sub-device to the notifier's @asd_list. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * function also gets a reference of the fwnode which is released later at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * notifier cleanup time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  * This is just like @v4l2_async_notifier_add_fwnode_subdev, but with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * exception that the fwnode refers to a local endpoint, not the remote one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct v4l2_async_subdev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) v4l2_async_notifier_add_fwnode_remote_subdev(struct v4l2_async_notifier *notif,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 					     struct fwnode_handle *endpoint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 					     unsigned int asd_struct_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * v4l2_async_notifier_add_i2c_subdev - Allocate and add an i2c async
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  *				subdev to the notifier's master asd_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * @adapter_id: I2C adapter ID to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  * @address: I2C address of sub-device to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  * @asd_struct_size: size of the driver's async sub-device struct, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  *		     sizeof(struct v4l2_async_subdev). The &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  *		     v4l2_async_subdev shall be the first member of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  *		     the driver's async sub-device struct, i.e. both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  *		     begin at the same memory address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * Same as above but for I2C matched sub-devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct v4l2_async_subdev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) v4l2_async_notifier_add_i2c_subdev(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 				   int adapter_id, unsigned short address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				   unsigned int asd_struct_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * v4l2_async_notifier_add_devname_subdev - Allocate and add a device-name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *				async subdev to the notifier's master asd_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  * @device_name: device name string to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * @asd_struct_size: size of the driver's async sub-device struct, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  *		     sizeof(struct v4l2_async_subdev). The &struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  *		     v4l2_async_subdev shall be the first member of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  *		     the driver's async sub-device struct, i.e. both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  *		     begin at the same memory address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  * Same as above but for device-name matched sub-devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct v4l2_async_subdev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) v4l2_async_notifier_add_devname_subdev(struct v4l2_async_notifier *notifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 				       const char *device_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 				       unsigned int asd_struct_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  * v4l2_async_notifier_register - registers a subdevice asynchronous notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * @v4l2_dev: pointer to &struct v4l2_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 				 struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  * v4l2_async_subdev_notifier_register - registers a subdevice asynchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  *					 notifier for a sub-device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * @sd: pointer to &struct v4l2_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 					struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * v4l2_async_notifier_clr_unready_dev - remove unready subdevice
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #if IS_ENABLED(CONFIG_NO_GKI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) int v4l2_async_notifier_clr_unready_dev(struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) v4l2_async_notifier_clr_unready_dev(struct v4l2_async_notifier *notifier)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * v4l2_async_notifier_unregister - unregisters a subdevice
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *	asynchronous notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * @notifier: pointer to &struct v4l2_async_notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * v4l2_async_notifier_cleanup - clean up notifier resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * @notifier: the notifier the resources of which are to be cleaned up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  * Release memory resources related to a notifier, including the async
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  * sub-devices allocated for the purposes of the notifier but not the notifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * itself. The user is responsible for calling this function to clean up the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  * notifier after calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * @v4l2_async_notifier_add_subdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  * @v4l2_async_notifier_parse_fwnode_endpoints or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  * @v4l2_fwnode_reference_parse_sensor_common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  * There is no harm from calling v4l2_async_notifier_cleanup in other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  * cases as long as its memory has been zeroed after it has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * allocated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * v4l2_async_register_subdev - registers a sub-device to the asynchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  *	subdevice framework
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * @sd: pointer to &struct v4l2_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) int v4l2_async_register_subdev(struct v4l2_subdev *sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * v4l2_async_register_subdev_sensor_common - registers a sensor sub-device to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  *					      the asynchronous sub-device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  *					      framework and parse set up common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  *					      sensor related devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * @sd: pointer to struct &v4l2_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * This function is just like v4l2_async_register_subdev() with the exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * that calling it will also parse firmware interfaces for remote references
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  * using v4l2_async_notifier_parse_fwnode_sensor_common() and registers the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  * async sub-devices. The sub-device is similarly unregistered by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  * v4l2_async_unregister_subdev().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)  * While registered, the subdev module is marked as in-use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  * An error is returned if the module is no longer loaded on any attempts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * to register it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) int __must_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)  * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  *	subdevice framework
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * @sd: pointer to &struct v4l2_subdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) void v4l2_async_unregister_subdev(struct v4l2_subdev *sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) #endif