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+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * media-dev-allocator.h - Media Controller Device Allocator API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2019 Shuah Khan <shuah@kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Credits: Suggested by Laurent Pinchart <laurent.pinchart@ideasonboard.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * This file adds a global ref-counted Media Controller Device Instance API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * A system wide global media device list is managed and each media device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * includes a kref count. The last put on the media device releases the media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * device instance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #ifndef _MEDIA_DEV_ALLOCATOR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define _MEDIA_DEV_ALLOCATOR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct usb_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #if defined(CONFIG_MEDIA_CONTROLLER) && IS_ENABLED(CONFIG_USB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * media_device_usb_allocate() - Allocate and return struct &media device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * @udev:		struct &usb_device pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * @module_name:	should be filled with %KBUILD_MODNAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  * @owner:		struct module pointer %THIS_MODULE for the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  *			%THIS_MODULE is null for a built-in driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  *			It is safe even when %THIS_MODULE is null.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  * This interface should be called to allocate a Media Device when multiple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  * drivers share usb_device and the media device. This interface allocates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  * &media_device structure and calls media_device_usb_init() to initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  * it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct media_device *media_device_usb_allocate(struct usb_device *udev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 					       const char *module_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 					       struct module *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)  * media_device_delete() - Release media device. Calls kref_put().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)  * @mdev:		struct &media_device pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  * @module_name:	should be filled with %KBUILD_MODNAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  * @owner:		struct module pointer %THIS_MODULE for the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  *			%THIS_MODULE is null for a built-in driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  *			It is safe even when %THIS_MODULE is null.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)  * This interface should be called to put Media Device Instance kref.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void media_device_delete(struct media_device *mdev, const char *module_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 			 struct module *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline struct media_device *media_device_usb_allocate(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			struct usb_device *udev, const char *module_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 			struct module *owner)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 			{ return NULL; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static inline void media_device_delete(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 			struct media_device *mdev, const char *module_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 			struct module *owner) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* CONFIG_MEDIA_CONTROLLER && CONFIG_USB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif /* _MEDIA_DEV_ALLOCATOR_H */