diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2016-02-11 21:41:21 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-27 08:33:25 -0300 |
commit | afcbdb55898b469606220fcb1868fc1bdd859675 (patch) | |
tree | 51a093b6649cf3e86e7d50f0b6faebdf27647435 /include/media | |
parent | 7a2eba12ff071dbc8e84ff4c2208d9f8bbb0046a (diff) | |
download | linux-afcbdb55898b469606220fcb1868fc1bdd859675.tar.gz linux-afcbdb55898b469606220fcb1868fc1bdd859675.tar.bz2 linux-afcbdb55898b469606220fcb1868fc1bdd859675.zip |
[media] media: Media Controller register/unregister entity_notify API
Add new interfaces to register and unregister entity_notify
hook to media device. These interfaces allow drivers to add
hooks to take appropriate actions when new entities get added
to a shared media device. For example, au0828 bridge driver
registers an entity_notify hook to create links as needed
between media graph nodes.
[mchehab@osg.samsung.com: simple comments should be /* and not /**]
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/media-device.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/media/media-device.h b/include/media/media-device.h index 49dda6c7e664..5436c954281b 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -265,6 +265,22 @@ struct ida; struct device; /** + * struct media_entity_notify - Media Entity Notify + * + * @list: List head + * @notify_data: Input data to invoke the callback + * @notify: Callback function pointer + * + * Drivers may register a callback to take action when + * new entities get registered with the media device. + */ +struct media_entity_notify { + struct list_head list; + void *notify_data; + void (*notify)(struct media_entity *entity, void *notify_data); +}; + +/** * struct media_device - Media device * @dev: Parent device * @devnode: Media device node @@ -287,6 +303,7 @@ struct device; * @interfaces: List of registered interfaces * @pads: List of registered pads * @links: List of registered links + * @entity_notify: List of registered entity_notify callbacks * @lock: Entities list lock * @graph_mutex: Entities graph operation lock * @link_notify: Link state change notification callback @@ -324,6 +341,9 @@ struct media_device { struct list_head pads; struct list_head links; + /* notify callback list invoked when a new entity is registered */ + struct list_head entity_notify; + /* Protects the graph objects creation/removal */ spinlock_t lock; /* Serializes graph operations. */ @@ -507,6 +527,31 @@ int __must_check media_device_register_entity(struct media_device *mdev, void media_device_unregister_entity(struct media_entity *entity); /** + * media_device_register_entity_notify() - Registers a media entity_notify + * callback + * + * @mdev: The media device + * @nptr: The media_entity_notify + * + * Note: When a new entity is registered, all the registered + * media_entity_notify callbacks are invoked. + */ + +int __must_check media_device_register_entity_notify(struct media_device *mdev, + struct media_entity_notify *nptr); + +/** + * media_device_unregister_entity_notify() - Unregister a media entity notify + * callback + * + * @mdev: The media device + * @nptr: The media_entity_notify + * + */ +void media_device_unregister_entity_notify(struct media_device *mdev, + struct media_entity_notify *nptr); + +/** * media_device_get_devres() - get media device as device resource * creates if one doesn't exist * @@ -594,6 +639,17 @@ static inline int media_device_register_entity(struct media_device *mdev, static inline void media_device_unregister_entity(struct media_entity *entity) { } +static inline int media_device_register_entity_notify( + struct media_device *mdev, + struct media_entity_notify *nptr) +{ + return 0; +} +static inline void media_device_unregister_entity_notify( + struct media_device *mdev, + struct media_entity_notify *nptr) +{ +} static inline struct media_device *media_device_get_devres(struct device *dev) { return NULL; |