/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
    V4L2 device support header.

    Copyright (C) 2008  Hans Verkuil <hverkuil@xs4all.nl>

 */

#ifndef _V4L2_DEVICE_H
#define _V4L2_DEVICE_H

#include <media/media-device.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-dev.h>

struct v4l2_ctrl_handler;

/**
 * struct v4l2_device - main struct to for V4L2 device drivers
 *
 * @dev: pointer to struct device.
 * @mdev: pointer to struct media_device, may be NULL.
 * @subdevs: used to keep track of the registered subdevs
 * @lock: lock this struct; can be used by the driver as well
 *	if this struct is embedded into a larger struct.
 * @name: unique device name, by default the driver name + bus ID
 * @notify: notify operation called by some sub-devices.
 * @ctrl_handler: The control handler. May be %NULL.
 * @prio: Device's priority state
 * @ref: Keep track of the references to this struct.
 * @release: Release function that is called when the ref count
 *	goes to 0.
 *
 * Each instance of a V4L2 device should create the v4l2_device struct,
 * either stand-alone or embedded in a larger struct.
 *
 * It allows easy access to sub-devices (see v4l2-subdev.h) and provides
 * basic V4L2 device-level support.
 *
 * .. note::
 *
 *    #) @dev->driver_data points to this struct.
 *    #) @dev might be %NULL if there is no parent device
 */
struct v4l2_device {
	struct device *dev;
	struct media_device *mdev;
	struct list_head subdevs;
	spinlock_t lock;
	char name[36];
	void (*notify)(struct v4l2_subdev *sd,
			unsigned int notification, void *arg);
	struct v4l2_ctrl_handler *ctrl_handler;
	struct v4l2_prio_state prio;
	struct kref ref;
	void (*release)(struct v4l2_device *v4l2_dev);
};

/**
 * v4l2_device_get - gets a V4L2 device reference
 *
 * @v4l2_dev: pointer to struct &v4l2_device
 *
 * This is an ancillary routine meant to increment the usage for the
 * struct &v4l2_device pointed by @v4l2_dev.
 */
static inline void v4l2_device_get(struct v4l2_device *v4l2_dev)
{
	kref_get(&v4l2_dev->ref);
}

/**
 * v4l2_device_put - puts a V4L2 device reference
 *
 * @v4l2_dev: pointer to struct &v4l2_device
 *
 * This is an ancillary routine meant to decrement the usage for the
 * struct &v4l2_device pointed by @v4l2_dev.
 */
int v4l2_device_put(struct v4l2_device *v4l2_dev);

/**
 * v4l2_device_register - Initialize v4l2_dev and make @dev->driver_data
 *	point to @v4l2_dev.
 *
 * @dev: pointer to struct &device
 * @v4l2_dev: pointer to struct &v4l2_device
 *
 * .. note::
 *	@dev may be %NULL in rare cases (ISA devices).
 *	In such case the caller must fill in the @v4l2_dev->name field
 *	before calling this function.
 */
int __must_check v4l2_device_register(struct device *dev,
				      struct v4l2_device *v4l2_dev);

/**
 * v4l2_device_set_name - Optional function to initialize the
 *	name field of struct &v4l2_device
 *
 * @v4l2_dev: pointer to struct &v4l2_device
 * @basename: base name for the device name
 * @instance: pointer to a static atomic_t var with the instance usage for
 *	the device driver.
 *
 * v4l2_device_set_name() initializes the name field of struct &v4l2_device
 * using the driver name and a driver-global atomic_t instance.
 *
 * This function will increment the instance counter and returns the
 * instance value used in the name.
 *
 * Example:
 *
 *   static atomic_t drv_instance = ATOMIC_INIT(0);
 *
 *   ...
 *
 *   instance = v4l2_device_set_name(&\ v4l2_dev, "foo", &\ drv_instance);
 *
 * The first time this is called the name field will be set to foo0 and
 * this function returns 0. If the name ends with a digit (e.g. cx18),
 * then the name will be set to cx18-0 since cx180 would look really odd.
 */
int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
			 atomic_t *instance);

/**
 * v4l2_device_disconnect - Change V4L2 device state to disconnected.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 *
 * Should be called when the USB parent disconnects.
 * Since the parent disappears, this ensures that @v4l2_dev doesn't have
 * an invalid parent pointer.
 *
 * .. note:: This function sets @v4l2_dev->dev to NULL.
 */
void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);

/**
 *  v4l2_device_unregister - Unregister all sub-devices and any other
 *	 resources related to @v4l2_dev.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 */
void v4l2_device_unregister(struct v4l2_device *v4l2_dev);

/**
 * v4l2_device_register_subdev - Registers a subdev with a v4l2 device.
 *
 * @v4l2_dev: pointer to struct &v4l2_device
 * @sd: pointer to &struct v4l2_subdev
 *
 * While registered, the subdev module is marked as in-use.
 *
 * An error is returned if the module is no longer loaded on any attempts
 * to register it.
 */
#define v4l2_device_register_subdev(v4l2_dev, sd) \
	__v4l2_device_register_subdev(v4l2_dev, sd, THIS_MODULE)
