diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-08-29 15:09:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-09 08:28:55 -0400 |
commit | 48a7c4bac94dfb367d1d64123b5182536912c03e (patch) | |
tree | f52da0344a4a9af35872a4fa06dd7a21b2470fcf /include/media | |
parent | 36aefa35f4bfab4c40f2445864e4fcb445d0d09d (diff) |
[media] docs-rst: improve the kAPI documentation for the mediactl
There are several issues on the documentation:
- the media.h header were not properly referenced;
- verbatim expressions were not properly marked as such;
- struct member references were wrong;
- some notes were not using the right markup;
- a comment that were moved to the kernel-doc markup were
duplicated as a comment inside the struct media_entity;
- some args were not pointing to the struct they're using;
- macros weren't documented.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/media-device.h | 115 | ||||
-rw-r--r-- | include/media/media-devnode.h | 2 | ||||
-rw-r--r-- | include/media/media-entity.h | 237 |
3 files changed, 231 insertions, 123 deletions
diff --git a/include/media/media-device.h b/include/media/media-device.h index 28195242386c..481dd6c672cb 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h | |||
@@ -53,7 +53,7 @@ struct media_entity_notify { | |||
53 | * @dev: Parent device | 53 | * @dev: Parent device |
54 | * @devnode: Media device node | 54 | * @devnode: Media device node |
55 | * @driver_name: Optional device driver name. If not set, calls to | 55 | * @driver_name: Optional device driver name. If not set, calls to |
56 | * %MEDIA_IOC_DEVICE_INFO will return dev->driver->name. | 56 | * %MEDIA_IOC_DEVICE_INFO will return ``dev->driver->name``. |
57 | * This is needed for USB drivers for example, as otherwise | 57 | * This is needed for USB drivers for example, as otherwise |
58 | * they'll all appear as if the driver name was "usb". | 58 | * they'll all appear as if the driver name was "usb". |
59 | * @model: Device model name | 59 | * @model: Device model name |
@@ -102,16 +102,18 @@ struct media_entity_notify { | |||
102 | * sink entity and deactivate the link between them. Drivers | 102 | * sink entity and deactivate the link between them. Drivers |
103 | * should call this handler to release the source. | 103 | * should call this handler to release the source. |
104 | * | 104 | * |
105 | * Note: Bridge driver is expected to implement and set the | ||
106 | * handler when media_device is registered or when | ||
107 | * bridge driver finds the media_device during probe. | ||
108 | * Bridge driver sets source_priv with information | ||
109 | * necessary to run enable/disable source handlers. | ||
110 | * | ||
111 | * Use-case: find tuner entity connected to the decoder | 105 | * Use-case: find tuner entity connected to the decoder |
112 | * entity and check if it is available, and activate the | 106 | * entity and check if it is available, and activate the |
113 | * the link between them from enable_source and deactivate | 107 | * the link between them from @enable_source and deactivate |
114 | * from disable_source. | 108 | * from @disable_source. |
109 | * | ||
110 | * .. note:: | ||
111 | * | ||
112 | * Bridge driver is expected to implement and set the | ||
113 | * handler when &media_device is registered or when | ||
114 | * bridge driver finds the media_device during probe. | ||
115 | * Bridge driver sets source_priv with information | ||
116 | * necessary to run @enable_source and @disable_source handlers. | ||
115 | */ | 117 | */ |
116 | struct media_device { | 118 | struct media_device { |
117 | /* dev->driver_data points to this struct. */ | 119 | /* dev->driver_data points to this struct. */ |
@@ -168,7 +170,7 @@ struct usb_device; | |||
168 | * @ent_enum: Entity enumeration to be initialised | 170 | * @ent_enum: Entity enumeration to be initialised |
169 | * @mdev: The related media device | 171 | * @mdev: The related media device |
170 | * | 172 | * |
171 | * Returns zero on success or a negative error code. | 173 | * Return: zero on success or a negative error code. |
172 | */ | 174 | */ |
173 | static inline __must_check int media_entity_enum_init( | 175 | static inline __must_check int media_entity_enum_init( |
174 | struct media_entity_enum *ent_enum, struct media_device *mdev) | 176 | struct media_entity_enum *ent_enum, struct media_device *mdev) |
@@ -211,36 +213,38 @@ void media_device_cleanup(struct media_device *mdev); | |||
211 | * | 213 | * |
212 | * Users, should, instead, call the media_device_register() macro. | 214 | * Users, should, instead, call the media_device_register() macro. |
213 | * | 215 | * |
214 | * The caller is responsible for initializing the media_device structure before | 216 | * The caller is responsible for initializing the &media_device structure |
215 | * registration. The following fields must be set: | 217 | * before registration. The following fields of &media_device must be set: |
216 | * | 218 | * |
217 | * - dev must point to the parent device (usually a &pci_dev, &usb_interface or | 219 | * - &media_entity.dev must point to the parent device (usually a &pci_dev, |
218 | * &platform_device instance). | 220 | * &usb_interface or &platform_device instance). |
219 | * | 221 | * |
220 | * - model must be filled with the device model name as a NUL-terminated UTF-8 | 222 | * - &media_entity.model must be filled with the device model name as a |
221 | * string. The device/model revision must not be stored in this field. | 223 | * NUL-terminated UTF-8 string. The device/model revision must not be |
224 | * stored in this field. | ||
222 | * | 225 | * |
223 | * The following fields are optional: | 226 | * The following fields are optional: |
224 | * | 227 | * |
225 | * - serial is a unique serial number stored as a NUL-terminated ASCII string. | 228 | * - &media_entity.serial is a unique serial number stored as a |
226 | * The field is big enough to store a GUID in text form. If the hardware | 229 | * NUL-terminated ASCII string. The field is big enough to store a GUID |
227 | * doesn't provide a unique serial number this field must be left empty. | 230 | * in text form. If the hardware doesn't provide a unique serial number |
231 | * this field must be left empty. | ||
228 | * | 232 | * |
229 | * - bus_info represents the location of the device in the system as a | 233 | * - &media_entity.bus_info represents the location of the device in the |
230 | * NUL-terminated ASCII string. For PCI/PCIe devices bus_info must be set to | 234 | * system as a NUL-terminated ASCII string. For PCI/PCIe devices |
231 | * "PCI:" (or "PCIe:") followed by the value of pci_name(). For USB devices, | 235 | * &media_entity.bus_info must be set to "PCI:" (or "PCIe:") followed by |
232 | * the usb_make_path() function must be used. This field is used by | 236 | * the value of pci_name(). For USB devices,the usb_make_path() function |
233 | * applications to distinguish between otherwise identical devices that don't | 237 | * must be used. This field is used by applications to distinguish between |
234 | * provide a serial number. | 238 | * otherwise identical devices that don't provide a serial number. |
235 | * | 239 | * |
236 | * - hw_revision is the hardware device revision in a driver-specific format. | 240 | * - &media_entity.hw_revision is the hardware device revision in a |
237 | * When possible the revision should be formatted with the KERNEL_VERSION | 241 | * driver-specific format. When possible the revision should be formatted |
238 | * macro. | 242 | * with the KERNEL_VERSION() macro. |
239 | * | 243 | * |
240 | * - driver_version is formatted with the KERNEL_VERSION macro. The version | 244 | * - &media_entity.driver_version is formatted with the KERNEL_VERSION() |
241 | * minor must be incremented when new features are added to the userspace API | 245 | * macro. The version minor must be incremented when new features are added |
242 | * without breaking binary compatibility. The version major must be | 246 | * to the userspace API without breaking binary compatibility. The version |
243 | * incremented when binary compatibility is broken. | 247 | * major must be incremented when binary compatibility is broken. |
244 | * | 248 | * |
245 | * .. note:: | 249 | * .. note:: |
246 | * | 250 | * |
@@ -252,6 +256,16 @@ void media_device_cleanup(struct media_device *mdev); | |||
252 | */ | 256 | */ |
253 | int __must_check __media_device_register(struct media_device *mdev, | 257 | int __must_check __media_device_register(struct media_device *mdev, |
254 | struct module *owner); | 258 | struct module *owner); |
259 | |||
260 | |||
261 | /** | ||
262 | * media_device_register() - Registers a media device element | ||
263 | * | ||
264 | * @mdev: pointer to struct &media_device | ||
265 | * | ||
266 | * This macro calls __media_device_register() passing %THIS_MODULE as | ||
267 | * the __media_device_register() second argument (**owner**). | ||
268 | */ | ||
255 | #define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE) | 269 | #define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE) |
256 | 270 | ||
257 | /** | 271 | /** |
@@ -259,7 +273,6 @@ int __must_check __media_device_register(struct media_device *mdev, | |||
259 | * | 273 | * |
260 | * @mdev: pointer to struct &media_device | 274 | * @mdev: pointer to struct &media_device |
261 | * | 275 | * |
262 | * | ||
263 | * It is safe to call this function on an unregistered (but initialised) | 276 | * It is safe to call this function on an unregistered (but initialised) |
264 | * media device. | 277 | * media device. |
265 | */ | 278 | */ |
@@ -285,14 +298,15 @@ void media_device_unregister(struct media_device *mdev); | |||
285 | * framework. | 298 | * framework. |
286 | * | 299 | * |
287 | * If the device has pads, media_entity_pads_init() should be called before | 300 | * If the device has pads, media_entity_pads_init() should be called before |
288 | * this function. Otherwise, the &media_entity.@pad and &media_entity.@num_pads | 301 | * this function. Otherwise, the &media_entity.pad and &media_entity.num_pads |
289 | * should be zeroed before calling this function. | 302 | * should be zeroed before calling this function. |
290 | * | 303 | * |
291 | * Entities have flags that describe the entity capabilities and state: | 304 | * Entities have flags that describe the entity capabilities and state: |
292 | * | 305 | * |
293 | * %MEDIA_ENT_FL_DEFAULT indicates the default entity for a given type. | 306 | * %MEDIA_ENT_FL_DEFAULT |
294 | * This can be used to report the default audio and video devices or the | 307 | * indicates the default entity for a given type. |
295 | * default camera sensor. | 308 | * This can be used to report the default audio and video devices or the |
309 | * default camera sensor. | ||
296 | * | 310 | * |
297 | * .. note:: | 311 | * .. note:: |
298 | * | 312 | * |
@@ -331,8 +345,10 @@ void media_device_unregister_entity(struct media_entity *entity); | |||
331 | * @mdev: The media device | 345 | * @mdev: The media device |
332 | * @nptr: The media_entity_notify | 346 | * @nptr: The media_entity_notify |
333 | * | 347 | * |
334 | * Note: When a new entity is registered, all the registered | 348 | * .. note:: |
335 | * media_entity_notify callbacks are invoked. | 349 | * |
350 | * When a new entity is registered, all the registered | ||
351 | * media_entity_notify callbacks are invoked. | ||
336 | */ | 352 | */ |
337 | 353 | ||
338 | int __must_check media_device_register_entity_notify(struct media_device *mdev, | 354 | int __must_check media_device_register_entity_notify(struct media_device *mdev, |
@@ -410,11 +426,13 @@ void media_device_pci_init(struct media_device *mdev, | |||
410 | * @board_name: media device name. If %NULL, the routine will use the usb | 426 | * @board_name: media device name. If %NULL, the routine will use the usb |
411 | * product name, if available. | 427 | * product name, if available. |
412 | * @driver_name: name of the driver. if %NULL, the routine will use the name | 428 | * @driver_name: name of the driver. if %NULL, the routine will use the name |
413 | * given by udev->dev->driver->name, with is usually the wrong | 429 | * given by ``udev->dev->driver->name``, with is usually the wrong |
414 | * thing to do. | 430 | * thing to do. |
415 | * | 431 | * |
416 | * NOTE: It is better to call media_device_usb_init() instead, as | 432 | * .. note:: |
417 | * such macro fills driver_name with %KBUILD_MODNAME. | 433 | * |
434 | * It is better to call media_device_usb_init() instead, as | ||
435 | * such macro fills driver_name with %KBUILD_MODNAME. | ||
418 | */ | 436 | */ |
419 | void __media_device_usb_init(struct media_device *mdev, | 437 | void __media_device_usb_init(struct media_device *mdev, |
420 | struct usb_device *udev, | 438 | struct usb_device *udev, |
@@ -472,6 +490,19 @@ static inline void __media_device_usb_init(struct media_device *mdev, | |||
472 | 490 | ||
473 | #endif /* CONFIG_MEDIA_CONTROLLER */ | 491 | #endif /* CONFIG_MEDIA_CONTROLLER */ |
474 | 492 | ||
493 | /** | ||
494 | * media_device_usb_init() - create and initialize a | ||
495 | * struct &media_device from a PCI device. | ||
496 | * | ||
497 | * @mdev: pointer to struct &media_device | ||
498 | * @udev: pointer to struct usb_device | ||
499 | * @name: media device name. If %NULL, the routine will use the usb | ||
500 | * product name, if available. | ||
501 | * | ||
502 | * This macro calls media_device_usb_init() passing the | ||
503 | * media_device_usb_init() **driver_name** parameter filled with | ||
504 | * %KBUILD_MODNAME. | ||
505 | */ | ||
475 | #define media_device_usb_init(mdev, udev, name) \ | 506 | #define media_device_usb_init(mdev, udev, name) \ |
476 | __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) | 507 | __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) |
477 | 508 | ||
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index 37d494805944..972168e90413 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h | |||
@@ -75,7 +75,7 @@ struct media_file_operations { | |||
75 | * @cdev: struct cdev pointer character device | 75 | * @cdev: struct cdev pointer character device |
76 | * @parent: parent device | 76 | * @parent: parent device |
77 | * @minor: device node minor number | 77 | * @minor: device node minor number |
78 | * @flags: flags, combination of the MEDIA_FLAG_* constants | 78 | * @flags: flags, combination of the ``MEDIA_FLAG_*`` constants |
79 | * @release: release callback called at the end of media_devnode_release() | 79 | * @release: release callback called at the end of media_devnode_release() |
80 | * | 80 | * |
81 | * This structure represents a media-related device node. | 81 | * This structure represents a media-related device node. |
diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 7bf6885dd37f..e21958c7c5d9 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h | |||
@@ -56,7 +56,7 @@ enum media_gobj_type { | |||
56 | /** | 56 | /** |
57 | * struct media_gobj - Define a graph object. | 57 | * struct media_gobj - Define a graph object. |
58 | * | 58 | * |
59 | * @mdev: Pointer to the struct media_device that owns the object | 59 | * @mdev: Pointer to the struct &media_device that owns the object |
60 | * @id: Non-zero object ID identifier. The ID should be unique | 60 | * @id: Non-zero object ID identifier. The ID should be unique |
61 | * inside a media_device, as it is composed by | 61 | * inside a media_device, as it is composed by |
62 | * %MEDIA_BITS_PER_TYPE to store the type plus | 62 | * %MEDIA_BITS_PER_TYPE to store the type plus |
@@ -162,7 +162,9 @@ struct media_link { | |||
162 | * @graph_obj: Embedded structure containing the media object common data | 162 | * @graph_obj: Embedded structure containing the media object common data |
163 | * @entity: Entity this pad belongs to | 163 | * @entity: Entity this pad belongs to |
164 | * @index: Pad index in the entity pads array, numbered from 0 to n | 164 | * @index: Pad index in the entity pads array, numbered from 0 to n |
165 | * @flags: Pad flags, as defined in uapi/media.h (MEDIA_PAD_FL_*) | 165 | * @flags: Pad flags, as defined in |
166 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
167 | * (seek for ``MEDIA_PAD_FL_*``) | ||
166 | */ | 168 | */ |
167 | struct media_pad { | 169 | struct media_pad { |
168 | struct media_gobj graph_obj; /* must be first field in struct */ | 170 | struct media_gobj graph_obj; /* must be first field in struct */ |
@@ -182,7 +184,7 @@ struct media_pad { | |||
182 | * | 184 | * |
183 | * .. note:: | 185 | * .. note:: |
184 | * | 186 | * |
185 | * Those these callbacks are called with struct media_device.@graph_mutex | 187 | * Those these callbacks are called with struct &media_device.graph_mutex |
186 | * mutex held. | 188 | * mutex held. |
187 | */ | 189 | */ |
188 | struct media_entity_operations { | 190 | struct media_entity_operations { |
@@ -210,7 +212,7 @@ struct media_entity_operations { | |||
210 | * This allows runtime type identification of media entities and safe casting to | 212 | * This allows runtime type identification of media entities and safe casting to |
211 | * the correct object type. For instance, a media entity structure instance | 213 | * the correct object type. For instance, a media entity structure instance |
212 | * embedded in a v4l2_subdev structure instance will have the type | 214 | * embedded in a v4l2_subdev structure instance will have the type |
213 | * MEDIA_ENTITY_TYPE_V4L2_SUBDEV and can safely be cast to a v4l2_subdev | 215 | * %MEDIA_ENTITY_TYPE_V4L2_SUBDEV and can safely be cast to a &v4l2_subdev |
214 | * structure using the container_of() macro. | 216 | * structure using the container_of() macro. |
215 | */ | 217 | */ |
216 | enum media_entity_type { | 218 | enum media_entity_type { |
@@ -225,9 +227,12 @@ enum media_entity_type { | |||
225 | * @graph_obj: Embedded structure containing the media object common data. | 227 | * @graph_obj: Embedded structure containing the media object common data. |
226 | * @name: Entity name. | 228 | * @name: Entity name. |
227 | * @obj_type: Type of the object that implements the media_entity. | 229 | * @obj_type: Type of the object that implements the media_entity. |
228 | * @function: Entity main function, as defined in uapi/media.h | 230 | * @function: Entity main function, as defined in |
229 | * (MEDIA_ENT_F_*) | 231 | * :ref:`include/uapi/linux/media.h <media_header>` |
230 | * @flags: Entity flags, as defined in uapi/media.h (MEDIA_ENT_FL_*) | 232 | * (seek for ``MEDIA_ENT_F_*``) |
233 | * @flags: Entity flags, as defined in | ||
234 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
235 | * (seek for ``MEDIA_ENT_FL_*``) | ||
231 | * @num_pads: Number of sink and source pads. | 236 | * @num_pads: Number of sink and source pads. |
232 | * @num_links: Total number of links, forward and back, enabled and disabled. | 237 | * @num_links: Total number of links, forward and back, enabled and disabled. |
233 | * @num_backlinks: Number of backlinks | 238 | * @num_backlinks: Number of backlinks |
@@ -246,9 +251,12 @@ enum media_entity_type { | |||
246 | * @minor: Devnode minor number (zero if not applicable). Kept just | 251 | * @minor: Devnode minor number (zero if not applicable). Kept just |
247 | * for backward compatibility. | 252 | * for backward compatibility. |
248 | * | 253 | * |
249 | * NOTE: @stream_count and @use_count reference counts must never be | 254 | * .. note:: |
250 | * negative, but are signed integers on purpose: a simple WARN_ON(<0) check | 255 | * |
251 | * can be used to detect reference count bugs that would make them negative. | 256 | * @stream_count and @use_count reference counts must never be |
257 | * negative, but are signed integers on purpose: a simple ``WARN_ON(<0)`` | ||
258 | * check can be used to detect reference count bugs that would make them | ||
259 | * negative. | ||
252 | */ | 260 | */ |
253 | struct media_entity { | 261 | struct media_entity { |
254 | struct media_gobj graph_obj; /* must be first field in struct */ | 262 | struct media_gobj graph_obj; /* must be first field in struct */ |
@@ -267,10 +275,6 @@ struct media_entity { | |||
267 | 275 | ||
268 | const struct media_entity_operations *ops; | 276 | const struct media_entity_operations *ops; |
269 | 277 | ||
270 | /* Reference counts must never be negative, but are signed integers on | ||
271 | * purpose: a simple WARN_ON(<0) check can be used to detect reference | ||
272 | * count bugs that would make them negative. | ||
273 | */ | ||
274 | int stream_count; | 278 | int stream_count; |
275 | int use_count; | 279 | int use_count; |
276 | 280 | ||
@@ -289,10 +293,16 @@ struct media_entity { | |||
289 | * | 293 | * |
290 | * @graph_obj: embedded graph object | 294 | * @graph_obj: embedded graph object |
291 | * @links: List of links pointing to graph entities | 295 | * @links: List of links pointing to graph entities |
292 | * @type: Type of the interface as defined in the | 296 | * @type: Type of the interface as defined in |
293 | * uapi/media/media.h header, e. g. | 297 | * :ref:`include/uapi/linux/media.h <media_header>` |
294 | * MEDIA_INTF_T_* | 298 | * (seek for ``MEDIA_INTF_T_*``) |
295 | * @flags: Interface flags as defined in uapi/media/media.h | 299 | * @flags: Interface flags as defined in |
300 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
301 | * (seek for ``MEDIA_INTF_FL_*``) | ||
302 | * | ||
303 | * .. note:: | ||
304 | * | ||
305 | * Currently, no flags for &media_interface is defined. | ||
296 | */ | 306 | */ |
297 | struct media_interface { | 307 | struct media_interface { |
298 | struct media_gobj graph_obj; | 308 | struct media_gobj graph_obj; |
@@ -319,7 +329,7 @@ struct media_intf_devnode { | |||
319 | /** | 329 | /** |
320 | * media_entity_id() - return the media entity graph object id | 330 | * media_entity_id() - return the media entity graph object id |
321 | * | 331 | * |
322 | * @entity: pointer to entity | 332 | * @entity: pointer to &media_entity |
323 | */ | 333 | */ |
324 | static inline u32 media_entity_id(struct media_entity *entity) | 334 | static inline u32 media_entity_id(struct media_entity *entity) |
325 | { | 335 | { |
@@ -329,7 +339,7 @@ static inline u32 media_entity_id(struct media_entity *entity) | |||
329 | /** | 339 | /** |
330 | * media_type() - return the media object type | 340 | * media_type() - return the media object type |
331 | * | 341 | * |
332 | * @gobj: pointer to the media graph object | 342 | * @gobj: Pointer to the struct &media_gobj graph object |
333 | */ | 343 | */ |
334 | static inline enum media_gobj_type media_type(struct media_gobj *gobj) | 344 | static inline enum media_gobj_type media_type(struct media_gobj *gobj) |
335 | { | 345 | { |
@@ -339,7 +349,7 @@ static inline enum media_gobj_type media_type(struct media_gobj *gobj) | |||
339 | /** | 349 | /** |
340 | * media_id() - return the media object ID | 350 | * media_id() - return the media object ID |
341 | * | 351 | * |
342 | * @gobj: pointer to the media graph object | 352 | * @gobj: Pointer to the struct &media_gobj graph object |
343 | */ | 353 | */ |
344 | static inline u32 media_id(struct media_gobj *gobj) | 354 | static inline u32 media_id(struct media_gobj *gobj) |
345 | { | 355 | { |
@@ -350,7 +360,7 @@ static inline u32 media_id(struct media_gobj *gobj) | |||
350 | * media_gobj_gen_id() - encapsulates type and ID on at the object ID | 360 | * media_gobj_gen_id() - encapsulates type and ID on at the object ID |
351 | * | 361 | * |
352 | * @type: object type as define at enum &media_gobj_type. | 362 | * @type: object type as define at enum &media_gobj_type. |
353 | * @local_id: next ID, from struct &media_device.@id. | 363 | * @local_id: next ID, from struct &media_device.id. |
354 | */ | 364 | */ |
355 | static inline u32 media_gobj_gen_id(enum media_gobj_type type, u64 local_id) | 365 | static inline u32 media_gobj_gen_id(enum media_gobj_type type, u64 local_id) |
356 | { | 366 | { |
@@ -366,9 +376,9 @@ static inline u32 media_gobj_gen_id(enum media_gobj_type type, u64 local_id) | |||
366 | * is_media_entity_v4l2_video_device() - Check if the entity is a video_device | 376 | * is_media_entity_v4l2_video_device() - Check if the entity is a video_device |
367 | * @entity: pointer to entity | 377 | * @entity: pointer to entity |
368 | * | 378 | * |
369 | * Return: true if the entity is an instance of a video_device object and can | 379 | * Return: %true if the entity is an instance of a video_device object and can |
370 | * safely be cast to a struct video_device using the container_of() macro, or | 380 | * safely be cast to a struct video_device using the container_of() macro, or |
371 | * false otherwise. | 381 | * %false otherwise. |
372 | */ | 382 | */ |
373 | static inline bool is_media_entity_v4l2_video_device(struct media_entity *entity) | 383 | static inline bool is_media_entity_v4l2_video_device(struct media_entity *entity) |
374 | { | 384 | { |
@@ -379,9 +389,9 @@ static inline bool is_media_entity_v4l2_video_device(struct media_entity *entity | |||
379 | * is_media_entity_v4l2_subdev() - Check if the entity is a v4l2_subdev | 389 | * is_media_entity_v4l2_subdev() - Check if the entity is a v4l2_subdev |
380 | * @entity: pointer to entity | 390 | * @entity: pointer to entity |
381 | * | 391 | * |
382 | * Return: true if the entity is an instance of a v4l2_subdev object and can | 392 | * Return: %true if the entity is an instance of a &v4l2_subdev object and can |
383 | * safely be cast to a struct v4l2_subdev using the container_of() macro, or | 393 | * safely be cast to a struct &v4l2_subdev using the container_of() macro, or |
384 | * false otherwise. | 394 | * %false otherwise. |
385 | */ | 395 | */ |
386 | static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity) | 396 | static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity) |
387 | { | 397 | { |
@@ -452,7 +462,7 @@ static inline void media_entity_enum_clear(struct media_entity_enum *ent_enum, | |||
452 | * @ent_enum: Entity enumeration | 462 | * @ent_enum: Entity enumeration |
453 | * @entity: Entity to be tested | 463 | * @entity: Entity to be tested |
454 | * | 464 | * |
455 | * Returns true if the entity was marked. | 465 | * Returns %true if the entity was marked. |
456 | */ | 466 | */ |
457 | static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, | 467 | static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, |
458 | struct media_entity *entity) | 468 | struct media_entity *entity) |
@@ -469,7 +479,7 @@ static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, | |||
469 | * @ent_enum: Entity enumeration | 479 | * @ent_enum: Entity enumeration |
470 | * @entity: Entity to be tested | 480 | * @entity: Entity to be tested |
471 | * | 481 | * |
472 | * Returns true if the entity was marked, and mark it before doing so. | 482 | * Returns %true if the entity was marked, and mark it before doing so. |
473 | */ | 483 | */ |
474 | static inline bool | 484 | static inline bool |
475 | media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, | 485 | media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, |
@@ -486,7 +496,7 @@ media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, | |||
486 | * | 496 | * |
487 | * @ent_enum: Entity enumeration | 497 | * @ent_enum: Entity enumeration |
488 | * | 498 | * |
489 | * Returns true if the entity was empty. | 499 | * Return: %true if the entity was empty. |
490 | */ | 500 | */ |
491 | static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) | 501 | static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) |
492 | { | 502 | { |
@@ -499,7 +509,8 @@ static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) | |||
499 | * @ent_enum1: First entity enumeration | 509 | * @ent_enum1: First entity enumeration |
500 | * @ent_enum2: Second entity enumeration | 510 | * @ent_enum2: Second entity enumeration |
501 | * | 511 | * |
502 | * Returns true if entity enumerations e and f intersect, otherwise false. | 512 | * Return: %true if entity enumerations @ent_enum1 and @ent_enum2 intersect, |
513 | * otherwise %false. | ||
503 | */ | 514 | */ |
504 | static inline bool media_entity_enum_intersects( | 515 | static inline bool media_entity_enum_intersects( |
505 | struct media_entity_enum *ent_enum1, | 516 | struct media_entity_enum *ent_enum1, |
@@ -511,33 +522,63 @@ static inline bool media_entity_enum_intersects( | |||
511 | min(ent_enum1->idx_max, ent_enum2->idx_max)); | 522 | min(ent_enum1->idx_max, ent_enum2->idx_max)); |
512 | } | 523 | } |
513 | 524 | ||
525 | /** | ||
526 | * gobj_to_entity - returns the struct &media_entity pointer from the | ||
527 | * @gobj contained on it. | ||
528 | * | ||
529 | * @gobj: Pointer to the struct &media_gobj graph object | ||
530 | */ | ||
514 | #define gobj_to_entity(gobj) \ | 531 | #define gobj_to_entity(gobj) \ |
515 | container_of(gobj, struct media_entity, graph_obj) | 532 | container_of(gobj, struct media_entity, graph_obj) |
516 | 533 | ||
534 | /** | ||
535 | * gobj_to_entity - returns the struct &media_pad pointer from the | ||
536 | * @gobj contained on it. | ||
537 | * | ||
538 | * @gobj: Pointer to the struct &media_gobj graph object | ||
539 | */ | ||
517 | #define gobj_to_pad(gobj) \ | 540 | #define gobj_to_pad(gobj) \ |
518 | container_of(gobj, struct media_pad, graph_obj) | 541 | container_of(gobj, struct media_pad, graph_obj) |
519 | 542 | ||
543 | /** | ||
544 | * gobj_to_entity - returns the struct &media_link pointer from the | ||
545 | * @gobj contained on it. | ||
546 | * | ||
547 | * @gobj: Pointer to the struct &media_gobj graph object | ||
548 | */ | ||
520 | #define gobj_to_link(gobj) \ | 549 | #define gobj_to_link(gobj) \ |
521 | container_of(gobj, struct media_link, graph_obj) | 550 | container_of(gobj, struct media_link, graph_obj) |
522 | 551 | ||
552 | /** | ||
553 | * gobj_to_entity - returns the struct &media_interface pointer from the | ||
554 | * @gobj contained on it. | ||
555 | * | ||
556 | * @gobj: Pointer to the struct &media_gobj graph object | ||
557 | */ | ||
523 | #define gobj_to_intf(gobj) \ | 558 | #define gobj_to_intf(gobj) \ |
524 | container_of(gobj, struct media_interface, graph_obj) | 559 | container_of(gobj, struct media_interface, graph_obj) |
525 | 560 | ||
561 | /** | ||
562 | * gobj_to_entity - returns the struct media_intf_devnode pointer from the | ||
563 | * @intf contained on it. | ||
564 | * | ||
565 | * @intf: Pointer to struct &media_intf_devnode | ||
566 | */ | ||
526 | #define intf_to_devnode(intf) \ | 567 | #define intf_to_devnode(intf) \ |
527 | container_of(intf, struct media_intf_devnode, intf) | 568 | container_of(intf, struct media_intf_devnode, intf) |
528 | 569 | ||
529 | /** | 570 | /** |
530 | * media_gobj_create - Initialize a graph object | 571 | * media_gobj_create - Initialize a graph object |
531 | * | 572 | * |
532 | * @mdev: Pointer to the media_device that contains the object | 573 | * @mdev: Pointer to the &media_device that contains the object |
533 | * @type: Type of the object | 574 | * @type: Type of the object |
534 | * @gobj: Pointer to the graph object | 575 | * @gobj: Pointer to the struct &media_gobj graph object |
535 | * | 576 | * |
536 | * This routine initializes the embedded struct media_gobj inside a | 577 | * This routine initializes the embedded struct &media_gobj inside a |
537 | * media graph object. It is called automatically if media_*_create\(\) | 578 | * media graph object. It is called automatically if ``media_*_create`` |
538 | * calls are used. However, if the object (entity, link, pad, interface) | 579 | * function calls are used. However, if the object (entity, link, pad, |
539 | * is embedded on some other object, this function should be called before | 580 | * interface) is embedded on some other object, this function should be |
540 | * registering the object at the media controller. | 581 | * called before registering the object at the media controller. |
541 | */ | 582 | */ |
542 | void media_gobj_create(struct media_device *mdev, | 583 | void media_gobj_create(struct media_device *mdev, |
543 | enum media_gobj_type type, | 584 | enum media_gobj_type type, |
@@ -546,7 +587,7 @@ void media_gobj_create(struct media_device *mdev, | |||
546 | /** | 587 | /** |
547 | * media_gobj_destroy - Stop using a graph object on a media device | 588 | * media_gobj_destroy - Stop using a graph object on a media device |
548 | * | 589 | * |
549 | * @gobj: Pointer to the graph object | 590 | * @gobj: Pointer to the struct &media_gobj graph object |
550 | * | 591 | * |
551 | * This should be called by all routines like media_device_unregister() | 592 | * This should be called by all routines like media_device_unregister() |
552 | * that remove/destroy media graph objects. | 593 | * that remove/destroy media graph objects. |
@@ -561,11 +602,11 @@ void media_gobj_destroy(struct media_gobj *gobj); | |||
561 | * @pads: Array of @num_pads pads. | 602 | * @pads: Array of @num_pads pads. |
562 | * | 603 | * |
563 | * The pads array is managed by the entity driver and passed to | 604 | * The pads array is managed by the entity driver and passed to |
564 | * media_entity_pads_init() where its pointer will be stored in the entity | 605 | * media_entity_pads_init() where its pointer will be stored in the |
565 | * structure. | 606 | * &media_entity structure. |
566 | * | 607 | * |
567 | * If no pads are needed, drivers could either directly fill | 608 | * If no pads are needed, drivers could either directly fill |
568 | * &media_entity->@num_pads with 0 and &media_entity->@pads with NULL or call | 609 | * &media_entity->num_pads with 0 and &media_entity->pads with %NULL or call |
569 | * this function that will do the same. | 610 | * this function that will do the same. |
570 | * | 611 | * |
571 | * As the number of pads is known in advance, the pads array is not allocated | 612 | * As the number of pads is known in advance, the pads array is not allocated |
@@ -595,18 +636,21 @@ static inline void media_entity_cleanup(struct media_entity *entity) {}; | |||
595 | * @source_pad: number of the source pad in the pads array | 636 | * @source_pad: number of the source pad in the pads array |
596 | * @sink: pointer to &media_entity of the sink pad. | 637 | * @sink: pointer to &media_entity of the sink pad. |
597 | * @sink_pad: number of the sink pad in the pads array. | 638 | * @sink_pad: number of the sink pad in the pads array. |
598 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 639 | * @flags: Link flags, as defined in |
640 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
641 | * ( seek for ``MEDIA_LNK_FL_*``) | ||
599 | * | 642 | * |
600 | * Valid values for flags: | 643 | * Valid values for flags: |
601 | * | 644 | * |
602 | * - A %MEDIA_LNK_FL_ENABLED flag indicates that the link is enabled and can | 645 | * %MEDIA_LNK_FL_ENABLED |
603 | * be used to transfer media data. When two or more links target a sink pad, | 646 | * Indicates that the link is enabled and can be used to transfer media data. |
604 | * only one of them can be enabled at a time. | 647 | * When two or more links target a sink pad, only one of them can be |
648 | * enabled at a time. | ||
605 | * | 649 | * |
606 | * - A %MEDIA_LNK_FL_IMMUTABLE flag indicates that the link enabled state can't | 650 | * %MEDIA_LNK_FL_IMMUTABLE |
607 | * be modified at runtime. If %MEDIA_LNK_FL_IMMUTABLE is set, then | 651 | * Indicates that the link enabled state can't be modified at runtime. If |
608 | * %MEDIA_LNK_FL_ENABLED must also be set since an immutable link is | 652 | * %MEDIA_LNK_FL_IMMUTABLE is set, then %MEDIA_LNK_FL_ENABLED must also be |
609 | * always enabled. | 653 | * set, since an immutable link is always enabled. |
610 | * | 654 | * |
611 | * .. note:: | 655 | * .. note:: |
612 | * | 656 | * |
@@ -624,17 +668,17 @@ __must_check int media_create_pad_link(struct media_entity *source, | |||
624 | * @source_function: Function of the source entities. Used only if @source is | 668 | * @source_function: Function of the source entities. Used only if @source is |
625 | * NULL. | 669 | * NULL. |
626 | * @source: pointer to &media_entity of the source pad. If NULL, it will use | 670 | * @source: pointer to &media_entity of the source pad. If NULL, it will use |
627 | * all entities that matches the @sink_function. | 671 | * all entities that matches the @sink_function. |
628 | * @source_pad: number of the source pad in the pads array | 672 | * @source_pad: number of the source pad in the pads array |
629 | * @sink_function: Function of the sink entities. Used only if @sink is NULL. | 673 | * @sink_function: Function of the sink entities. Used only if @sink is NULL. |
630 | * @sink: pointer to &media_entity of the sink pad. If NULL, it will use | 674 | * @sink: pointer to &media_entity of the sink pad. If NULL, it will use |
631 | * all entities that matches the @sink_function. | 675 | * all entities that matches the @sink_function. |
632 | * @sink_pad: number of the sink pad in the pads array. | 676 | * @sink_pad: number of the sink pad in the pads array. |
633 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 677 | * @flags: Link flags, as defined in include/uapi/linux/media.h. |
634 | * @allow_both_undefined: if true, then both @source and @sink can be NULL. | 678 | * @allow_both_undefined: if %true, then both @source and @sink can be NULL. |
635 | * In such case, it will create a crossbar between all entities that | 679 | * In such case, it will create a crossbar between all entities that |
636 | * matches @source_function to all entities that matches @sink_function. | 680 | * matches @source_function to all entities that matches @sink_function. |
637 | * If false, it will return 0 and won't create any link if both @source | 681 | * If %false, it will return 0 and won't create any link if both @source |
638 | * and @sink are NULL. | 682 | * and @sink are NULL. |
639 | * | 683 | * |
640 | * Valid values for flags: | 684 | * Valid values for flags: |
@@ -654,9 +698,11 @@ __must_check int media_create_pad_link(struct media_entity *source, | |||
654 | * creates link by link, this function is meant to allow 1:n, n:1 and even | 698 | * creates link by link, this function is meant to allow 1:n, n:1 and even |
655 | * cross-bar (n:n) links. | 699 | * cross-bar (n:n) links. |
656 | * | 700 | * |
657 | * NOTE: Before calling this function, media_entity_pads_init() and | 701 | * .. note:: |
658 | * media_device_register_entity() should be called previously for the entities | 702 | * |
659 | * to be linked. | 703 | * Before calling this function, media_entity_pads_init() and |
704 | * media_device_register_entity() should be called previously for the | ||
705 | * entities to be linked. | ||
660 | */ | 706 | */ |
661 | int media_create_pad_links(const struct media_device *mdev, | 707 | int media_create_pad_links(const struct media_device *mdev, |
662 | const u32 source_function, | 708 | const u32 source_function, |
@@ -715,7 +761,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); | |||
715 | * flags. | 761 | * flags. |
716 | * | 762 | * |
717 | * Media device drivers can be notified of link setup operations by setting the | 763 | * Media device drivers can be notified of link setup operations by setting the |
718 | * media_device::link_notify pointer to a callback function. If provided, the | 764 | * &media_device.link_notify pointer to a callback function. If provided, the |
719 | * notification callback will be called before enabling and after disabling | 765 | * notification callback will be called before enabling and after disabling |
720 | * links. | 766 | * links. |
721 | * | 767 | * |
@@ -725,7 +771,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); | |||
725 | * | 771 | * |
726 | * Link configuration must not have any side effect on other links. If an | 772 | * Link configuration must not have any side effect on other links. If an |
727 | * enabled link at a sink pad prevents another link at the same pad from | 773 | * enabled link at a sink pad prevents another link at the same pad from |
728 | * being enabled, the link_setup operation must return -EBUSY and can't | 774 | * being enabled, the link_setup operation must return %-EBUSY and can't |
729 | * implicitly disable the first enabled link. | 775 | * implicitly disable the first enabled link. |
730 | * | 776 | * |
731 | * .. note:: | 777 | * .. note:: |
@@ -741,8 +787,8 @@ int media_entity_setup_link(struct media_link *link, u32 flags); | |||
741 | * @source: Source pad | 787 | * @source: Source pad |
742 | * @sink: Sink pad | 788 | * @sink: Sink pad |
743 | * | 789 | * |
744 | * Return a pointer to the link between the two entities. If no such link | 790 | * Return: returns a pointer to the link between the two entities. If no |
745 | * exists, return NULL. | 791 | * such link exists, return %NULL. |
746 | */ | 792 | */ |
747 | struct media_link *media_entity_find_link(struct media_pad *source, | 793 | struct media_link *media_entity_find_link(struct media_pad *source, |
748 | struct media_pad *sink); | 794 | struct media_pad *sink); |
@@ -754,8 +800,8 @@ struct media_link *media_entity_find_link(struct media_pad *source, | |||
754 | * Search for a remote pad connected to the given pad by iterating over all | 800 | * Search for a remote pad connected to the given pad by iterating over all |
755 | * links originating or terminating at that pad until an enabled link is found. | 801 | * links originating or terminating at that pad until an enabled link is found. |
756 | * | 802 | * |
757 | * Return a pointer to the pad at the remote end of the first found enabled | 803 | * Return: returns a pointer to the pad at the remote end of the first found |
758 | * link, or NULL if no enabled link has been found. | 804 | * enabled link, or %NULL if no enabled link has been found. |
759 | */ | 805 | */ |
760 | struct media_pad *media_entity_remote_pad(struct media_pad *pad); | 806 | struct media_pad *media_entity_remote_pad(struct media_pad *pad); |
761 | 807 | ||
@@ -766,12 +812,18 @@ struct media_pad *media_entity_remote_pad(struct media_pad *pad); | |||
766 | * | 812 | * |
767 | * Get a reference to the parent media device module. | 813 | * Get a reference to the parent media device module. |
768 | * | 814 | * |
769 | * The function will return immediately if @entity is NULL. | 815 | * The function will return immediately if @entity is %NULL. |
770 | * | 816 | * |
771 | * Return a pointer to the entity on success or NULL on failure. | 817 | * Return: returns a pointer to the entity on success or %NULL on failure. |
772 | */ | 818 | */ |
773 | struct media_entity *media_entity_get(struct media_entity *entity); | 819 | struct media_entity *media_entity_get(struct media_entity *entity); |
774 | 820 | ||
821 | /** | ||
822 | * media_entity_graph_walk_init - Allocate resources used by graph walk. | ||
823 | * | ||
824 | * @graph: Media graph structure that will be used to walk the graph | ||
825 | * @mdev: Pointer to the &media_device that contains the object | ||
826 | */ | ||
775 | __must_check int media_entity_graph_walk_init( | 827 | __must_check int media_entity_graph_walk_init( |
776 | struct media_entity_graph *graph, struct media_device *mdev); | 828 | struct media_entity_graph *graph, struct media_device *mdev); |
777 | 829 | ||
@@ -789,12 +841,14 @@ void media_entity_graph_walk_cleanup(struct media_entity_graph *graph); | |||
789 | * | 841 | * |
790 | * Release the reference count acquired by media_entity_get(). | 842 | * Release the reference count acquired by media_entity_get(). |
791 | * | 843 | * |
792 | * The function will return immediately if @entity is NULL. | 844 | * The function will return immediately if @entity is %NULL. |
793 | */ | 845 | */ |
794 | void media_entity_put(struct media_entity *entity); | 846 | void media_entity_put(struct media_entity *entity); |
795 | 847 | ||
796 | /** | 848 | /** |
797 | * media_entity_graph_walk_start - Start walking the media graph at a given entity | 849 | * media_entity_graph_walk_start - Start walking the media graph at a |
850 | * given entity | ||
851 | * | ||
798 | * @graph: Media graph structure that will be used to walk the graph | 852 | * @graph: Media graph structure that will be used to walk the graph |
799 | * @entity: Starting entity | 853 | * @entity: Starting entity |
800 | * | 854 | * |
@@ -818,8 +872,8 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, | |||
818 | * The graph structure must have been previously initialized with a call to | 872 | * The graph structure must have been previously initialized with a call to |
819 | * media_entity_graph_walk_start(). | 873 | * media_entity_graph_walk_start(). |
820 | * | 874 | * |
821 | * Return the next entity in the graph or NULL if the whole graph have been | 875 | * Return: returns the next entity in the graph or %NULL if the whole graph |
822 | * traversed. | 876 | * have been traversed. |
823 | */ | 877 | */ |
824 | struct media_entity * | 878 | struct media_entity * |
825 | media_entity_graph_walk_next(struct media_entity_graph *graph); | 879 | media_entity_graph_walk_next(struct media_entity_graph *graph); |
@@ -830,8 +884,8 @@ media_entity_graph_walk_next(struct media_entity_graph *graph); | |||
830 | * @pipe: Media pipeline to be assigned to all entities in the pipeline. | 884 | * @pipe: Media pipeline to be assigned to all entities in the pipeline. |
831 | * | 885 | * |
832 | * Mark all entities connected to a given entity through enabled links, either | 886 | * Mark all entities connected to a given entity through enabled links, either |
833 | * directly or indirectly, as streaming. The given pipeline object is assigned to | 887 | * directly or indirectly, as streaming. The given pipeline object is assigned |
834 | * every entity in the pipeline and stored in the media_entity pipe field. | 888 | * to every entity in the pipeline and stored in the media_entity pipe field. |
835 | * | 889 | * |
836 | * Calls to this function can be nested, in which case the same number of | 890 | * Calls to this function can be nested, in which case the same number of |
837 | * media_entity_pipeline_stop() calls will be required to stop streaming. The | 891 | * media_entity_pipeline_stop() calls will be required to stop streaming. The |
@@ -857,7 +911,7 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity, | |||
857 | * | 911 | * |
858 | * Mark all entities connected to a given entity through enabled links, either | 912 | * Mark all entities connected to a given entity through enabled links, either |
859 | * directly or indirectly, as not streaming. The media_entity pipe field is | 913 | * directly or indirectly, as not streaming. The media_entity pipe field is |
860 | * reset to NULL. | 914 | * reset to %NULL. |
861 | * | 915 | * |
862 | * If multiple calls to media_entity_pipeline_start() have been made, the same | 916 | * If multiple calls to media_entity_pipeline_start() have been made, the same |
863 | * number of calls to this function are required to mark the pipeline as not | 917 | * number of calls to this function are required to mark the pipeline as not |
@@ -878,14 +932,21 @@ void __media_entity_pipeline_stop(struct media_entity *entity); | |||
878 | * media_devnode_create() - creates and initializes a device node interface | 932 | * media_devnode_create() - creates and initializes a device node interface |
879 | * | 933 | * |
880 | * @mdev: pointer to struct &media_device | 934 | * @mdev: pointer to struct &media_device |
881 | * @type: type of the interface, as given by MEDIA_INTF_T_* macros | 935 | * @type: type of the interface, as given by |
882 | * as defined in the uapi/media/media.h header. | 936 | * :ref:`include/uapi/linux/media.h <media_header>` |
883 | * @flags: Interface flags as defined in uapi/media/media.h. | 937 | * ( seek for ``MEDIA_INTF_T_*``) macros. |
938 | * @flags: Interface flags, as defined in | ||
939 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
940 | * ( seek for ``MEDIA_INTF_FL_*``) | ||
884 | * @major: Device node major number. | 941 | * @major: Device node major number. |
885 | * @minor: Device node minor number. | 942 | * @minor: Device node minor number. |
886 | * | 943 | * |
887 | * Return: if succeeded, returns a pointer to the newly allocated | 944 | * Return: if succeeded, returns a pointer to the newly allocated |
888 | * &media_intf_devnode pointer. | 945 | * &media_intf_devnode pointer. |
946 | * | ||
947 | * .. note:: | ||
948 | * | ||
949 | * Currently, no flags for &media_interface is defined. | ||
889 | */ | 950 | */ |
890 | struct media_intf_devnode * | 951 | struct media_intf_devnode * |
891 | __must_check media_devnode_create(struct media_device *mdev, | 952 | __must_check media_devnode_create(struct media_device *mdev, |
@@ -907,15 +968,19 @@ struct media_link * | |||
907 | * | 968 | * |
908 | * @entity: pointer to %media_entity | 969 | * @entity: pointer to %media_entity |
909 | * @intf: pointer to %media_interface | 970 | * @intf: pointer to %media_interface |
910 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 971 | * @flags: Link flags, as defined in |
972 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
973 | * ( seek for ``MEDIA_LNK_FL_*``) | ||
911 | * | 974 | * |
912 | * | 975 | * |
913 | * Valid values for flags: | 976 | * Valid values for flags: |
914 | * | 977 | * |
915 | * - The %MEDIA_LNK_FL_ENABLED flag indicates that the interface is connected to | 978 | * %MEDIA_LNK_FL_ENABLED |
916 | * the entity hardware. That's the default value for interfaces. An | 979 | * Indicates that the interface is connected to the entity hardware. |
917 | * interface may be disabled if the hardware is busy due to the usage | 980 | * That's the default value for interfaces. An interface may be disabled if |
918 | * of some other interface that it is currently controlling the hardware. | 981 | * the hardware is busy due to the usage of some other interface that it is |
982 | * currently controlling the hardware. | ||
983 | * | ||
919 | * A typical example is an hybrid TV device that handle only one type of | 984 | * A typical example is an hybrid TV device that handle only one type of |
920 | * stream on a given time. So, when the digital TV is streaming, | 985 | * stream on a given time. So, when the digital TV is streaming, |
921 | * the V4L2 interfaces won't be enabled, as such device is not able to | 986 | * the V4L2 interfaces won't be enabled, as such device is not able to |
@@ -971,6 +1036,18 @@ void __media_remove_intf_links(struct media_interface *intf); | |||
971 | */ | 1036 | */ |
972 | void media_remove_intf_links(struct media_interface *intf); | 1037 | void media_remove_intf_links(struct media_interface *intf); |
973 | 1038 | ||
1039 | /** | ||
1040 | * media_entity_call - Calls a struct media_entity_operations operation on | ||
1041 | * an entity | ||
1042 | * | ||
1043 | * @entity: entity where the @operation will be called | ||
1044 | * @operation: type of the operation. Should be the name of a member of | ||
1045 | * struct &media_entity_operations. | ||
1046 | * | ||
1047 | * This helper function will check if @operation is not %NULL. On such case, | ||
1048 | * it will issue a call to @operation\(@entity, @args\). | ||
1049 | */ | ||
1050 | |||
974 | #define media_entity_call(entity, operation, args...) \ | 1051 | #define media_entity_call(entity, operation, args...) \ |
975 | (((entity)->ops && (entity)->ops->operation) ? \ | 1052 | (((entity)->ops && (entity)->ops->operation) ? \ |
976 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) | 1053 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) |