int __must_check __v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
					       struct v4l2_subdev *sd,
					       struct module *module);

/**
 * v4l2_device_unregister_subdev - Unregisters a subdev with a v4l2 device.
 *
 * @sd: pointer to &struct v4l2_subdev
 *
 * .. note ::
 *
 *	Can also be called if the subdev wasn't registered. In such
 *	case, it will do nothing.
 */
void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);

/**
 * __v4l2_device_register_subdev_nodes - Registers device nodes for
 *      all subdevs of the v4l2 device that are marked with the
 *      %V4L2_SUBDEV_FL_HAS_DEVNODE flag.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 * @read_only: subdevices read-only flag. True to register the subdevices
 *	device nodes in read-only mode, false to allow full access to the
 *	subdevice userspace API.
 */
int __must_check
__v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev,
				    bool read_only);

/**
 * v4l2_device_register_subdev_nodes - Registers subdevices device nodes with
 *	unrestricted access to the subdevice userspace operations
 *
 * Internally calls __v4l2_device_register_subdev_nodes(). See its documentation
 * for more details.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 */
static inline int __must_check
v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
{
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
	return __v4l2_device_register_subdev_nodes(v4l2_dev, false);
#else
	return 0;
#endif
}

/**
 * v4l2_device_register_ro_subdev_nodes - Registers subdevices device nodes
 *	in read-only mode
 *
 * Internally calls __v4l2_device_register_subdev_nodes(). See its documentation
 * for more details.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 */
static inline int __must_check
v4l2_device_register_ro_subdev_nodes(struct v4l2_device *v4l2_dev)
{
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
	return __v4l2_device_register_subdev_nodes(v4l2_dev, true);
#else
	return 0;
#endif
}

/**
 * v4l2_subdev_notify - Sends a notification to v4l2_device.
 *
 * @sd: pointer to &struct v4l2_subdev
 * @notification: type of notification. Please notice that the notification
 *	type is driver-specific.
 * @arg: arguments for the notification. Those are specific to each
 *	notification type.
 */
static inline void v4l2_subdev_notify(struct v4l2_subdev *sd,
				      unsigned int notification, void *arg)
{
	if (sd && sd->v4l2_dev && sd->v4l2_dev->notify)
		sd->v4l2_dev->notify(sd, notification, arg);
}

/**
 * v4l2_device_supports_requests - Test if requests are supported.
 *
 * @v4l2_dev: pointer to struct v4l2_device
 */
static inline bool v4l2_device_supports_requests(struct v4l2_device *v4l2_dev)
{
	return v4l2_dev->mdev && v4l2_dev->mdev->ops &&
	       v4l2_dev->mdev->ops->req_queue;
}

/* Helper macros to iterate over all subdevs. */

/**
 * v4l2_device_for_each_subdev - Helper macro that interates over all
 *	sub-devices of a given &v4l2_device.
 *
 * @sd: pointer that will be filled by the macro with all
 *	&struct v4l2_subdev pointer used as an iterator by the loop.
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 *
 * This macro iterates over all sub-devices owned by the @v4l2_dev device.
 * It acts as a for loop iterator and executes the next statement with
 * the @sd variable pointing to each sub-device in turn.
 */
#define v4l2_device_for_each_subdev(sd, v4l2_dev)			\
	list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)

/**
 * __v4l2_device_call_subdevs_p - Calls the specified operation for
 *	all subdevs matching the condition.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @sd: pointer that will be filled by the macro with all
 *	&struct v4l2_subdev pointer used as an iterator by the loop.
 * @cond: condition to be match
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Ignore any errors.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...)	\
	do {								\
		list_for_each_entry((sd), &(v4l2_dev)->subdevs, list)	\
			if ((cond) && (sd)->ops->o && (sd)->ops->o->f)	\
				(sd)->ops->o->f((sd) , ##args);		\
	} while (0)

/**
 * __v4l2_device_call_subdevs - Calls the specified operation for
 *	all subdevs matching the condition.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @cond: condition to be match
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Ignore any errors.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...)	\
	do {								\
		struct v4l2_subdev *__sd;				\
									\
		__v4l2_device_call_subdevs_p(v4l2_dev, __sd, cond, o,	\
						f , ##args);		\
	} while (0)

/**
 * __v4l2_device_call_subdevs_until_err_p - Calls the specified operation for
 *	all subdevs matching the condition.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @sd: pointer that will be filled by the macro with all
 *	&struct v4l2_subdev sub-devices associated with @v4l2_dev.
 * @cond: condition to be match
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Return:
 *
 * If the operation returns an error other than 0 or ``-ENOIOCTLCMD``
 * for any subdevice, then abort and return with that error code, zero
 * otherwise.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \
({									\
	long __err = 0;							\
									\
	list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) {		\
		if ((cond) && (sd)->ops->o && (sd)->ops->o->f)		\
			__err = (sd)->ops->o->f((sd) , ##args);		\
		if (__err && __err != -ENOIOCTLCMD)			\
			break;						\
	}								\
	(__err == -ENOIOCTLCMD) ? 0 : __err;				\
})

/**
 * __v4l2_device_call_subdevs_until_err - Calls the specified operation for
 *	all subdevs matching the condition.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @cond: condition to be match
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Return:
 *
 * If the operation returns an error other than 0 or ``-ENOIOCTLCMD``
 * for any subdevice, then abort and return with that error code,
 * zero otherwise.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \
({									\
	struct v4l2_subdev *__sd;					\
	__v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, cond, o,	\
						f , ##args);		\
})

/**
 * v4l2_device_call_all - Calls the specified operation for
 *	all subdevs matching the &v4l2_subdev.grp_id, as assigned
 *	by the bridge driver.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpid: &struct v4l2_subdev->grp_id group ID to match.
 *	    Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Ignore any errors.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...)		\
	do {								\
		struct v4l2_subdev *__sd;				\
									\
		__v4l2_device_call_subdevs_p(v4l2_dev, __sd,		\
			(grpid) == 0 || __sd->grp_id == (grpid), o, f ,	\
			##args);					\
	} while (0)

/**
 * v4l2_device_call_until_err - Calls the specified operation for
 *	all subdevs matching the &v4l2_subdev.grp_id, as assigned
 *	by the bridge driver, until an error occurs.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpid: &struct v4l2_subdev->grp_id group ID to match.
 *	   Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Return:
 *
 * If the operation returns an error other than 0 or ``-ENOIOCTLCMD``
 * for any subdevice, then abort and return with that error code,
 * zero otherwise.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...)	\
({									\
	struct v4l2_subdev *__sd;					\
	__v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd,		\
			(grpid) == 0 || __sd->grp_id == (grpid), o, f ,	\
			##args);					\
})

/**
 * v4l2_device_mask_call_all - Calls the specified operation for
 *	all subdevices where a group ID matches a specified bitmask.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpmsk: bitmask to be checked against &struct v4l2_subdev->grp_id
 *	    group ID to be matched. Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Ignore any errors.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define v4l2_device_mask_call_all(v4l2_dev, grpmsk, o, f, args...)	\
	do {								\
		struct v4l2_subdev *__sd;				\
									\
		__v4l2_device_call_subdevs_p(v4l2_dev, __sd,		\
			(grpmsk) == 0 || (__sd->grp_id & (grpmsk)), o,	\
			f , ##args);					\
	} while (0)

/**
 * v4l2_device_mask_call_until_err - Calls the specified operation for
 *	all subdevices where a group ID matches a specified bitmask.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpmsk: bitmask to be checked against &struct v4l2_subdev->grp_id
 *	    group ID to be matched. Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 * @args: arguments for @f.
 *
 * Return:
 *
 * If the operation returns an error other than 0 or ``-ENOIOCTLCMD``
 * for any subdevice, then abort and return with that error code,
 * zero otherwise.
 *
 * Note: subdevs cannot be added or deleted while walking
 * the subdevs list.
 */
#define v4l2_device_mask_call_until_err(v4l2_dev, grpmsk, o, f, args...) \
({									\
	struct v4l2_subdev *__sd;					\
	__v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd,		\
			(grpmsk) == 0 || (__sd->grp_id & (grpmsk)), o,	\
			f , ##args);					\
})


/**
 * v4l2_device_has_op - checks if any subdev with matching grpid has a
 *	given ops.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpid: &struct v4l2_subdev->grp_id group ID to match.
 *	   Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 */
#define v4l2_device_has_op(v4l2_dev, grpid, o, f)			\
({									\
	struct v4l2_subdev *__sd;					\
	bool __result = false;						\
	list_for_each_entry(__sd, &(v4l2_dev)->subdevs, list) {		\
		if ((grpid) && __sd->grp_id != (grpid))			\
			continue;					\
		if (v4l2_subdev_has_op(__sd, o, f)) {			\
			__result = true;				\
			break;						\
		}							\
	}								\
	__result;							\
})

/**
 * v4l2_device_mask_has_op - checks if any subdev with matching group
 *	mask has a given ops.
 *
 * @v4l2_dev: &struct v4l2_device owning the sub-devices to iterate over.
 * @grpmsk: bitmask to be checked against &struct v4l2_subdev->grp_id
 *	    group ID to be matched. Use 0 to match them all.
 * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
 *     Each element there groups a set of operations functions.
 * @f: operation function that will be called if @cond matches.
 *	The operation functions are defined in groups, according to
 *	each element at &struct v4l2_subdev_ops.
 */
#define v4l2_device_mask_has_op(v4l2_dev, grpmsk, o, f)			\
({									\
	struct v4l2_subdev *__sd;					\
	bool __result = false;						\
	list_for_each_entry(__sd, &(v4l2_dev)->subdevs, list) {		\
		if ((grpmsk) && !(__sd->grp_id & (grpmsk)))		\
			continue;					\
		if (v4l2_subdev_has_op(__sd, o, f)) {			\
			__result = true;				\
			break;						\
		}							\
	}								\
	__result;							\
})

#endif
