diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-11 16:22:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-11 16:22:22 -0400 |
| commit | de34f4da7f62ff59ac6e1ef320b0fcfa3296fce3 (patch) | |
| tree | 88b5db2fc7fbbb0353edd8447a832a5225a49d01 /include | |
| parent | 56e520c7a0a490b63b042b047ec9659fc08762a4 (diff) | |
| parent | 9fce0c226536fc36c7fb0a80000ca38a995be43e (diff) | |
Merge tag 'media/v4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- Documentation improvements: conversion of all non-DocBook documents
to Sphinx and lots of fixes to the uAPI media book
- New PCI driver for Techwell TW5864 media grabber boards
- New SoC driver for ATMEL Image Sensor Controller
- Removal of some obsolete SoC drivers (s5p-tv driver and soc_camera
drivers)
- Addition of ST CEC driver
- Lots of drivers fixes, improvements and additions
* tag 'media/v4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (464 commits)
[media] ttusb_dec: avoid the risk of go past buffer
[media] cx23885: Fix some smatch warnings
[media] si2165: switch to regmap
[media] si2165: use i2c_client->dev instead of i2c_adapter->dev for logging
[media] si2165: Remove legacy attach
[media] cx231xx: attach si2165 driver via i2c_client
[media] cx231xx: Prepare for attaching new style i2c_client DVB demod drivers
[media] cx23885: attach si2165 driver via i2c_client
[media] si2165: support i2c_client attach
[media] si2165: avoid division by zero
[media] rcar-vin: add R-Car gen2 fallback compatibility string
[media] lgdt3306a: remove 20*50 msec unnecessary timeout
[media] cx25821: Remove deprecated create_singlethread_workqueue
[media] cx25821: Drop Freeing of Workqueue
[media] cxd2841er: force 8MHz bandwidth for DVB-C if specified bw not supported
[media] redrat3: hardware-specific parameters
[media] redrat3: remove hw_timeout member
[media] cxd2841er: BER and SNR reading for ISDB-T
[media] dvb-usb: avoid link error with dib3000m{b,c|
[media] dvb-usb: split out common parts of dibusb
...
Diffstat (limited to 'include')
29 files changed, 1587 insertions, 579 deletions
diff --git a/include/linux/platform_data/media/camera-pxa.h b/include/linux/platform_data/media/camera-pxa.h index 6709b1cd7c77..ce5d90e1a6e4 100644 --- a/include/linux/platform_data/media/camera-pxa.h +++ b/include/linux/platform_data/media/camera-pxa.h | |||
| @@ -37,6 +37,8 @@ | |||
| 37 | struct pxacamera_platform_data { | 37 | struct pxacamera_platform_data { |
| 38 | unsigned long flags; | 38 | unsigned long flags; |
| 39 | unsigned long mclk_10khz; | 39 | unsigned long mclk_10khz; |
| 40 | int sensor_i2c_adapter_id; | ||
| 41 | int sensor_i2c_address; | ||
| 40 | }; | 42 | }; |
| 41 | 43 | ||
| 42 | extern void pxa_set_camera_info(struct pxacamera_platform_data *); | 44 | extern void pxa_set_camera_info(struct pxacamera_platform_data *); |
diff --git a/include/media/drv-intf/sh_mobile_ceu.h b/include/media/drv-intf/sh_mobile_ceu.h index 7f57056c22ba..2f43f7d9e28d 100644 --- a/include/media/drv-intf/sh_mobile_ceu.h +++ b/include/media/drv-intf/sh_mobile_ceu.h | |||
| @@ -21,7 +21,6 @@ struct sh_mobile_ceu_info { | |||
| 21 | unsigned long flags; | 21 | unsigned long flags; |
| 22 | int max_width; | 22 | int max_width; |
| 23 | int max_height; | 23 | int max_height; |
| 24 | struct sh_mobile_ceu_companion *csi2; | ||
| 25 | struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ | 24 | struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ |
| 26 | unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */ | 25 | unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */ |
| 27 | }; | 26 | }; |
diff --git a/include/media/drv-intf/sh_mobile_csi2.h b/include/media/drv-intf/sh_mobile_csi2.h deleted file mode 100644 index 14030db51f13..000000000000 --- a/include/media/drv-intf/sh_mobile_csi2.h +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Driver header for the SH-Mobile MIPI CSI-2 unit | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef SH_MIPI_CSI | ||
| 12 | #define SH_MIPI_CSI | ||
| 13 | |||
| 14 | #include <linux/list.h> | ||
| 15 | |||
| 16 | enum sh_csi2_phy { | ||
| 17 | SH_CSI2_PHY_MAIN, | ||
| 18 | SH_CSI2_PHY_SUB, | ||
| 19 | }; | ||
| 20 | |||
| 21 | enum sh_csi2_type { | ||
| 22 | SH_CSI2C, | ||
| 23 | SH_CSI2I, | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define SH_CSI2_CRC (1 << 0) | ||
| 27 | #define SH_CSI2_ECC (1 << 1) | ||
| 28 | |||
| 29 | struct platform_device; | ||
| 30 | |||
| 31 | struct sh_csi2_client_config { | ||
| 32 | enum sh_csi2_phy phy; | ||
| 33 | unsigned char lanes; /* bitmask[3:0] */ | ||
| 34 | unsigned char channel; /* 0..3 */ | ||
| 35 | struct platform_device *pdev; /* client platform device */ | ||
| 36 | const char *name; /* async matching: client name */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct v4l2_device; | ||
| 40 | |||
| 41 | struct sh_csi2_pdata { | ||
| 42 | enum sh_csi2_type type; | ||
| 43 | unsigned int flags; | ||
| 44 | struct sh_csi2_client_config *clients; | ||
| 45 | int num_clients; | ||
| 46 | }; | ||
| 47 | |||
| 48 | #endif | ||
diff --git a/include/media/i2c/smiapp.h b/include/media/i2c/smiapp.h index 029142ddb95c..635007e7441a 100644 --- a/include/media/i2c/smiapp.h +++ b/include/media/i2c/smiapp.h | |||
| @@ -36,8 +36,6 @@ | |||
| 36 | #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1 | 36 | #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1 |
| 37 | #define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2 | 37 | #define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2 |
| 38 | 38 | ||
| 39 | #define SMIAPP_NO_XSHUTDOWN -1 | ||
| 40 | |||
| 41 | /* | 39 | /* |
| 42 | * Sometimes due to board layout considerations the camera module can be | 40 | * Sometimes due to board layout considerations the camera module can be |
| 43 | * mounted rotated. The typical rotation used is 180 degrees which can be | 41 | * mounted rotated. The typical rotation used is 180 degrees which can be |
| @@ -57,7 +55,7 @@ struct smiapp_flash_strobe_parms { | |||
| 57 | u8 trigger; | 55 | u8 trigger; |
| 58 | }; | 56 | }; |
| 59 | 57 | ||
| 60 | struct smiapp_platform_data { | 58 | struct smiapp_hwconfig { |
| 61 | /* | 59 | /* |
| 62 | * Change the cci address if i2c_addr_alt is set. | 60 | * Change the cci address if i2c_addr_alt is set. |
| 63 | * Both default and alternate cci addr need to be present | 61 | * Both default and alternate cci addr need to be present |
| @@ -75,9 +73,6 @@ struct smiapp_platform_data { | |||
| 75 | enum smiapp_module_board_orient module_board_orient; | 73 | enum smiapp_module_board_orient module_board_orient; |
| 76 | 74 | ||
| 77 | struct smiapp_flash_strobe_parms *strobe_setup; | 75 | struct smiapp_flash_strobe_parms *strobe_setup; |
| 78 | |||
| 79 | int (*set_xclk)(struct v4l2_subdev *sd, int hz); | ||
| 80 | int32_t xshutdown; /* gpio or SMIAPP_NO_XSHUTDOWN */ | ||
| 81 | }; | 76 | }; |
| 82 | 77 | ||
| 83 | #endif /* __SMIAPP_H_ */ | 78 | #endif /* __SMIAPP_H_ */ |
diff --git a/include/media/media-device.h b/include/media/media-device.h index 28195242386c..ef93e21335df 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h | |||
| @@ -49,11 +49,21 @@ struct media_entity_notify { | |||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * struct media_device_ops - Media device operations | ||
| 53 | * @link_notify: Link state change notification callback. This callback is | ||
| 54 | * called with the graph_mutex held. | ||
| 55 | */ | ||
| 56 | struct media_device_ops { | ||
| 57 | int (*link_notify)(struct media_link *link, u32 flags, | ||
| 58 | unsigned int notification); | ||
| 59 | }; | ||
| 60 | |||
| 61 | /** | ||
| 52 | * struct media_device - Media device | 62 | * struct media_device - Media device |
| 53 | * @dev: Parent device | 63 | * @dev: Parent device |
| 54 | * @devnode: Media device node | 64 | * @devnode: Media device node |
| 55 | * @driver_name: Optional device driver name. If not set, calls to | 65 | * @driver_name: Optional device driver name. If not set, calls to |
| 56 | * %MEDIA_IOC_DEVICE_INFO will return dev->driver->name. | 66 | * %MEDIA_IOC_DEVICE_INFO will return ``dev->driver->name``. |
| 57 | * This is needed for USB drivers for example, as otherwise | 67 | * This is needed for USB drivers for example, as otherwise |
| 58 | * they'll all appear as if the driver name was "usb". | 68 | * they'll all appear as if the driver name was "usb". |
| 59 | * @model: Device model name | 69 | * @model: Device model name |
| @@ -80,8 +90,7 @@ struct media_entity_notify { | |||
| 80 | * @enable_source: Enable Source Handler function pointer | 90 | * @enable_source: Enable Source Handler function pointer |
| 81 | * @disable_source: Disable Source Handler function pointer | 91 | * @disable_source: Disable Source Handler function pointer |
| 82 | * | 92 | * |
| 83 | * @link_notify: Link state change notification callback. This callback is | 93 | * @ops: Operation handler callbacks |
| 84 | * called with the graph_mutex held. | ||
| 85 | * | 94 | * |
| 86 | * This structure represents an abstract high-level media device. It allows easy | 95 | * This structure represents an abstract high-level media device. It allows easy |
| 87 | * access to entities and provides basic media device-level support. The | 96 | * access to entities and provides basic media device-level support. The |
| @@ -102,16 +111,18 @@ struct media_entity_notify { | |||
| 102 | * sink entity and deactivate the link between them. Drivers | 111 | * sink entity and deactivate the link between them. Drivers |
| 103 | * should call this handler to release the source. | 112 | * should call this handler to release the source. |
| 104 | * | 113 | * |
| 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 | 114 | * Use-case: find tuner entity connected to the decoder |
| 112 | * entity and check if it is available, and activate the | 115 | * entity and check if it is available, and activate the |
| 113 | * the link between them from enable_source and deactivate | 116 | * the link between them from @enable_source and deactivate |
| 114 | * from disable_source. | 117 | * from @disable_source. |
| 118 | * | ||
| 119 | * .. note:: | ||
| 120 | * | ||
| 121 | * Bridge driver is expected to implement and set the | ||
| 122 | * handler when &media_device is registered or when | ||
| 123 | * bridge driver finds the media_device during probe. | ||
| 124 | * Bridge driver sets source_priv with information | ||
| 125 | * necessary to run @enable_source and @disable_source handlers. | ||
| 115 | */ | 126 | */ |
| 116 | struct media_device { | 127 | struct media_device { |
| 117 | /* dev->driver_data points to this struct. */ | 128 | /* dev->driver_data points to this struct. */ |
| @@ -148,8 +159,7 @@ struct media_device { | |||
| 148 | struct media_pipeline *pipe); | 159 | struct media_pipeline *pipe); |
| 149 | void (*disable_source)(struct media_entity *entity); | 160 | void (*disable_source)(struct media_entity *entity); |
| 150 | 161 | ||
| 151 | int (*link_notify)(struct media_link *link, u32 flags, | 162 | const struct media_device_ops *ops; |
| 152 | unsigned int notification); | ||
| 153 | }; | 163 | }; |
| 154 | 164 | ||
| 155 | /* We don't need to include pci.h or usb.h here */ | 165 | /* We don't need to include pci.h or usb.h here */ |
| @@ -168,7 +178,7 @@ struct usb_device; | |||
| 168 | * @ent_enum: Entity enumeration to be initialised | 178 | * @ent_enum: Entity enumeration to be initialised |
| 169 | * @mdev: The related media device | 179 | * @mdev: The related media device |
| 170 | * | 180 | * |
| 171 | * Returns zero on success or a negative error code. | 181 | * Return: zero on success or a negative error code. |
| 172 | */ | 182 | */ |
| 173 | static inline __must_check int media_entity_enum_init( | 183 | static inline __must_check int media_entity_enum_init( |
| 174 | struct media_entity_enum *ent_enum, struct media_device *mdev) | 184 | struct media_entity_enum *ent_enum, struct media_device *mdev) |
| @@ -211,36 +221,38 @@ void media_device_cleanup(struct media_device *mdev); | |||
| 211 | * | 221 | * |
| 212 | * Users, should, instead, call the media_device_register() macro. | 222 | * Users, should, instead, call the media_device_register() macro. |
| 213 | * | 223 | * |
| 214 | * The caller is responsible for initializing the media_device structure before | 224 | * The caller is responsible for initializing the &media_device structure |
| 215 | * registration. The following fields must be set: | 225 | * before registration. The following fields of &media_device must be set: |
| 216 | * | 226 | * |
| 217 | * - dev must point to the parent device (usually a &pci_dev, &usb_interface or | 227 | * - &media_entity.dev must point to the parent device (usually a &pci_dev, |
| 218 | * &platform_device instance). | 228 | * &usb_interface or &platform_device instance). |
| 219 | * | 229 | * |
| 220 | * - model must be filled with the device model name as a NUL-terminated UTF-8 | 230 | * - &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. | 231 | * NUL-terminated UTF-8 string. The device/model revision must not be |
| 232 | * stored in this field. | ||
| 222 | * | 233 | * |
| 223 | * The following fields are optional: | 234 | * The following fields are optional: |
| 224 | * | 235 | * |
| 225 | * - serial is a unique serial number stored as a NUL-terminated ASCII string. | 236 | * - &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 | 237 | * 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. | 238 | * in text form. If the hardware doesn't provide a unique serial number |
| 239 | * this field must be left empty. | ||
| 228 | * | 240 | * |
| 229 | * - bus_info represents the location of the device in the system as a | 241 | * - &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 | 242 | * 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, | 243 | * &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 | 244 | * the value of pci_name(). For USB devices,the usb_make_path() function |
| 233 | * applications to distinguish between otherwise identical devices that don't | 245 | * must be used. This field is used by applications to distinguish between |
| 234 | * provide a serial number. | 246 | * otherwise identical devices that don't provide a serial number. |
| 235 | * | 247 | * |
| 236 | * - hw_revision is the hardware device revision in a driver-specific format. | 248 | * - &media_entity.hw_revision is the hardware device revision in a |
| 237 | * When possible the revision should be formatted with the KERNEL_VERSION | 249 | * driver-specific format. When possible the revision should be formatted |
| 238 | * macro. | 250 | * with the KERNEL_VERSION() macro. |
| 239 | * | 251 | * |
| 240 | * - driver_version is formatted with the KERNEL_VERSION macro. The version | 252 | * - &media_entity.driver_version is formatted with the KERNEL_VERSION() |
| 241 | * minor must be incremented when new features are added to the userspace API | 253 | * macro. The version minor must be incremented when new features are added |
| 242 | * without breaking binary compatibility. The version major must be | 254 | * to the userspace API without breaking binary compatibility. The version |
| 243 | * incremented when binary compatibility is broken. | 255 | * major must be incremented when binary compatibility is broken. |
| 244 | * | 256 | * |
| 245 | * .. note:: | 257 | * .. note:: |
| 246 | * | 258 | * |
| @@ -252,6 +264,16 @@ void media_device_cleanup(struct media_device *mdev); | |||
| 252 | */ | 264 | */ |
| 253 | int __must_check __media_device_register(struct media_device *mdev, | 265 | int __must_check __media_device_register(struct media_device *mdev, |
| 254 | struct module *owner); | 266 | struct module *owner); |
| 267 | |||
| 268 | |||
| 269 | /** | ||
| 270 | * media_device_register() - Registers a media device element | ||
| 271 | * | ||
| 272 | * @mdev: pointer to struct &media_device | ||
| 273 | * | ||
| 274 | * This macro calls __media_device_register() passing %THIS_MODULE as | ||
| 275 | * the __media_device_register() second argument (**owner**). | ||
| 276 | */ | ||
| 255 | #define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE) | 277 | #define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE) |
| 256 | 278 | ||
| 257 | /** | 279 | /** |
| @@ -259,7 +281,6 @@ int __must_check __media_device_register(struct media_device *mdev, | |||
| 259 | * | 281 | * |
| 260 | * @mdev: pointer to struct &media_device | 282 | * @mdev: pointer to struct &media_device |
| 261 | * | 283 | * |
| 262 | * | ||
| 263 | * It is safe to call this function on an unregistered (but initialised) | 284 | * It is safe to call this function on an unregistered (but initialised) |
| 264 | * media device. | 285 | * media device. |
| 265 | */ | 286 | */ |
| @@ -285,14 +306,15 @@ void media_device_unregister(struct media_device *mdev); | |||
| 285 | * framework. | 306 | * framework. |
| 286 | * | 307 | * |
| 287 | * If the device has pads, media_entity_pads_init() should be called before | 308 | * 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 | 309 | * this function. Otherwise, the &media_entity.pad and &media_entity.num_pads |
| 289 | * should be zeroed before calling this function. | 310 | * should be zeroed before calling this function. |
| 290 | * | 311 | * |
| 291 | * Entities have flags that describe the entity capabilities and state: | 312 | * Entities have flags that describe the entity capabilities and state: |
| 292 | * | 313 | * |
| 293 | * %MEDIA_ENT_FL_DEFAULT indicates the default entity for a given type. | 314 | * %MEDIA_ENT_FL_DEFAULT |
| 294 | * This can be used to report the default audio and video devices or the | 315 | * indicates the default entity for a given type. |
| 295 | * default camera sensor. | 316 | * This can be used to report the default audio and video devices or the |
| 317 | * default camera sensor. | ||
| 296 | * | 318 | * |
| 297 | * .. note:: | 319 | * .. note:: |
| 298 | * | 320 | * |
| @@ -331,8 +353,10 @@ void media_device_unregister_entity(struct media_entity *entity); | |||
| 331 | * @mdev: The media device | 353 | * @mdev: The media device |
| 332 | * @nptr: The media_entity_notify | 354 | * @nptr: The media_entity_notify |
| 333 | * | 355 | * |
| 334 | * Note: When a new entity is registered, all the registered | 356 | * .. note:: |
| 335 | * media_entity_notify callbacks are invoked. | 357 | * |
| 358 | * When a new entity is registered, all the registered | ||
| 359 | * media_entity_notify callbacks are invoked. | ||
| 336 | */ | 360 | */ |
| 337 | 361 | ||
| 338 | int __must_check media_device_register_entity_notify(struct media_device *mdev, | 362 | int __must_check media_device_register_entity_notify(struct media_device *mdev, |
| @@ -410,11 +434,13 @@ void media_device_pci_init(struct media_device *mdev, | |||
| 410 | * @board_name: media device name. If %NULL, the routine will use the usb | 434 | * @board_name: media device name. If %NULL, the routine will use the usb |
| 411 | * product name, if available. | 435 | * product name, if available. |
| 412 | * @driver_name: name of the driver. if %NULL, the routine will use the name | 436 | * @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 | 437 | * given by ``udev->dev->driver->name``, with is usually the wrong |
| 414 | * thing to do. | 438 | * thing to do. |
| 415 | * | 439 | * |
| 416 | * NOTE: It is better to call media_device_usb_init() instead, as | 440 | * .. note:: |
| 417 | * such macro fills driver_name with %KBUILD_MODNAME. | 441 | * |
| 442 | * It is better to call media_device_usb_init() instead, as | ||
| 443 | * such macro fills driver_name with %KBUILD_MODNAME. | ||
| 418 | */ | 444 | */ |
| 419 | void __media_device_usb_init(struct media_device *mdev, | 445 | void __media_device_usb_init(struct media_device *mdev, |
| 420 | struct usb_device *udev, | 446 | struct usb_device *udev, |
| @@ -472,6 +498,19 @@ static inline void __media_device_usb_init(struct media_device *mdev, | |||
| 472 | 498 | ||
| 473 | #endif /* CONFIG_MEDIA_CONTROLLER */ | 499 | #endif /* CONFIG_MEDIA_CONTROLLER */ |
| 474 | 500 | ||
| 501 | /** | ||
| 502 | * media_device_usb_init() - create and initialize a | ||
| 503 | * struct &media_device from a PCI device. | ||
| 504 | * | ||
| 505 | * @mdev: pointer to struct &media_device | ||
| 506 | * @udev: pointer to struct usb_device | ||
| 507 | * @name: media device name. If %NULL, the routine will use the usb | ||
| 508 | * product name, if available. | ||
| 509 | * | ||
| 510 | * This macro calls media_device_usb_init() passing the | ||
| 511 | * media_device_usb_init() **driver_name** parameter filled with | ||
| 512 | * %KBUILD_MODNAME. | ||
| 513 | */ | ||
| 475 | #define media_device_usb_init(mdev, udev, name) \ | 514 | #define media_device_usb_init(mdev, udev, name) \ |
| 476 | __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) | 515 | __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) |
| 477 | 516 | ||
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index 37d494805944..cd23e915764c 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h | |||
| @@ -75,8 +75,9 @@ 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 | * routine at media-device.c. | ||
| 80 | * | 81 | * |
| 81 | * This structure represents a media-related device node. | 82 | * This structure represents a media-related device node. |
| 82 | * | 83 | * |
diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 09b03c17784d..b2203ee7a4c1 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 |
| @@ -129,7 +129,7 @@ struct media_pipeline { | |||
| 129 | * an interface. | 129 | * an interface. |
| 130 | * @gobj1: Part of a union. Used to get the pointer for the second | 130 | * @gobj1: Part of a union. Used to get the pointer for the second |
| 131 | * graph_object of the link. | 131 | * graph_object of the link. |
| 132 | * @source: Part of a union. Used only if the second object (gobj1) is | 132 | * @sink: Part of a union. Used only if the second object (gobj1) is |
| 133 | * a pad. In that case, it represents the sink pad. | 133 | * a pad. In that case, it represents the sink pad. |
| 134 | * @entity: Part of a union. Used only if the second object (gobj1) is | 134 | * @entity: Part of a union. Used only if the second object (gobj1) is |
| 135 | * an entity. | 135 | * an entity. |
| @@ -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) |
| @@ -464,12 +474,13 @@ static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, | |||
| 464 | } | 474 | } |
| 465 | 475 | ||
| 466 | /** | 476 | /** |
| 467 | * media_entity_enum_test - Test whether the entity is marked, and mark it | 477 | * media_entity_enum_test_and_set - Test whether the entity is marked, |
| 478 | * and mark it | ||
| 468 | * | 479 | * |
| 469 | * @ent_enum: Entity enumeration | 480 | * @ent_enum: Entity enumeration |
| 470 | * @entity: Entity to be tested | 481 | * @entity: Entity to be tested |
| 471 | * | 482 | * |
| 472 | * Returns true if the entity was marked, and mark it before doing so. | 483 | * Returns %true if the entity was marked, and mark it before doing so. |
| 473 | */ | 484 | */ |
| 474 | static inline bool | 485 | static inline bool |
| 475 | media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, | 486 | media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, |
| @@ -486,7 +497,7 @@ media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, | |||
| 486 | * | 497 | * |
| 487 | * @ent_enum: Entity enumeration | 498 | * @ent_enum: Entity enumeration |
| 488 | * | 499 | * |
| 489 | * Returns true if the entity was marked. | 500 | * Return: %true if the entity was empty. |
| 490 | */ | 501 | */ |
| 491 | static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) | 502 | static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) |
| 492 | { | 503 | { |
| @@ -499,7 +510,8 @@ static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) | |||
| 499 | * @ent_enum1: First entity enumeration | 510 | * @ent_enum1: First entity enumeration |
| 500 | * @ent_enum2: Second entity enumeration | 511 | * @ent_enum2: Second entity enumeration |
| 501 | * | 512 | * |
| 502 | * Returns true if entity enumerations e and f intersect, otherwise false. | 513 | * Return: %true if entity enumerations @ent_enum1 and @ent_enum2 intersect, |
| 514 | * otherwise %false. | ||
| 503 | */ | 515 | */ |
| 504 | static inline bool media_entity_enum_intersects( | 516 | static inline bool media_entity_enum_intersects( |
| 505 | struct media_entity_enum *ent_enum1, | 517 | struct media_entity_enum *ent_enum1, |
| @@ -511,39 +523,63 @@ static inline bool media_entity_enum_intersects( | |||
| 511 | min(ent_enum1->idx_max, ent_enum2->idx_max)); | 523 | min(ent_enum1->idx_max, ent_enum2->idx_max)); |
| 512 | } | 524 | } |
| 513 | 525 | ||
| 526 | /** | ||
| 527 | * gobj_to_entity - returns the struct &media_entity pointer from the | ||
| 528 | * @gobj contained on it. | ||
| 529 | * | ||
| 530 | * @gobj: Pointer to the struct &media_gobj graph object | ||
| 531 | */ | ||
| 514 | #define gobj_to_entity(gobj) \ | 532 | #define gobj_to_entity(gobj) \ |
| 515 | container_of(gobj, struct media_entity, graph_obj) | 533 | container_of(gobj, struct media_entity, graph_obj) |
| 516 | 534 | ||
| 535 | /** | ||
| 536 | * gobj_to_pad - returns the struct &media_pad pointer from the | ||
| 537 | * @gobj contained on it. | ||
| 538 | * | ||
| 539 | * @gobj: Pointer to the struct &media_gobj graph object | ||
| 540 | */ | ||
| 517 | #define gobj_to_pad(gobj) \ | 541 | #define gobj_to_pad(gobj) \ |
| 518 | container_of(gobj, struct media_pad, graph_obj) | 542 | container_of(gobj, struct media_pad, graph_obj) |
| 519 | 543 | ||
| 544 | /** | ||
| 545 | * gobj_to_link - returns the struct &media_link pointer from the | ||
| 546 | * @gobj contained on it. | ||
| 547 | * | ||
| 548 | * @gobj: Pointer to the struct &media_gobj graph object | ||
| 549 | */ | ||
| 520 | #define gobj_to_link(gobj) \ | 550 | #define gobj_to_link(gobj) \ |
| 521 | container_of(gobj, struct media_link, graph_obj) | 551 | container_of(gobj, struct media_link, graph_obj) |
| 522 | 552 | ||
| 523 | #define gobj_to_link(gobj) \ | 553 | /** |
| 524 | container_of(gobj, struct media_link, graph_obj) | 554 | * gobj_to_intf - returns the struct &media_interface pointer from the |
| 525 | 555 | * @gobj contained on it. | |
| 526 | #define gobj_to_pad(gobj) \ | 556 | * |
| 527 | container_of(gobj, struct media_pad, graph_obj) | 557 | * @gobj: Pointer to the struct &media_gobj graph object |
| 528 | 558 | */ | |
| 529 | #define gobj_to_intf(gobj) \ | 559 | #define gobj_to_intf(gobj) \ |
| 530 | container_of(gobj, struct media_interface, graph_obj) | 560 | container_of(gobj, struct media_interface, graph_obj) |
| 531 | 561 | ||
| 562 | /** | ||
| 563 | * intf_to_devnode - returns the struct media_intf_devnode pointer from the | ||
| 564 | * @intf contained on it. | ||
| 565 | * | ||
| 566 | * @intf: Pointer to struct &media_intf_devnode | ||
| 567 | */ | ||
| 532 | #define intf_to_devnode(intf) \ | 568 | #define intf_to_devnode(intf) \ |
| 533 | container_of(intf, struct media_intf_devnode, intf) | 569 | container_of(intf, struct media_intf_devnode, intf) |
| 534 | 570 | ||
| 535 | /** | 571 | /** |
| 536 | * media_gobj_create - Initialize a graph object | 572 | * media_gobj_create - Initialize a graph object |
| 537 | * | 573 | * |
| 538 | * @mdev: Pointer to the media_device that contains the object | 574 | * @mdev: Pointer to the &media_device that contains the object |
| 539 | * @type: Type of the object | 575 | * @type: Type of the object |
| 540 | * @gobj: Pointer to the graph object | 576 | * @gobj: Pointer to the struct &media_gobj graph object |
| 541 | * | 577 | * |
| 542 | * This routine initializes the embedded struct media_gobj inside a | 578 | * This routine initializes the embedded struct &media_gobj inside a |
| 543 | * media graph object. It is called automatically if media_*_create\(\) | 579 | * media graph object. It is called automatically if ``media_*_create`` |
| 544 | * calls are used. However, if the object (entity, link, pad, interface) | 580 | * function calls are used. However, if the object (entity, link, pad, |
| 545 | * is embedded on some other object, this function should be called before | 581 | * interface) is embedded on some other object, this function should be |
| 546 | * registering the object at the media controller. | 582 | * called before registering the object at the media controller. |
| 547 | */ | 583 | */ |
| 548 | void media_gobj_create(struct media_device *mdev, | 584 | void media_gobj_create(struct media_device *mdev, |
| 549 | enum media_gobj_type type, | 585 | enum media_gobj_type type, |
| @@ -552,7 +588,7 @@ void media_gobj_create(struct media_device *mdev, | |||
| 552 | /** | 588 | /** |
| 553 | * media_gobj_destroy - Stop using a graph object on a media device | 589 | * media_gobj_destroy - Stop using a graph object on a media device |
| 554 | * | 590 | * |
| 555 | * @gobj: Pointer to the graph object | 591 | * @gobj: Pointer to the struct &media_gobj graph object |
| 556 | * | 592 | * |
| 557 | * This should be called by all routines like media_device_unregister() | 593 | * This should be called by all routines like media_device_unregister() |
| 558 | * that remove/destroy media graph objects. | 594 | * that remove/destroy media graph objects. |
| @@ -567,11 +603,11 @@ void media_gobj_destroy(struct media_gobj *gobj); | |||
| 567 | * @pads: Array of @num_pads pads. | 603 | * @pads: Array of @num_pads pads. |
| 568 | * | 604 | * |
| 569 | * The pads array is managed by the entity driver and passed to | 605 | * The pads array is managed by the entity driver and passed to |
| 570 | * media_entity_pads_init() where its pointer will be stored in the entity | 606 | * media_entity_pads_init() where its pointer will be stored in the |
| 571 | * structure. | 607 | * &media_entity structure. |
| 572 | * | 608 | * |
| 573 | * If no pads are needed, drivers could either directly fill | 609 | * If no pads are needed, drivers could either directly fill |
| 574 | * &media_entity->@num_pads with 0 and &media_entity->@pads with NULL or call | 610 | * &media_entity->num_pads with 0 and &media_entity->pads with %NULL or call |
| 575 | * this function that will do the same. | 611 | * this function that will do the same. |
| 576 | * | 612 | * |
| 577 | * As the number of pads is known in advance, the pads array is not allocated | 613 | * As the number of pads is known in advance, the pads array is not allocated |
| @@ -601,18 +637,21 @@ static inline void media_entity_cleanup(struct media_entity *entity) {}; | |||
| 601 | * @source_pad: number of the source pad in the pads array | 637 | * @source_pad: number of the source pad in the pads array |
| 602 | * @sink: pointer to &media_entity of the sink pad. | 638 | * @sink: pointer to &media_entity of the sink pad. |
| 603 | * @sink_pad: number of the sink pad in the pads array. | 639 | * @sink_pad: number of the sink pad in the pads array. |
| 604 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 640 | * @flags: Link flags, as defined in |
| 641 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
| 642 | * ( seek for ``MEDIA_LNK_FL_*``) | ||
| 605 | * | 643 | * |
| 606 | * Valid values for flags: | 644 | * Valid values for flags: |
| 607 | * | 645 | * |
| 608 | * - A %MEDIA_LNK_FL_ENABLED flag indicates that the link is enabled and can | 646 | * %MEDIA_LNK_FL_ENABLED |
| 609 | * be used to transfer media data. When two or more links target a sink pad, | 647 | * Indicates that the link is enabled and can be used to transfer media data. |
| 610 | * only one of them can be enabled at a time. | 648 | * When two or more links target a sink pad, only one of them can be |
| 649 | * enabled at a time. | ||
| 611 | * | 650 | * |
| 612 | * - A %MEDIA_LNK_FL_IMMUTABLE flag indicates that the link enabled state can't | 651 | * %MEDIA_LNK_FL_IMMUTABLE |
| 613 | * be modified at runtime. If %MEDIA_LNK_FL_IMMUTABLE is set, then | 652 | * Indicates that the link enabled state can't be modified at runtime. If |
| 614 | * %MEDIA_LNK_FL_ENABLED must also be set since an immutable link is | 653 | * %MEDIA_LNK_FL_IMMUTABLE is set, then %MEDIA_LNK_FL_ENABLED must also be |
| 615 | * always enabled. | 654 | * set, since an immutable link is always enabled. |
| 616 | * | 655 | * |
| 617 | * .. note:: | 656 | * .. note:: |
| 618 | * | 657 | * |
| @@ -630,17 +669,17 @@ __must_check int media_create_pad_link(struct media_entity *source, | |||
| 630 | * @source_function: Function of the source entities. Used only if @source is | 669 | * @source_function: Function of the source entities. Used only if @source is |
| 631 | * NULL. | 670 | * NULL. |
| 632 | * @source: pointer to &media_entity of the source pad. If NULL, it will use | 671 | * @source: pointer to &media_entity of the source pad. If NULL, it will use |
| 633 | * all entities that matches the @sink_function. | 672 | * all entities that matches the @sink_function. |
| 634 | * @source_pad: number of the source pad in the pads array | 673 | * @source_pad: number of the source pad in the pads array |
| 635 | * @sink_function: Function of the sink entities. Used only if @sink is NULL. | 674 | * @sink_function: Function of the sink entities. Used only if @sink is NULL. |
| 636 | * @sink: pointer to &media_entity of the sink pad. If NULL, it will use | 675 | * @sink: pointer to &media_entity of the sink pad. If NULL, it will use |
| 637 | * all entities that matches the @sink_function. | 676 | * all entities that matches the @sink_function. |
| 638 | * @sink_pad: number of the sink pad in the pads array. | 677 | * @sink_pad: number of the sink pad in the pads array. |
| 639 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 678 | * @flags: Link flags, as defined in include/uapi/linux/media.h. |
| 640 | * @allow_both_undefined: if true, then both @source and @sink can be NULL. | 679 | * @allow_both_undefined: if %true, then both @source and @sink can be NULL. |
| 641 | * In such case, it will create a crossbar between all entities that | 680 | * In such case, it will create a crossbar between all entities that |
| 642 | * matches @source_function to all entities that matches @sink_function. | 681 | * matches @source_function to all entities that matches @sink_function. |
| 643 | * If false, it will return 0 and won't create any link if both @source | 682 | * If %false, it will return 0 and won't create any link if both @source |
| 644 | * and @sink are NULL. | 683 | * and @sink are NULL. |
| 645 | * | 684 | * |
| 646 | * Valid values for flags: | 685 | * Valid values for flags: |
| @@ -660,9 +699,11 @@ __must_check int media_create_pad_link(struct media_entity *source, | |||
| 660 | * creates link by link, this function is meant to allow 1:n, n:1 and even | 699 | * creates link by link, this function is meant to allow 1:n, n:1 and even |
| 661 | * cross-bar (n:n) links. | 700 | * cross-bar (n:n) links. |
| 662 | * | 701 | * |
| 663 | * NOTE: Before calling this function, media_entity_pads_init() and | 702 | * .. note:: |
| 664 | * media_device_register_entity() should be called previously for the entities | 703 | * |
| 665 | * to be linked. | 704 | * Before calling this function, media_entity_pads_init() and |
| 705 | * media_device_register_entity() should be called previously for the | ||
| 706 | * entities to be linked. | ||
| 666 | */ | 707 | */ |
| 667 | int media_create_pad_links(const struct media_device *mdev, | 708 | int media_create_pad_links(const struct media_device *mdev, |
| 668 | const u32 source_function, | 709 | const u32 source_function, |
| @@ -721,7 +762,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); | |||
| 721 | * flags. | 762 | * flags. |
| 722 | * | 763 | * |
| 723 | * Media device drivers can be notified of link setup operations by setting the | 764 | * Media device drivers can be notified of link setup operations by setting the |
| 724 | * media_device::link_notify pointer to a callback function. If provided, the | 765 | * &media_device.link_notify pointer to a callback function. If provided, the |
| 725 | * notification callback will be called before enabling and after disabling | 766 | * notification callback will be called before enabling and after disabling |
| 726 | * links. | 767 | * links. |
| 727 | * | 768 | * |
| @@ -731,7 +772,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); | |||
| 731 | * | 772 | * |
| 732 | * Link configuration must not have any side effect on other links. If an | 773 | * Link configuration must not have any side effect on other links. If an |
| 733 | * enabled link at a sink pad prevents another link at the same pad from | 774 | * enabled link at a sink pad prevents another link at the same pad from |
| 734 | * being enabled, the link_setup operation must return -EBUSY and can't | 775 | * being enabled, the link_setup operation must return %-EBUSY and can't |
| 735 | * implicitly disable the first enabled link. | 776 | * implicitly disable the first enabled link. |
| 736 | * | 777 | * |
| 737 | * .. note:: | 778 | * .. note:: |
| @@ -747,8 +788,8 @@ int media_entity_setup_link(struct media_link *link, u32 flags); | |||
| 747 | * @source: Source pad | 788 | * @source: Source pad |
| 748 | * @sink: Sink pad | 789 | * @sink: Sink pad |
| 749 | * | 790 | * |
| 750 | * Return a pointer to the link between the two entities. If no such link | 791 | * Return: returns a pointer to the link between the two entities. If no |
| 751 | * exists, return NULL. | 792 | * such link exists, return %NULL. |
| 752 | */ | 793 | */ |
| 753 | struct media_link *media_entity_find_link(struct media_pad *source, | 794 | struct media_link *media_entity_find_link(struct media_pad *source, |
| 754 | struct media_pad *sink); | 795 | struct media_pad *sink); |
| @@ -760,8 +801,8 @@ struct media_link *media_entity_find_link(struct media_pad *source, | |||
| 760 | * Search for a remote pad connected to the given pad by iterating over all | 801 | * Search for a remote pad connected to the given pad by iterating over all |
| 761 | * links originating or terminating at that pad until an enabled link is found. | 802 | * links originating or terminating at that pad until an enabled link is found. |
| 762 | * | 803 | * |
| 763 | * Return a pointer to the pad at the remote end of the first found enabled | 804 | * Return: returns a pointer to the pad at the remote end of the first found |
| 764 | * link, or NULL if no enabled link has been found. | 805 | * enabled link, or %NULL if no enabled link has been found. |
| 765 | */ | 806 | */ |
| 766 | struct media_pad *media_entity_remote_pad(struct media_pad *pad); | 807 | struct media_pad *media_entity_remote_pad(struct media_pad *pad); |
| 767 | 808 | ||
| @@ -772,12 +813,18 @@ struct media_pad *media_entity_remote_pad(struct media_pad *pad); | |||
| 772 | * | 813 | * |
| 773 | * Get a reference to the parent media device module. | 814 | * Get a reference to the parent media device module. |
| 774 | * | 815 | * |
| 775 | * The function will return immediately if @entity is NULL. | 816 | * The function will return immediately if @entity is %NULL. |
| 776 | * | 817 | * |
| 777 | * Return a pointer to the entity on success or NULL on failure. | 818 | * Return: returns a pointer to the entity on success or %NULL on failure. |
| 778 | */ | 819 | */ |
| 779 | struct media_entity *media_entity_get(struct media_entity *entity); | 820 | struct media_entity *media_entity_get(struct media_entity *entity); |
| 780 | 821 | ||
| 822 | /** | ||
| 823 | * media_entity_graph_walk_init - Allocate resources used by graph walk. | ||
| 824 | * | ||
| 825 | * @graph: Media graph structure that will be used to walk the graph | ||
| 826 | * @mdev: Pointer to the &media_device that contains the object | ||
| 827 | */ | ||
| 781 | __must_check int media_entity_graph_walk_init( | 828 | __must_check int media_entity_graph_walk_init( |
| 782 | struct media_entity_graph *graph, struct media_device *mdev); | 829 | struct media_entity_graph *graph, struct media_device *mdev); |
| 783 | 830 | ||
| @@ -795,12 +842,14 @@ void media_entity_graph_walk_cleanup(struct media_entity_graph *graph); | |||
| 795 | * | 842 | * |
| 796 | * Release the reference count acquired by media_entity_get(). | 843 | * Release the reference count acquired by media_entity_get(). |
| 797 | * | 844 | * |
| 798 | * The function will return immediately if @entity is NULL. | 845 | * The function will return immediately if @entity is %NULL. |
| 799 | */ | 846 | */ |
| 800 | void media_entity_put(struct media_entity *entity); | 847 | void media_entity_put(struct media_entity *entity); |
| 801 | 848 | ||
| 802 | /** | 849 | /** |
| 803 | * media_entity_graph_walk_start - Start walking the media graph at a given entity | 850 | * media_entity_graph_walk_start - Start walking the media graph at a |
| 851 | * given entity | ||
| 852 | * | ||
| 804 | * @graph: Media graph structure that will be used to walk the graph | 853 | * @graph: Media graph structure that will be used to walk the graph |
| 805 | * @entity: Starting entity | 854 | * @entity: Starting entity |
| 806 | * | 855 | * |
| @@ -824,8 +873,8 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, | |||
| 824 | * The graph structure must have been previously initialized with a call to | 873 | * The graph structure must have been previously initialized with a call to |
| 825 | * media_entity_graph_walk_start(). | 874 | * media_entity_graph_walk_start(). |
| 826 | * | 875 | * |
| 827 | * Return the next entity in the graph or NULL if the whole graph have been | 876 | * Return: returns the next entity in the graph or %NULL if the whole graph |
| 828 | * traversed. | 877 | * have been traversed. |
| 829 | */ | 878 | */ |
| 830 | struct media_entity * | 879 | struct media_entity * |
| 831 | media_entity_graph_walk_next(struct media_entity_graph *graph); | 880 | media_entity_graph_walk_next(struct media_entity_graph *graph); |
| @@ -836,8 +885,8 @@ media_entity_graph_walk_next(struct media_entity_graph *graph); | |||
| 836 | * @pipe: Media pipeline to be assigned to all entities in the pipeline. | 885 | * @pipe: Media pipeline to be assigned to all entities in the pipeline. |
| 837 | * | 886 | * |
| 838 | * Mark all entities connected to a given entity through enabled links, either | 887 | * Mark all entities connected to a given entity through enabled links, either |
| 839 | * directly or indirectly, as streaming. The given pipeline object is assigned to | 888 | * directly or indirectly, as streaming. The given pipeline object is assigned |
| 840 | * every entity in the pipeline and stored in the media_entity pipe field. | 889 | * to every entity in the pipeline and stored in the media_entity pipe field. |
| 841 | * | 890 | * |
| 842 | * Calls to this function can be nested, in which case the same number of | 891 | * Calls to this function can be nested, in which case the same number of |
| 843 | * media_entity_pipeline_stop() calls will be required to stop streaming. The | 892 | * media_entity_pipeline_stop() calls will be required to stop streaming. The |
| @@ -863,7 +912,7 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity, | |||
| 863 | * | 912 | * |
| 864 | * Mark all entities connected to a given entity through enabled links, either | 913 | * Mark all entities connected to a given entity through enabled links, either |
| 865 | * directly or indirectly, as not streaming. The media_entity pipe field is | 914 | * directly or indirectly, as not streaming. The media_entity pipe field is |
| 866 | * reset to NULL. | 915 | * reset to %NULL. |
| 867 | * | 916 | * |
| 868 | * If multiple calls to media_entity_pipeline_start() have been made, the same | 917 | * If multiple calls to media_entity_pipeline_start() have been made, the same |
| 869 | * number of calls to this function are required to mark the pipeline as not | 918 | * number of calls to this function are required to mark the pipeline as not |
| @@ -884,14 +933,21 @@ void __media_entity_pipeline_stop(struct media_entity *entity); | |||
| 884 | * media_devnode_create() - creates and initializes a device node interface | 933 | * media_devnode_create() - creates and initializes a device node interface |
| 885 | * | 934 | * |
| 886 | * @mdev: pointer to struct &media_device | 935 | * @mdev: pointer to struct &media_device |
| 887 | * @type: type of the interface, as given by MEDIA_INTF_T_* macros | 936 | * @type: type of the interface, as given by |
| 888 | * as defined in the uapi/media/media.h header. | 937 | * :ref:`include/uapi/linux/media.h <media_header>` |
| 889 | * @flags: Interface flags as defined in uapi/media/media.h. | 938 | * ( seek for ``MEDIA_INTF_T_*``) macros. |
| 939 | * @flags: Interface flags, as defined in | ||
| 940 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
| 941 | * ( seek for ``MEDIA_INTF_FL_*``) | ||
| 890 | * @major: Device node major number. | 942 | * @major: Device node major number. |
| 891 | * @minor: Device node minor number. | 943 | * @minor: Device node minor number. |
| 892 | * | 944 | * |
| 893 | * Return: if succeeded, returns a pointer to the newly allocated | 945 | * Return: if succeeded, returns a pointer to the newly allocated |
| 894 | * &media_intf_devnode pointer. | 946 | * &media_intf_devnode pointer. |
| 947 | * | ||
| 948 | * .. note:: | ||
| 949 | * | ||
| 950 | * Currently, no flags for &media_interface is defined. | ||
| 895 | */ | 951 | */ |
| 896 | struct media_intf_devnode * | 952 | struct media_intf_devnode * |
| 897 | __must_check media_devnode_create(struct media_device *mdev, | 953 | __must_check media_devnode_create(struct media_device *mdev, |
| @@ -913,15 +969,19 @@ struct media_link * | |||
| 913 | * | 969 | * |
| 914 | * @entity: pointer to %media_entity | 970 | * @entity: pointer to %media_entity |
| 915 | * @intf: pointer to %media_interface | 971 | * @intf: pointer to %media_interface |
| 916 | * @flags: Link flags, as defined in include/uapi/linux/media.h. | 972 | * @flags: Link flags, as defined in |
| 973 | * :ref:`include/uapi/linux/media.h <media_header>` | ||
| 974 | * ( seek for ``MEDIA_LNK_FL_*``) | ||
| 917 | * | 975 | * |
| 918 | * | 976 | * |
| 919 | * Valid values for flags: | 977 | * Valid values for flags: |
| 920 | * | 978 | * |
| 921 | * - The %MEDIA_LNK_FL_ENABLED flag indicates that the interface is connected to | 979 | * %MEDIA_LNK_FL_ENABLED |
| 922 | * the entity hardware. That's the default value for interfaces. An | 980 | * Indicates that the interface is connected to the entity hardware. |
| 923 | * interface may be disabled if the hardware is busy due to the usage | 981 | * That's the default value for interfaces. An interface may be disabled if |
| 924 | * of some other interface that it is currently controlling the hardware. | 982 | * the hardware is busy due to the usage of some other interface that it is |
| 983 | * currently controlling the hardware. | ||
| 984 | * | ||
| 925 | * A typical example is an hybrid TV device that handle only one type of | 985 | * A typical example is an hybrid TV device that handle only one type of |
| 926 | * stream on a given time. So, when the digital TV is streaming, | 986 | * stream on a given time. So, when the digital TV is streaming, |
| 927 | * the V4L2 interfaces won't be enabled, as such device is not able to | 987 | * the V4L2 interfaces won't be enabled, as such device is not able to |
| @@ -977,6 +1037,18 @@ void __media_remove_intf_links(struct media_interface *intf); | |||
| 977 | */ | 1037 | */ |
| 978 | void media_remove_intf_links(struct media_interface *intf); | 1038 | void media_remove_intf_links(struct media_interface *intf); |
| 979 | 1039 | ||
| 1040 | /** | ||
| 1041 | * media_entity_call - Calls a struct media_entity_operations operation on | ||
| 1042 | * an entity | ||
| 1043 | * | ||
| 1044 | * @entity: entity where the @operation will be called | ||
| 1045 | * @operation: type of the operation. Should be the name of a member of | ||
| 1046 | * struct &media_entity_operations. | ||
| 1047 | * | ||
| 1048 | * This helper function will check if @operation is not %NULL. On such case, | ||
| 1049 | * it will issue a call to @operation\(@entity, @args\). | ||
| 1050 | */ | ||
| 1051 | |||
| 980 | #define media_entity_call(entity, operation, args...) \ | 1052 | #define media_entity_call(entity, operation, args...) \ |
| 981 | (((entity)->ops && (entity)->ops->operation) ? \ | 1053 | (((entity)->ops && (entity)->ops->operation) ? \ |
| 982 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) | 1054 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) |
diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 10908e356b23..40188d362486 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h | |||
| @@ -231,7 +231,7 @@ void rc_unregister_device(struct rc_dev *dev); | |||
| 231 | int rc_open(struct rc_dev *rdev); | 231 | int rc_open(struct rc_dev *rdev); |
| 232 | 232 | ||
| 233 | /** | 233 | /** |
| 234 | * rc_open - Closes a RC device | 234 | * rc_close - Closes a RC device |
| 235 | * | 235 | * |
| 236 | * @rdev: pointer to struct rc_dev. | 236 | * @rdev: pointer to struct rc_dev. |
| 237 | */ | 237 | */ |
diff --git a/include/media/rc-map.h b/include/media/rc-map.h index daa75fcc1ff1..e1cc14cba391 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h | |||
| @@ -11,27 +11,55 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/input.h> | 12 | #include <linux/input.h> |
| 13 | 13 | ||
| 14 | /** | ||
| 15 | * enum rc_type - type of the Remote Controller protocol | ||
| 16 | * | ||
| 17 | * @RC_TYPE_UNKNOWN: Protocol not known | ||
| 18 | * @RC_TYPE_OTHER: Protocol known but proprietary | ||
| 19 | * @RC_TYPE_RC5: Philips RC5 protocol | ||
| 20 | * @RC_TYPE_RC5X: Philips RC5x protocol | ||
| 21 | * @RC_TYPE_RC5_SZ: StreamZap variant of RC5 | ||
| 22 | * @RC_TYPE_JVC: JVC protocol | ||
| 23 | * @RC_TYPE_SONY12: Sony 12 bit protocol | ||
| 24 | * @RC_TYPE_SONY15: Sony 15 bit protocol | ||
| 25 | * @RC_TYPE_SONY20: Sony 20 bit protocol | ||
| 26 | * @RC_TYPE_NEC: NEC protocol | ||
| 27 | * @RC_TYPE_NECX: Extended NEC protocol | ||
| 28 | * @RC_TYPE_NEC32: NEC 32 bit protocol | ||
| 29 | * @RC_TYPE_SANYO: Sanyo protocol | ||
| 30 | * @RC_TYPE_MCE_KBD: RC6-ish MCE keyboard/mouse | ||
| 31 | * @RC_TYPE_RC6_0: Philips RC6-0-16 protocol | ||
| 32 | * @RC_TYPE_RC6_6A_20: Philips RC6-6A-20 protocol | ||
| 33 | * @RC_TYPE_RC6_6A_24: Philips RC6-6A-24 protocol | ||
| 34 | * @RC_TYPE_RC6_6A_32: Philips RC6-6A-32 protocol | ||
| 35 | * @RC_TYPE_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol | ||
| 36 | * @RC_TYPE_SHARP: Sharp protocol | ||
| 37 | * @RC_TYPE_XMP: XMP protocol | ||
| 38 | * @RC_TYPE_CEC: CEC protocol | ||
| 39 | */ | ||
| 14 | enum rc_type { | 40 | enum rc_type { |
| 15 | RC_TYPE_UNKNOWN = 0, /* Protocol not known */ | 41 | RC_TYPE_UNKNOWN = 0, |
| 16 | RC_TYPE_OTHER = 1, /* Protocol known but proprietary */ | 42 | RC_TYPE_OTHER = 1, |
| 17 | RC_TYPE_RC5 = 2, /* Philips RC5 protocol */ | 43 | RC_TYPE_RC5 = 2, |
| 18 | RC_TYPE_RC5X = 3, /* Philips RC5x protocol */ | 44 | RC_TYPE_RC5X = 3, |
| 19 | RC_TYPE_RC5_SZ = 4, /* StreamZap variant of RC5 */ | 45 | RC_TYPE_RC5_SZ = 4, |
| 20 | RC_TYPE_JVC = 5, /* JVC protocol */ | 46 | RC_TYPE_JVC = 5, |
| 21 | RC_TYPE_SONY12 = 6, /* Sony 12 bit protocol */ | 47 | RC_TYPE_SONY12 = 6, |
| 22 | RC_TYPE_SONY15 = 7, /* Sony 15 bit protocol */ | 48 | RC_TYPE_SONY15 = 7, |
| 23 | RC_TYPE_SONY20 = 8, /* Sony 20 bit protocol */ | 49 | RC_TYPE_SONY20 = 8, |
| 24 | RC_TYPE_NEC = 9, /* NEC protocol */ | 50 | RC_TYPE_NEC = 9, |
| 25 | RC_TYPE_SANYO = 10, /* Sanyo protocol */ | 51 | RC_TYPE_NECX = 10, |
| 26 | RC_TYPE_MCE_KBD = 11, /* RC6-ish MCE keyboard/mouse */ | 52 | RC_TYPE_NEC32 = 11, |
| 27 | RC_TYPE_RC6_0 = 12, /* Philips RC6-0-16 protocol */ | 53 | RC_TYPE_SANYO = 12, |
| 28 | RC_TYPE_RC6_6A_20 = 13, /* Philips RC6-6A-20 protocol */ | 54 | RC_TYPE_MCE_KBD = 13, |
| 29 | RC_TYPE_RC6_6A_24 = 14, /* Philips RC6-6A-24 protocol */ | 55 | RC_TYPE_RC6_0 = 14, |
| 30 | RC_TYPE_RC6_6A_32 = 15, /* Philips RC6-6A-32 protocol */ | 56 | RC_TYPE_RC6_6A_20 = 15, |
| 31 | RC_TYPE_RC6_MCE = 16, /* MCE (Philips RC6-6A-32 subtype) protocol */ | 57 | RC_TYPE_RC6_6A_24 = 16, |
| 32 | RC_TYPE_SHARP = 17, /* Sharp protocol */ | 58 | RC_TYPE_RC6_6A_32 = 17, |
| 33 | RC_TYPE_XMP = 18, /* XMP protocol */ | 59 | RC_TYPE_RC6_MCE = 18, |
| 34 | RC_TYPE_CEC = 19, /* CEC protocol */ | 60 | RC_TYPE_SHARP = 19, |
| 61 | RC_TYPE_XMP = 20, | ||
| 62 | RC_TYPE_CEC = 21, | ||
| 35 | }; | 63 | }; |
| 36 | 64 | ||
| 37 | #define RC_BIT_NONE 0ULL | 65 | #define RC_BIT_NONE 0ULL |
| @@ -45,6 +73,8 @@ enum rc_type { | |||
| 45 | #define RC_BIT_SONY15 (1ULL << RC_TYPE_SONY15) | 73 | #define RC_BIT_SONY15 (1ULL << RC_TYPE_SONY15) |
| 46 | #define RC_BIT_SONY20 (1ULL << RC_TYPE_SONY20) | 74 | #define RC_BIT_SONY20 (1ULL << RC_TYPE_SONY20) |
| 47 | #define RC_BIT_NEC (1ULL << RC_TYPE_NEC) | 75 | #define RC_BIT_NEC (1ULL << RC_TYPE_NEC) |
| 76 | #define RC_BIT_NECX (1ULL << RC_TYPE_NECX) | ||
| 77 | #define RC_BIT_NEC32 (1ULL << RC_TYPE_NEC32) | ||
| 48 | #define RC_BIT_SANYO (1ULL << RC_TYPE_SANYO) | 78 | #define RC_BIT_SANYO (1ULL << RC_TYPE_SANYO) |
| 49 | #define RC_BIT_MCE_KBD (1ULL << RC_TYPE_MCE_KBD) | 79 | #define RC_BIT_MCE_KBD (1ULL << RC_TYPE_MCE_KBD) |
| 50 | #define RC_BIT_RC6_0 (1ULL << RC_TYPE_RC6_0) | 80 | #define RC_BIT_RC6_0 (1ULL << RC_TYPE_RC6_0) |
| @@ -60,8 +90,9 @@ enum rc_type { | |||
| 60 | RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ | 90 | RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ |
| 61 | RC_BIT_JVC | \ | 91 | RC_BIT_JVC | \ |
| 62 | RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ | 92 | RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ |
| 63 | RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ | 93 | RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ |
| 64 | RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ | 94 | RC_BIT_SANYO | RC_BIT_MCE_KBD | RC_BIT_RC6_0 | \ |
| 95 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ | ||
| 65 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ | 96 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ |
| 66 | RC_BIT_XMP | RC_BIT_CEC) | 97 | RC_BIT_XMP | RC_BIT_CEC) |
| 67 | 98 | ||
| @@ -76,21 +107,45 @@ enum rc_type { | |||
| 76 | #define RC_SCANCODE_RC6_0(sys, cmd) (((sys) << 8) | (cmd)) | 107 | #define RC_SCANCODE_RC6_0(sys, cmd) (((sys) << 8) | (cmd)) |
| 77 | #define RC_SCANCODE_RC6_6A(vendor, sys, cmd) (((vendor) << 16) | ((sys) << 8) | (cmd)) | 108 | #define RC_SCANCODE_RC6_6A(vendor, sys, cmd) (((vendor) << 16) | ((sys) << 8) | (cmd)) |
| 78 | 109 | ||
| 110 | /** | ||
| 111 | * struct rc_map_table - represents a scancode/keycode pair | ||
| 112 | * | ||
| 113 | * @scancode: scan code (u32) | ||
| 114 | * @keycode: Linux input keycode | ||
| 115 | */ | ||
| 79 | struct rc_map_table { | 116 | struct rc_map_table { |
| 80 | u32 scancode; | 117 | u32 scancode; |
| 81 | u32 keycode; | 118 | u32 keycode; |
| 82 | }; | 119 | }; |
| 83 | 120 | ||
| 121 | /** | ||
| 122 | * struct rc_map - represents a keycode map table | ||
| 123 | * | ||
| 124 | * @scan: pointer to struct &rc_map_table | ||
| 125 | * @size: Max number of entries | ||
| 126 | * @len: Number of entries that are in use | ||
| 127 | * @alloc: size of \*scan, in bytes | ||
| 128 | * @rc_type: type of the remote controller protocol, as defined at | ||
| 129 | * enum &rc_type | ||
| 130 | * @name: name of the key map table | ||
| 131 | * @lock: lock to protect access to this structure | ||
| 132 | */ | ||
| 84 | struct rc_map { | 133 | struct rc_map { |
| 85 | struct rc_map_table *scan; | 134 | struct rc_map_table *scan; |
| 86 | unsigned int size; /* Max number of entries */ | 135 | unsigned int size; |
| 87 | unsigned int len; /* Used number of entries */ | 136 | unsigned int len; |
| 88 | unsigned int alloc; /* Size of *scan in bytes */ | 137 | unsigned int alloc; |
| 89 | enum rc_type rc_type; | 138 | enum rc_type rc_type; |
| 90 | const char *name; | 139 | const char *name; |
| 91 | spinlock_t lock; | 140 | spinlock_t lock; |
| 92 | }; | 141 | }; |
| 93 | 142 | ||
| 143 | /** | ||
| 144 | * struct rc_map_list - list of the registered &rc_map maps | ||
| 145 | * | ||
| 146 | * @list: pointer to struct &list_head | ||
| 147 | * @map: pointer to struct &rc_map | ||
| 148 | */ | ||
| 94 | struct rc_map_list { | 149 | struct rc_map_list { |
| 95 | struct list_head list; | 150 | struct list_head list; |
| 96 | struct rc_map map; | 151 | struct rc_map map; |
diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h index 4c7fc77eaf29..8723f05c6321 100644 --- a/include/media/rcar-fcp.h +++ b/include/media/rcar-fcp.h | |||
| @@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) | |||
| 29 | static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { } | 29 | static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { } |
| 30 | static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp) | 30 | static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp) |
| 31 | { | 31 | { |
| 32 | return -ENOSYS; | 32 | return 0; |
| 33 | } | 33 | } |
| 34 | static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { } | 34 | static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { } |
| 35 | #endif | 35 | #endif |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 97aa13314bfd..1a15c3e4efd3 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -105,16 +105,13 @@ struct soc_camera_host_ops { | |||
| 105 | int (*get_formats)(struct soc_camera_device *, unsigned int, | 105 | int (*get_formats)(struct soc_camera_device *, unsigned int, |
| 106 | struct soc_camera_format_xlate *); | 106 | struct soc_camera_format_xlate *); |
| 107 | void (*put_formats)(struct soc_camera_device *); | 107 | void (*put_formats)(struct soc_camera_device *); |
| 108 | int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *); | ||
| 109 | int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *); | ||
| 110 | int (*set_crop)(struct soc_camera_device *, const struct v4l2_crop *); | ||
| 111 | int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *); | 108 | int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *); |
| 112 | int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *); | 109 | int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *); |
| 113 | /* | 110 | /* |
| 114 | * The difference to .set_crop() is, that .set_livecrop is not allowed | 111 | * The difference to .set_selection() is, that .set_liveselection is not allowed |
| 115 | * to change the output sizes | 112 | * to change the output sizes |
| 116 | */ | 113 | */ |
| 117 | int (*set_livecrop)(struct soc_camera_device *, const struct v4l2_crop *); | 114 | int (*set_liveselection)(struct soc_camera_device *, struct v4l2_selection *); |
| 118 | int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); | 115 | int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); |
| 119 | int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); | 116 | int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); |
| 120 | void (*init_videobuf)(struct videobuf_queue *, | 117 | void (*init_videobuf)(struct videobuf_queue *, |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 178a88d45aea..e1006b391cdc 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
| @@ -93,6 +93,16 @@ struct v4l2_ctrl_type_ops { | |||
| 93 | union v4l2_ctrl_ptr ptr); | 93 | union v4l2_ctrl_ptr ptr); |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | /** | ||
| 97 | * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function | ||
| 98 | * that should be called when a control value has changed. | ||
| 99 | * | ||
| 100 | * @ctrl: pointer to struct &v4l2_ctrl | ||
| 101 | * @priv: control private data | ||
| 102 | * | ||
| 103 | * This typedef definition is used as an argument to v4l2_ctrl_notify() | ||
| 104 | * and as an argument at struct &v4l2_ctrl_handler. | ||
| 105 | */ | ||
| 96 | typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); | 106 | typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); |
| 97 | 107 | ||
| 98 | /** | 108 | /** |
| @@ -229,7 +239,7 @@ struct v4l2_ctrl { | |||
| 229 | * @next: Single-link list node for the hash. | 239 | * @next: Single-link list node for the hash. |
| 230 | * @ctrl: The actual control information. | 240 | * @ctrl: The actual control information. |
| 231 | * @helper: Pointer to helper struct. Used internally in | 241 | * @helper: Pointer to helper struct. Used internally in |
| 232 | * prepare_ext_ctrls(). | 242 | * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``. |
| 233 | * | 243 | * |
| 234 | * Each control handler has a list of these refs. The list_head is used to | 244 | * Each control handler has a list of these refs. The list_head is used to |
| 235 | * keep a sorted-by-control-ID list of all controls, while the next pointer | 245 | * keep a sorted-by-control-ID list of all controls, while the next pointer |
| @@ -369,17 +379,39 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | |||
| 369 | * @key: Used by the lock validator if CONFIG_LOCKDEP is set. | 379 | * @key: Used by the lock validator if CONFIG_LOCKDEP is set. |
| 370 | * @name: Used by the lock validator if CONFIG_LOCKDEP is set. | 380 | * @name: Used by the lock validator if CONFIG_LOCKDEP is set. |
| 371 | * | 381 | * |
| 372 | * Returns an error if the buckets could not be allocated. This error will | 382 | * .. attention:: |
| 373 | * also be stored in @hdl->error. | 383 | * |
| 384 | * Never use this call directly, always use the v4l2_ctrl_handler_init() | ||
| 385 | * macro that hides the @key and @name arguments. | ||
| 374 | * | 386 | * |
| 375 | * Never use this call directly, always use the v4l2_ctrl_handler_init | 387 | * Return: returns an error if the buckets could not be allocated. This |
| 376 | * macro that hides the @key and @name arguments. | 388 | * error will also be stored in @hdl->error. |
| 377 | */ | 389 | */ |
| 378 | int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, | 390 | int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, |
| 379 | unsigned int nr_of_controls_hint, | 391 | unsigned int nr_of_controls_hint, |
| 380 | struct lock_class_key *key, const char *name); | 392 | struct lock_class_key *key, const char *name); |
| 381 | 393 | ||
| 382 | #ifdef CONFIG_LOCKDEP | 394 | #ifdef CONFIG_LOCKDEP |
| 395 | |||
| 396 | /** | ||
| 397 | * v4l2_ctrl_handler_init - helper function to create a static struct | ||
| 398 | * &lock_class_key and calls v4l2_ctrl_handler_init_class() | ||
| 399 | * | ||
| 400 | * @hdl: The control handler. | ||
| 401 | * @nr_of_controls_hint: A hint of how many controls this handler is | ||
| 402 | * expected to refer to. This is the total number, so including | ||
| 403 | * any inherited controls. It doesn't have to be precise, but if | ||
| 404 | * it is way off, then you either waste memory (too many buckets | ||
| 405 | * are allocated) or the control lookup becomes slower (not enough | ||
| 406 | * buckets are allocated, so there are more slow list lookups). | ||
| 407 | * It will always work, though. | ||
| 408 | * | ||
| 409 | * This helper function creates a static struct &lock_class_key and | ||
| 410 | * calls v4l2_ctrl_handler_init_class(), providing a proper name for the lock | ||
| 411 | * validador. | ||
| 412 | * | ||
| 413 | * Use this helper function to initialize a control handler. | ||
| 414 | */ | ||
| 383 | #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \ | 415 | #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \ |
| 384 | ( \ | 416 | ( \ |
| 385 | ({ \ | 417 | ({ \ |
| @@ -564,6 +596,13 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, | |||
| 564 | u32 id, u8 max, u8 def, | 596 | u32 id, u8 max, u8 def, |
| 565 | const s64 *qmenu_int); | 597 | const s64 *qmenu_int); |
| 566 | 598 | ||
| 599 | /** | ||
| 600 | * typedef v4l2_ctrl_filter - Typedef to define the filter function to be | ||
| 601 | * used when adding a control handler. | ||
| 602 | * | ||
| 603 | * @ctrl: pointer to struct &v4l2_ctrl. | ||
| 604 | */ | ||
| 605 | |||
| 567 | typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl); | 606 | typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl); |
| 568 | 607 | ||
| 569 | /** | 608 | /** |
| @@ -635,8 +674,8 @@ void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls); | |||
| 635 | * be marked active, and any reads will just return the current value without | 674 | * be marked active, and any reads will just return the current value without |
| 636 | * going through g_volatile_ctrl. | 675 | * going through g_volatile_ctrl. |
| 637 | * | 676 | * |
| 638 | * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag | 677 | * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag |
| 639 | * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s) | 678 | * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s) |
| 640 | * if autofoo is in auto mode. | 679 | * if autofoo is in auto mode. |
| 641 | */ | 680 | */ |
| 642 | void v4l2_ctrl_auto_cluster(unsigned int ncontrols, | 681 | void v4l2_ctrl_auto_cluster(unsigned int ncontrols, |
| @@ -686,7 +725,6 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | |||
| 686 | */ | 725 | */ |
| 687 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | 726 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); |
| 688 | 727 | ||
| 689 | |||
| 690 | /** | 728 | /** |
| 691 | *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() | 729 | *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() |
| 692 | * | 730 | * |
| @@ -936,9 +974,9 @@ extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; | |||
| 936 | * v4l2_ctrl_replace - Function to be used as a callback to | 974 | * v4l2_ctrl_replace - Function to be used as a callback to |
| 937 | * &struct v4l2_subscribed_event_ops replace\(\) | 975 | * &struct v4l2_subscribed_event_ops replace\(\) |
| 938 | * | 976 | * |
| 939 | * @old: pointer to :ref:`struct v4l2_event <v4l2-event>` with the reported | 977 | * @old: pointer to struct &v4l2_event with the reported |
| 940 | * event; | 978 | * event; |
| 941 | * @new: pointer to :ref:`struct v4l2_event <v4l2-event>` with the modified | 979 | * @new: pointer to struct &v4l2_event with the modified |
| 942 | * event; | 980 | * event; |
| 943 | */ | 981 | */ |
| 944 | void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); | 982 | void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); |
| @@ -947,9 +985,9 @@ void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); | |||
| 947 | * v4l2_ctrl_merge - Function to be used as a callback to | 985 | * v4l2_ctrl_merge - Function to be used as a callback to |
| 948 | * &struct v4l2_subscribed_event_ops merge(\) | 986 | * &struct v4l2_subscribed_event_ops merge(\) |
| 949 | * | 987 | * |
| 950 | * @old: pointer to :ref:`struct v4l2_event <v4l2-event>` with the reported | 988 | * @old: pointer to struct &v4l2_event with the reported |
| 951 | * event; | 989 | * event; |
| 952 | * @new: pointer to :ref:`struct v4l2_event <v4l2-event>` with the merged | 990 | * @new: pointer to struct &v4l2_event with the merged |
| 953 | * event; | 991 | * event; |
| 954 | */ | 992 | */ |
| 955 | void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new); | 993 | void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new); |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index a122b1bd40f9..e657614521e3 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
| @@ -25,7 +25,8 @@ | |||
| 25 | #define VFL_TYPE_RADIO 2 | 25 | #define VFL_TYPE_RADIO 2 |
| 26 | #define VFL_TYPE_SUBDEV 3 | 26 | #define VFL_TYPE_SUBDEV 3 |
| 27 | #define VFL_TYPE_SDR 4 | 27 | #define VFL_TYPE_SDR 4 |
| 28 | #define VFL_TYPE_MAX 5 | 28 | #define VFL_TYPE_TOUCH 5 |
| 29 | #define VFL_TYPE_MAX 6 | ||
| 29 | 30 | ||
| 30 | /* Is this a receiver, transmitter or mem-to-mem? */ | 31 | /* Is this a receiver, transmitter or mem-to-mem? */ |
| 31 | /* Ignored for VFL_TYPE_SUBDEV. */ | 32 | /* Ignored for VFL_TYPE_SUBDEV. */ |
| @@ -55,7 +56,7 @@ struct v4l2_ctrl_handler; | |||
| 55 | * | 56 | * |
| 56 | * .. note:: | 57 | * .. note:: |
| 57 | * The size of @prios array matches the number of priority types defined | 58 | * The size of @prios array matches the number of priority types defined |
| 58 | * by :ref:`enum v4l2_priority <v4l2-priority>`. | 59 | * by enum &v4l2_priority. |
| 59 | */ | 60 | */ |
| 60 | struct v4l2_prio_state { | 61 | struct v4l2_prio_state { |
| 61 | atomic_t prios[4]; | 62 | atomic_t prios[4]; |
| @@ -72,8 +73,8 @@ void v4l2_prio_init(struct v4l2_prio_state *global); | |||
| 72 | * v4l2_prio_change - changes the v4l2 file handler priority | 73 | * v4l2_prio_change - changes the v4l2 file handler priority |
| 73 | * | 74 | * |
| 74 | * @global: pointer to the &struct v4l2_prio_state of the device node. | 75 | * @global: pointer to the &struct v4l2_prio_state of the device node. |
| 75 | * @local: pointer to the desired priority, as defined by :ref:`enum v4l2_priority <v4l2-priority>` | 76 | * @local: pointer to the desired priority, as defined by enum &v4l2_priority |
| 76 | * @new: Priority type requested, as defined by :ref:`enum v4l2_priority <v4l2-priority>`. | 77 | * @new: Priority type requested, as defined by enum &v4l2_priority. |
| 77 | * | 78 | * |
| 78 | * .. note:: | 79 | * .. note:: |
| 79 | * This function should be used only by the V4L2 core. | 80 | * This function should be used only by the V4L2 core. |
| @@ -85,7 +86,7 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, | |||
| 85 | * v4l2_prio_open - Implements the priority logic for a file handler open | 86 | * v4l2_prio_open - Implements the priority logic for a file handler open |
| 86 | * | 87 | * |
| 87 | * @global: pointer to the &struct v4l2_prio_state of the device node. | 88 | * @global: pointer to the &struct v4l2_prio_state of the device node. |
| 88 | * @local: pointer to the desired priority, as defined by :ref:`enum v4l2_priority <v4l2-priority>` | 89 | * @local: pointer to the desired priority, as defined by enum &v4l2_priority |
| 89 | * | 90 | * |
| 90 | * .. note:: | 91 | * .. note:: |
| 91 | * This function should be used only by the V4L2 core. | 92 | * This function should be used only by the V4L2 core. |
| @@ -96,7 +97,7 @@ void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); | |||
| 96 | * v4l2_prio_close - Implements the priority logic for a file handler close | 97 | * v4l2_prio_close - Implements the priority logic for a file handler close |
| 97 | * | 98 | * |
| 98 | * @global: pointer to the &struct v4l2_prio_state of the device node. | 99 | * @global: pointer to the &struct v4l2_prio_state of the device node. |
| 99 | * @local: priority to be released, as defined by :ref:`enum v4l2_priority <v4l2-priority>` | 100 | * @local: priority to be released, as defined by enum &v4l2_priority |
| 100 | * | 101 | * |
| 101 | * .. note:: | 102 | * .. note:: |
| 102 | * This function should be used only by the V4L2 core. | 103 | * This function should be used only by the V4L2 core. |
| @@ -114,10 +115,10 @@ void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local); | |||
| 114 | enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); | 115 | enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); |
| 115 | 116 | ||
| 116 | /** | 117 | /** |
| 117 | * v4l2_prio_close - Implements the priority logic for a file handler close | 118 | * v4l2_prio_check - Implements the priority logic for a file handler close |
| 118 | * | 119 | * |
| 119 | * @global: pointer to the &struct v4l2_prio_state of the device node. | 120 | * @global: pointer to the &struct v4l2_prio_state of the device node. |
| 120 | * @local: desired priority, as defined by :ref:`enum v4l2_priority <v4l2-priority>` local | 121 | * @local: desired priority, as defined by enum &v4l2_priority local |
| 121 | * | 122 | * |
| 122 | * .. note:: | 123 | * .. note:: |
| 123 | * This function should be used only by the V4L2 core. | 124 | * This function should be used only by the V4L2 core. |
| @@ -294,6 +295,7 @@ struct video_device | |||
| 294 | * - %VFL_TYPE_RADIO - A radio card | 295 | * - %VFL_TYPE_RADIO - A radio card |
| 295 | * - %VFL_TYPE_SUBDEV - A subdevice | 296 | * - %VFL_TYPE_SUBDEV - A subdevice |
| 296 | * - %VFL_TYPE_SDR - Software Defined Radio | 297 | * - %VFL_TYPE_SDR - Software Defined Radio |
| 298 | * - %VFL_TYPE_TOUCH - A touch sensor | ||
| 297 | * | 299 | * |
| 298 | * .. note:: | 300 | * .. note:: |
| 299 | * | 301 | * |
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index a9d6aa41790e..8ffa94009d1a 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
| @@ -39,7 +39,7 @@ struct v4l2_ctrl_handler; | |||
| 39 | * if this struct is embedded into a larger struct. | 39 | * if this struct is embedded into a larger struct. |
| 40 | * @name: unique device name, by default the driver name + bus ID | 40 | * @name: unique device name, by default the driver name + bus ID |
| 41 | * @notify: notify callback called by some sub-devices. | 41 | * @notify: notify callback called by some sub-devices. |
| 42 | * @ctrl_handler: The control handler. May be NULL. | 42 | * @ctrl_handler: The control handler. May be %NULL. |
| 43 | * @prio: Device's priority state | 43 | * @prio: Device's priority state |
| 44 | * @ref: Keep track of the references to this struct. | 44 | * @ref: Keep track of the references to this struct. |
| 45 | * @release: Release function that is called when the ref count | 45 | * @release: Release function that is called when the ref count |
| @@ -53,8 +53,8 @@ struct v4l2_ctrl_handler; | |||
| 53 | * | 53 | * |
| 54 | * .. note:: | 54 | * .. note:: |
| 55 | * | 55 | * |
| 56 | * #) dev->driver_data points to this struct. | 56 | * #) @dev->driver_data points to this struct. |
| 57 | * #) dev might be NULL if there is no parent device | 57 | * #) @dev might be %NULL if there is no parent device |
| 58 | */ | 58 | */ |
| 59 | 59 | ||
| 60 | struct v4l2_device { | 60 | struct v4l2_device { |
| @@ -76,10 +76,10 @@ struct v4l2_device { | |||
| 76 | /** | 76 | /** |
| 77 | * v4l2_device_get - gets a V4L2 device reference | 77 | * v4l2_device_get - gets a V4L2 device reference |
| 78 | * | 78 | * |
| 79 | * @v4l2_dev: pointer to struct v4l2_device | 79 | * @v4l2_dev: pointer to struct &v4l2_device |
| 80 | * | 80 | * |
| 81 | * This is an ancillary routine meant to increment the usage for the | 81 | * This is an ancillary routine meant to increment the usage for the |
| 82 | * struct v4l2_device pointed by @v4l2_dev. | 82 | * struct &v4l2_device pointed by @v4l2_dev. |
| 83 | */ | 83 | */ |
| 84 | static inline void v4l2_device_get(struct v4l2_device *v4l2_dev) | 84 | static inline void v4l2_device_get(struct v4l2_device *v4l2_dev) |
| 85 | { | 85 | { |
| @@ -89,23 +89,23 @@ static inline void v4l2_device_get(struct v4l2_device *v4l2_dev) | |||
| 89 | /** | 89 | /** |
| 90 | * v4l2_device_put - putss a V4L2 device reference | 90 | * v4l2_device_put - putss a V4L2 device reference |
| 91 | * | 91 | * |
| 92 | * @v4l2_dev: pointer to struct v4l2_device | 92 | * @v4l2_dev: pointer to struct &v4l2_device |
| 93 | * | 93 | * |
| 94 | * This is an ancillary routine meant to decrement the usage for the | 94 | * This is an ancillary routine meant to decrement the usage for the |
| 95 | * struct v4l2_device pointed by @v4l2_dev. | 95 | * struct &v4l2_device pointed by @v4l2_dev. |
| 96 | */ | 96 | */ |
| 97 | int v4l2_device_put(struct v4l2_device *v4l2_dev); | 97 | int v4l2_device_put(struct v4l2_device *v4l2_dev); |
| 98 | 98 | ||
| 99 | /** | 99 | /** |
| 100 | * v4l2_device_register -Initialize v4l2_dev and make dev->driver_data | 100 | * v4l2_device_register - Initialize v4l2_dev and make @dev->driver_data |
| 101 | * point to v4l2_dev. | 101 | * point to @v4l2_dev. |
| 102 | * | 102 | * |
| 103 | * @dev: pointer to struct device | 103 | * @dev: pointer to struct &device |
| 104 | * @v4l2_dev: pointer to struct v4l2_device | 104 | * @v4l2_dev: pointer to struct &v4l2_device |
| 105 | * | 105 | * |
| 106 | * .. note:: | 106 | * .. note:: |
| 107 | * dev may be NULL in rare cases (ISA devices). | 107 | * @dev may be %NULL in rare cases (ISA devices). |
| 108 | * In such case the caller must fill in the v4l2_dev->name field | 108 | * In such case the caller must fill in the @v4l2_dev->name field |
| 109 | * before calling this function. | 109 | * before calling this function. |
| 110 | */ | 110 | */ |
| 111 | int __must_check v4l2_device_register(struct device *dev, | 111 | int __must_check v4l2_device_register(struct device *dev, |
| @@ -113,14 +113,14 @@ int __must_check v4l2_device_register(struct device *dev, | |||
| 113 | 113 | ||
| 114 | /** | 114 | /** |
| 115 | * v4l2_device_set_name - Optional function to initialize the | 115 | * v4l2_device_set_name - Optional function to initialize the |
| 116 | * name field of struct v4l2_device | 116 | * name field of struct &v4l2_device |
| 117 | * | 117 | * |
| 118 | * @v4l2_dev: pointer to struct v4l2_device | 118 | * @v4l2_dev: pointer to struct &v4l2_device |
| 119 | * @basename: base name for the device name | 119 | * @basename: base name for the device name |
| 120 | * @instance: pointer to a static atomic_t var with the instance usage for | 120 | * @instance: pointer to a static atomic_t var with the instance usage for |
| 121 | * the device driver. | 121 | * the device driver. |
| 122 | * | 122 | * |
| 123 | * v4l2_device_set_name() initializes the name field of struct v4l2_device | 123 | * v4l2_device_set_name() initializes the name field of struct &v4l2_device |
| 124 | * using the driver name and a driver-global atomic_t instance. | 124 | * using the driver name and a driver-global atomic_t instance. |
| 125 | * | 125 | * |
| 126 | * This function will increment the instance counter and returns the | 126 | * This function will increment the instance counter and returns the |
| @@ -132,7 +132,7 @@ int __must_check v4l2_device_register(struct device *dev, | |||
| 132 | * | 132 | * |
| 133 | * ... | 133 | * ... |
| 134 | * | 134 | * |
| 135 | * instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance); | 135 | * instance = v4l2_device_set_name(&\ v4l2_dev, "foo", &\ drv_instance); |
| 136 | * | 136 | * |
| 137 | * The first time this is called the name field will be set to foo0 and | 137 | * The first time this is called the name field will be set to foo0 and |
| 138 | * this function returns 0. If the name ends with a digit (e.g. cx18), | 138 | * this function returns 0. If the name ends with a digit (e.g. cx18), |
| @@ -147,16 +147,16 @@ int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename, | |||
| 147 | * @v4l2_dev: pointer to struct v4l2_device | 147 | * @v4l2_dev: pointer to struct v4l2_device |
| 148 | * | 148 | * |
| 149 | * Should be called when the USB parent disconnects. | 149 | * Should be called when the USB parent disconnects. |
| 150 | * Since the parent disappears, this ensures that v4l2_dev doesn't have | 150 | * Since the parent disappears, this ensures that @v4l2_dev doesn't have |
| 151 | * an invalid parent pointer. | 151 | * an invalid parent pointer. |
| 152 | * | 152 | * |
| 153 | * .. note:: This function sets v4l2_dev->dev to NULL. | 153 | * .. note:: This function sets @v4l2_dev->dev to NULL. |
| 154 | */ | 154 | */ |
| 155 | void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); | 155 | void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); |
| 156 | 156 | ||
| 157 | /** | 157 | /** |
| 158 | * v4l2_device_unregister - Unregister all sub-devices and any other | 158 | * v4l2_device_unregister - Unregister all sub-devices and any other |
| 159 | * resources related to v4l2_dev. | 159 | * resources related to @v4l2_dev. |
| 160 | * | 160 | * |
| 161 | * @v4l2_dev: pointer to struct v4l2_device | 161 | * @v4l2_dev: pointer to struct v4l2_device |
| 162 | */ | 162 | */ |
| @@ -165,8 +165,8 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev); | |||
| 165 | /** | 165 | /** |
| 166 | * v4l2_device_register_subdev - Registers a subdev with a v4l2 device. | 166 | * v4l2_device_register_subdev - Registers a subdev with a v4l2 device. |
| 167 | * | 167 | * |
| 168 | * @v4l2_dev: pointer to struct v4l2_device | 168 | * @v4l2_dev: pointer to struct &v4l2_device |
| 169 | * @sd: pointer to struct v4l2_subdev | 169 | * @sd: pointer to struct &v4l2_subdev |
| 170 | * | 170 | * |
| 171 | * While registered, the subdev module is marked as in-use. | 171 | * While registered, the subdev module is marked as in-use. |
| 172 | * | 172 | * |
| @@ -179,7 +179,7 @@ int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
| 179 | /** | 179 | /** |
| 180 | * v4l2_device_unregister_subdev - Unregisters a subdev with a v4l2 device. | 180 | * v4l2_device_unregister_subdev - Unregisters a subdev with a v4l2 device. |
| 181 | * | 181 | * |
| 182 | * @sd: pointer to struct v4l2_subdev | 182 | * @sd: pointer to struct &v4l2_subdev |
| 183 | * | 183 | * |
| 184 | * .. note :: | 184 | * .. note :: |
| 185 | * | 185 | * |
| @@ -191,7 +191,7 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); | |||
| 191 | /** | 191 | /** |
| 192 | * v4l2_device_register_subdev_nodes - Registers device nodes for all subdevs | 192 | * v4l2_device_register_subdev_nodes - Registers device nodes for all subdevs |
| 193 | * of the v4l2 device that are marked with | 193 | * of the v4l2 device that are marked with |
| 194 | * the V4L2_SUBDEV_FL_HAS_DEVNODE flag. | 194 | * the %V4L2_SUBDEV_FL_HAS_DEVNODE flag. |
| 195 | * | 195 | * |
| 196 | * @v4l2_dev: pointer to struct v4l2_device | 196 | * @v4l2_dev: pointer to struct v4l2_device |
| 197 | */ | 197 | */ |
| @@ -201,9 +201,9 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); | |||
| 201 | /** | 201 | /** |
| 202 | * v4l2_subdev_notify - Sends a notification to v4l2_device. | 202 | * v4l2_subdev_notify - Sends a notification to v4l2_device. |
| 203 | * | 203 | * |
| 204 | * @sd: pointer to struct v4l2_subdev | 204 | * @sd: pointer to struct &v4l2_subdev |
| 205 | * @notification: type of notification. Please notice that the notification | 205 | * @notification: type of notification. Please notice that the notification |
| 206 | * type is driver-specific. | 206 | * type is driver-specific. |
| 207 | * @arg: arguments for the notification. Those are specific to each | 207 | * @arg: arguments for the notification. Those are specific to each |
| 208 | * notification type. | 208 | * notification type. |
| 209 | */ | 209 | */ |
| @@ -222,7 +222,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, | |||
| 222 | Ignore any errors. Note that you cannot add or delete a subdev | 222 | Ignore any errors. Note that you cannot add or delete a subdev |
| 223 | while walking the subdevs list. */ | 223 | while walking the subdevs list. */ |
| 224 | #define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...) \ | 224 | #define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...) \ |
| 225 | do { \ | 225 | do { \ |
| 226 | list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) \ | 226 | list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) \ |
| 227 | if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ | 227 | if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ |
| 228 | (sd)->ops->o->f((sd) , ##args); \ | 228 | (sd)->ops->o->f((sd) , ##args); \ |
| @@ -241,15 +241,15 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, | |||
| 241 | return with that error code. Note that you cannot add or delete a | 241 | return with that error code. Note that you cannot add or delete a |
| 242 | subdev while walking the subdevs list. */ | 242 | subdev while walking the subdevs list. */ |
| 243 | #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \ | 243 | #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \ |
| 244 | ({ \ | 244 | ({ \ |
| 245 | long __err = 0; \ | 245 | long __err = 0; \ |
| 246 | \ | 246 | \ |
| 247 | list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) { \ | 247 | list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) { \ |
| 248 | if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ | 248 | if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ |
| 249 | __err = (sd)->ops->o->f((sd) , ##args); \ | 249 | __err = (sd)->ops->o->f((sd) , ##args); \ |
| 250 | if (__err && __err != -ENOIOCTLCMD) \ | 250 | if (__err && __err != -ENOIOCTLCMD) \ |
| 251 | break; \ | 251 | break; \ |
| 252 | } \ | 252 | } \ |
| 253 | (__err == -ENOIOCTLCMD) ? 0 : __err; \ | 253 | (__err == -ENOIOCTLCMD) ? 0 : __err; \ |
| 254 | }) | 254 | }) |
| 255 | 255 | ||
| @@ -276,7 +276,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, | |||
| 276 | match them all). If the callback returns an error other than 0 or | 276 | match them all). If the callback returns an error other than 0 or |
| 277 | -ENOIOCTLCMD, then return with that error code. Note that you cannot | 277 | -ENOIOCTLCMD, then return with that error code. Note that you cannot |
| 278 | add or delete a subdev while walking the subdevs list. */ | 278 | add or delete a subdev while walking the subdevs list. */ |
| 279 | #define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ | 279 | #define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ |
| 280 | ({ \ | 280 | ({ \ |
| 281 | struct v4l2_subdev *__sd; \ | 281 | struct v4l2_subdev *__sd; \ |
| 282 | __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \ | 282 | __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \ |
| @@ -300,8 +300,8 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, | |||
| 300 | 300 | ||
| 301 | /* | 301 | /* |
| 302 | * Call the specified callback for all subdevs where grp_id & grpmsk != 0 | 302 | * Call the specified callback for all subdevs where grp_id & grpmsk != 0 |
| 303 | * (if grpmsk == `0, then match them all). If the callback returns an error | 303 | * (if grpmsk == 0, then match them all). If the callback returns an error |
| 304 | * other than 0 or -ENOIOCTLCMD, then return with that error code. Note that | 304 | * other than 0 or %-ENOIOCTLCMD, then return with that error code. Note that |
| 305 | * you cannot add or delete a subdev while walking the subdevs list. | 305 | * you cannot add or delete a subdev while walking the subdevs list. |
| 306 | */ | 306 | */ |
| 307 | #define v4l2_device_mask_call_until_err(v4l2_dev, grpmsk, o, f, args...) \ | 307 | #define v4l2_device_mask_call_until_err(v4l2_dev, grpmsk, o, f, args...) \ |
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h index 65caadf13eec..0a7d9e1fc8c8 100644 --- a/include/media/v4l2-dv-timings.h +++ b/include/media/v4l2-dv-timings.h | |||
| @@ -28,8 +28,8 @@ | |||
| 28 | */ | 28 | */ |
| 29 | extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; | 29 | extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; |
| 30 | 30 | ||
| 31 | /* | 31 | /** |
| 32 | * v4l2_check_dv_timings_fnc - timings check callback | 32 | * typedef v4l2_check_dv_timings_fnc - timings check callback |
| 33 | * | 33 | * |
| 34 | * @t: the v4l2_dv_timings struct. | 34 | * @t: the v4l2_dv_timings struct. |
| 35 | * @handle: a handle from the driver. | 35 | * @handle: a handle from the driver. |
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h index ca854203b8b9..a700285c64a9 100644 --- a/include/media/v4l2-event.h +++ b/include/media/v4l2-event.h | |||
| @@ -222,7 +222,8 @@ int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, | |||
| 222 | struct v4l2_fh *fh, | 222 | struct v4l2_fh *fh, |
| 223 | struct v4l2_event_subscription *sub); | 223 | struct v4l2_event_subscription *sub); |
| 224 | /** | 224 | /** |
| 225 | * v4l2_src_change_event_subscribe - | 225 | * v4l2_src_change_event_subscribe - helper function that calls |
| 226 | * v4l2_event_subscribe() if the event is %V4L2_EVENT_SOURCE_CHANGE. | ||
| 226 | * | 227 | * |
| 227 | * @fh: pointer to struct v4l2_fh | 228 | * @fh: pointer to struct v4l2_fh |
| 228 | * @sub: pointer to &struct v4l2_event_subscription | 229 | * @sub: pointer to &struct v4l2_event_subscription |
diff --git a/include/media/v4l2-flash-led-class.h b/include/media/v4l2-flash-led-class.h index 3d184ab52274..b0fe4d6f4a5f 100644 --- a/include/media/v4l2-flash-led-class.h +++ b/include/media/v4l2-flash-led-class.h | |||
| @@ -20,7 +20,7 @@ struct led_classdev; | |||
| 20 | struct v4l2_flash; | 20 | struct v4l2_flash; |
| 21 | enum led_brightness; | 21 | enum led_brightness; |
| 22 | 22 | ||
| 23 | /* | 23 | /** |
| 24 | * struct v4l2_flash_ctrl_data - flash control initialization data, filled | 24 | * struct v4l2_flash_ctrl_data - flash control initialization data, filled |
| 25 | * basing on the features declared by the LED flash | 25 | * basing on the features declared by the LED flash |
| 26 | * class driver in the v4l2_flash_config | 26 | * class driver in the v4l2_flash_config |
| @@ -33,14 +33,21 @@ struct v4l2_flash_ctrl_data { | |||
| 33 | u32 cid; | 33 | u32 cid; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | /** | ||
| 37 | * struct v4l2_flash_ops - V4L2 flash operations | ||
| 38 | * | ||
| 39 | * @external_strobe_set: Setup strobing the flash by hardware pin state | ||
| 40 | * assertion. | ||
| 41 | * @intensity_to_led_brightness: Convert intensity to brightness in a device | ||
| 42 | * specific manner | ||
| 43 | * @led_brightness_to_intensity: convert brightness to intensity in a device | ||
| 44 | * specific manner. | ||
| 45 | */ | ||
| 36 | struct v4l2_flash_ops { | 46 | struct v4l2_flash_ops { |
| 37 | /* setup strobing the flash by hardware pin state assertion */ | ||
| 38 | int (*external_strobe_set)(struct v4l2_flash *v4l2_flash, | 47 | int (*external_strobe_set)(struct v4l2_flash *v4l2_flash, |
| 39 | bool enable); | 48 | bool enable); |
| 40 | /* convert intensity to brightness in a device specific manner */ | ||
| 41 | enum led_brightness (*intensity_to_led_brightness) | 49 | enum led_brightness (*intensity_to_led_brightness) |
| 42 | (struct v4l2_flash *v4l2_flash, s32 intensity); | 50 | (struct v4l2_flash *v4l2_flash, s32 intensity); |
| 43 | /* convert brightness to intensity in a device specific manner */ | ||
| 44 | s32 (*led_brightness_to_intensity) | 51 | s32 (*led_brightness_to_intensity) |
| 45 | (struct v4l2_flash *v4l2_flash, enum led_brightness); | 52 | (struct v4l2_flash *v4l2_flash, enum led_brightness); |
| 46 | }; | 53 | }; |
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 8b1d19bc9b0e..574ff2ae94be 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
| @@ -287,273 +287,286 @@ struct v4l2_ioctl_ops { | |||
| 287 | /* ioctl callbacks */ | 287 | /* ioctl callbacks */ |
| 288 | 288 | ||
| 289 | /* VIDIOC_QUERYCAP handler */ | 289 | /* VIDIOC_QUERYCAP handler */ |
| 290 | int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap); | 290 | int (*vidioc_querycap)(struct file *file, void *fh, |
| 291 | struct v4l2_capability *cap); | ||
| 291 | 292 | ||
| 292 | /* VIDIOC_ENUM_FMT handlers */ | 293 | /* VIDIOC_ENUM_FMT handlers */ |
| 293 | int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh, | 294 | int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh, |
| 294 | struct v4l2_fmtdesc *f); | 295 | struct v4l2_fmtdesc *f); |
| 295 | int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh, | 296 | int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh, |
| 296 | struct v4l2_fmtdesc *f); | 297 | struct v4l2_fmtdesc *f); |
| 297 | int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, | 298 | int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, |
| 298 | struct v4l2_fmtdesc *f); | 299 | struct v4l2_fmtdesc *f); |
| 299 | int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh, | 300 | int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh, |
| 300 | struct v4l2_fmtdesc *f); | 301 | struct v4l2_fmtdesc *f); |
| 301 | int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, | 302 | int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, |
| 302 | struct v4l2_fmtdesc *f); | 303 | struct v4l2_fmtdesc *f); |
| 303 | int (*vidioc_enum_fmt_sdr_cap) (struct file *file, void *fh, | 304 | int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, |
| 304 | struct v4l2_fmtdesc *f); | 305 | struct v4l2_fmtdesc *f); |
| 305 | int (*vidioc_enum_fmt_sdr_out) (struct file *file, void *fh, | 306 | int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, |
| 306 | struct v4l2_fmtdesc *f); | 307 | struct v4l2_fmtdesc *f); |
| 307 | 308 | ||
| 308 | /* VIDIOC_G_FMT handlers */ | 309 | /* VIDIOC_G_FMT handlers */ |
| 309 | int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, | 310 | int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh, |
| 310 | struct v4l2_format *f); | 311 | struct v4l2_format *f); |
| 311 | int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, | 312 | int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, |
| 312 | struct v4l2_format *f); | 313 | struct v4l2_format *f); |
| 313 | int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh, | 314 | int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh, |
| 314 | struct v4l2_format *f); | 315 | struct v4l2_format *f); |
| 315 | int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, | 316 | int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, |
| 316 | struct v4l2_format *f); | 317 | struct v4l2_format *f); |
| 317 | int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh, | 318 | int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh, |
| 318 | struct v4l2_format *f); | 319 | struct v4l2_format *f); |
| 319 | int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh, | 320 | int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh, |
| 320 | struct v4l2_format *f); | 321 | struct v4l2_format *f); |
| 321 | int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, | 322 | int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
| 322 | struct v4l2_format *f); | 323 | struct v4l2_format *f); |
| 323 | int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, | 324 | int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, |
| 324 | struct v4l2_format *f); | 325 | struct v4l2_format *f); |
| 325 | int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, | 326 | int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, |
| 326 | struct v4l2_format *f); | 327 | struct v4l2_format *f); |
| 327 | int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, | 328 | int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, |
| 328 | struct v4l2_format *f); | 329 | struct v4l2_format *f); |
| 329 | int (*vidioc_g_fmt_sdr_cap) (struct file *file, void *fh, | 330 | int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh, |
| 330 | struct v4l2_format *f); | 331 | struct v4l2_format *f); |
| 331 | int (*vidioc_g_fmt_sdr_out) (struct file *file, void *fh, | 332 | int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh, |
| 332 | struct v4l2_format *f); | 333 | struct v4l2_format *f); |
| 333 | 334 | ||
| 334 | /* VIDIOC_S_FMT handlers */ | 335 | /* VIDIOC_S_FMT handlers */ |
| 335 | int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, | 336 | int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh, |
| 336 | struct v4l2_format *f); | 337 | struct v4l2_format *f); |
| 337 | int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, | 338 | int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, |
| 338 | struct v4l2_format *f); | 339 | struct v4l2_format *f); |
| 339 | int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh, | 340 | int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh, |
| 340 | struct v4l2_format *f); | 341 | struct v4l2_format *f); |
| 341 | int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, | 342 | int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, |
| 342 | struct v4l2_format *f); | 343 | struct v4l2_format *f); |
| 343 | int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh, | 344 | int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh, |
| 344 | struct v4l2_format *f); | 345 | struct v4l2_format *f); |
| 345 | int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh, | 346 | int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh, |
| 346 | struct v4l2_format *f); | 347 | struct v4l2_format *f); |
| 347 | int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, | 348 | int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
| 348 | struct v4l2_format *f); | 349 | struct v4l2_format *f); |
| 349 | int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, | 350 | int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, |
| 350 | struct v4l2_format *f); | 351 | struct v4l2_format *f); |
| 351 | int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, | 352 | int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, |
| 352 | struct v4l2_format *f); | 353 | struct v4l2_format *f); |
| 353 | int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, | 354 | int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, |
| 354 | struct v4l2_format *f); | 355 | struct v4l2_format *f); |
| 355 | int (*vidioc_s_fmt_sdr_cap) (struct file *file, void *fh, | 356 | int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh, |
| 356 | struct v4l2_format *f); | 357 | struct v4l2_format *f); |
| 357 | int (*vidioc_s_fmt_sdr_out) (struct file *file, void *fh, | 358 | int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh, |
| 358 | struct v4l2_format *f); | 359 | struct v4l2_format *f); |
| 359 | 360 | ||
| 360 | /* VIDIOC_TRY_FMT handlers */ | 361 | /* VIDIOC_TRY_FMT handlers */ |
| 361 | int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, | 362 | int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh, |
| 362 | struct v4l2_format *f); | 363 | struct v4l2_format *f); |
| 363 | int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, | 364 | int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, |
| 364 | struct v4l2_format *f); | 365 | struct v4l2_format *f); |
| 365 | int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh, | 366 | int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh, |
| 366 | struct v4l2_format *f); | 367 | struct v4l2_format *f); |
| 367 | int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, | 368 | int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, |
| 368 | struct v4l2_format *f); | 369 | struct v4l2_format *f); |
| 369 | int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh, | 370 | int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh, |
| 370 | struct v4l2_format *f); | 371 | struct v4l2_format *f); |
| 371 | int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh, | 372 | int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh, |
| 372 | struct v4l2_format *f); | 373 | struct v4l2_format *f); |
| 373 | int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, | 374 | int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
| 374 | struct v4l2_format *f); | 375 | struct v4l2_format *f); |
| 375 | int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, | 376 | int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, |
| 376 | struct v4l2_format *f); | 377 | struct v4l2_format *f); |
| 377 | int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, | 378 | int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, |
| 378 | struct v4l2_format *f); | 379 | struct v4l2_format *f); |
| 379 | int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, | 380 | int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, |
| 380 | struct v4l2_format *f); | 381 | struct v4l2_format *f); |
| 381 | int (*vidioc_try_fmt_sdr_cap) (struct file *file, void *fh, | 382 | int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh, |
| 382 | struct v4l2_format *f); | 383 | struct v4l2_format *f); |
| 383 | int (*vidioc_try_fmt_sdr_out) (struct file *file, void *fh, | 384 | int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh, |
| 384 | struct v4l2_format *f); | 385 | struct v4l2_format *f); |
| 385 | 386 | ||
| 386 | /* Buffer handlers */ | 387 | /* Buffer handlers */ |
| 387 | int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); | 388 | int (*vidioc_reqbufs)(struct file *file, void *fh, |
| 388 | int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); | 389 | struct v4l2_requestbuffers *b); |
| 389 | int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); | 390 | int (*vidioc_querybuf)(struct file *file, void *fh, |
| 390 | int (*vidioc_expbuf) (struct file *file, void *fh, | 391 | struct v4l2_buffer *b); |
| 391 | struct v4l2_exportbuffer *e); | 392 | int (*vidioc_qbuf)(struct file *file, void *fh, |
| 392 | int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); | 393 | struct v4l2_buffer *b); |
| 393 | 394 | int (*vidioc_expbuf)(struct file *file, void *fh, | |
| 394 | int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); | 395 | struct v4l2_exportbuffer *e); |
| 395 | int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b); | 396 | int (*vidioc_dqbuf)(struct file *file, void *fh, |
| 396 | 397 | struct v4l2_buffer *b); | |
| 397 | int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); | 398 | |
| 398 | int (*vidioc_g_fbuf) (struct file *file, void *fh, | 399 | int (*vidioc_create_bufs)(struct file *file, void *fh, |
| 399 | struct v4l2_framebuffer *a); | 400 | struct v4l2_create_buffers *b); |
| 400 | int (*vidioc_s_fbuf) (struct file *file, void *fh, | 401 | int (*vidioc_prepare_buf)(struct file *file, void *fh, |
| 401 | const struct v4l2_framebuffer *a); | 402 | struct v4l2_buffer *b); |
| 403 | |||
| 404 | int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i); | ||
| 405 | int (*vidioc_g_fbuf)(struct file *file, void *fh, | ||
| 406 | struct v4l2_framebuffer *a); | ||
| 407 | int (*vidioc_s_fbuf)(struct file *file, void *fh, | ||
| 408 | const struct v4l2_framebuffer *a); | ||
| 402 | 409 | ||
| 403 | /* Stream on/off */ | 410 | /* Stream on/off */ |
| 404 | int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i); | 411 | int (*vidioc_streamon)(struct file *file, void *fh, |
| 405 | int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i); | 412 | enum v4l2_buf_type i); |
| 406 | 413 | int (*vidioc_streamoff)(struct file *file, void *fh, | |
| 407 | /* Standard handling | 414 | enum v4l2_buf_type i); |
| 408 | ENUMSTD is handled by videodev.c | 415 | |
| 416 | /* | ||
| 417 | * Standard handling | ||
| 418 | * | ||
| 419 | * Note: ENUMSTD is handled by videodev.c | ||
| 409 | */ | 420 | */ |
| 410 | int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm); | 421 | int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm); |
| 411 | int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id norm); | 422 | int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm); |
| 412 | int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a); | 423 | int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a); |
| 413 | 424 | ||
| 414 | /* Input handling */ | 425 | /* Input handling */ |
| 415 | int (*vidioc_enum_input)(struct file *file, void *fh, | 426 | int (*vidioc_enum_input)(struct file *file, void *fh, |
| 416 | struct v4l2_input *inp); | 427 | struct v4l2_input *inp); |
| 417 | int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i); | 428 | int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i); |
| 418 | int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i); | 429 | int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i); |
| 419 | 430 | ||
| 420 | /* Output handling */ | 431 | /* Output handling */ |
| 421 | int (*vidioc_enum_output) (struct file *file, void *fh, | 432 | int (*vidioc_enum_output)(struct file *file, void *fh, |
| 422 | struct v4l2_output *a); | 433 | struct v4l2_output *a); |
| 423 | int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i); | 434 | int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i); |
| 424 | int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i); | 435 | int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i); |
| 425 | 436 | ||
| 426 | /* Control handling */ | 437 | /* Control handling */ |
| 427 | int (*vidioc_queryctrl) (struct file *file, void *fh, | 438 | int (*vidioc_queryctrl)(struct file *file, void *fh, |
| 428 | struct v4l2_queryctrl *a); | 439 | struct v4l2_queryctrl *a); |
| 429 | int (*vidioc_query_ext_ctrl) (struct file *file, void *fh, | 440 | int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, |
| 430 | struct v4l2_query_ext_ctrl *a); | 441 | struct v4l2_query_ext_ctrl *a); |
| 431 | int (*vidioc_g_ctrl) (struct file *file, void *fh, | 442 | int (*vidioc_g_ctrl)(struct file *file, void *fh, |
| 432 | struct v4l2_control *a); | 443 | struct v4l2_control *a); |
| 433 | int (*vidioc_s_ctrl) (struct file *file, void *fh, | 444 | int (*vidioc_s_ctrl)(struct file *file, void *fh, |
| 434 | struct v4l2_control *a); | 445 | struct v4l2_control *a); |
| 435 | int (*vidioc_g_ext_ctrls) (struct file *file, void *fh, | 446 | int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, |
| 436 | struct v4l2_ext_controls *a); | 447 | struct v4l2_ext_controls *a); |
| 437 | int (*vidioc_s_ext_ctrls) (struct file *file, void *fh, | 448 | int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, |
| 438 | struct v4l2_ext_controls *a); | 449 | struct v4l2_ext_controls *a); |
| 439 | int (*vidioc_try_ext_ctrls) (struct file *file, void *fh, | 450 | int (*vidioc_try_ext_ctrls)(struct file *file, void *fh, |
| 440 | struct v4l2_ext_controls *a); | 451 | struct v4l2_ext_controls *a); |
| 441 | int (*vidioc_querymenu) (struct file *file, void *fh, | 452 | int (*vidioc_querymenu)(struct file *file, void *fh, |
| 442 | struct v4l2_querymenu *a); | 453 | struct v4l2_querymenu *a); |
| 443 | 454 | ||
| 444 | /* Audio ioctls */ | 455 | /* Audio ioctls */ |
| 445 | int (*vidioc_enumaudio) (struct file *file, void *fh, | 456 | int (*vidioc_enumaudio)(struct file *file, void *fh, |
| 446 | struct v4l2_audio *a); | 457 | struct v4l2_audio *a); |
| 447 | int (*vidioc_g_audio) (struct file *file, void *fh, | 458 | int (*vidioc_g_audio)(struct file *file, void *fh, |
| 448 | struct v4l2_audio *a); | 459 | struct v4l2_audio *a); |
| 449 | int (*vidioc_s_audio) (struct file *file, void *fh, | 460 | int (*vidioc_s_audio)(struct file *file, void *fh, |
| 450 | const struct v4l2_audio *a); | 461 | const struct v4l2_audio *a); |
| 451 | 462 | ||
| 452 | /* Audio out ioctls */ | 463 | /* Audio out ioctls */ |
| 453 | int (*vidioc_enumaudout) (struct file *file, void *fh, | 464 | int (*vidioc_enumaudout)(struct file *file, void *fh, |
| 454 | struct v4l2_audioout *a); | 465 | struct v4l2_audioout *a); |
| 455 | int (*vidioc_g_audout) (struct file *file, void *fh, | 466 | int (*vidioc_g_audout)(struct file *file, void *fh, |
| 456 | struct v4l2_audioout *a); | 467 | struct v4l2_audioout *a); |
| 457 | int (*vidioc_s_audout) (struct file *file, void *fh, | 468 | int (*vidioc_s_audout)(struct file *file, void *fh, |
| 458 | const struct v4l2_audioout *a); | 469 | const struct v4l2_audioout *a); |
| 459 | int (*vidioc_g_modulator) (struct file *file, void *fh, | 470 | int (*vidioc_g_modulator)(struct file *file, void *fh, |
| 460 | struct v4l2_modulator *a); | 471 | struct v4l2_modulator *a); |
| 461 | int (*vidioc_s_modulator) (struct file *file, void *fh, | 472 | int (*vidioc_s_modulator)(struct file *file, void *fh, |
| 462 | const struct v4l2_modulator *a); | 473 | const struct v4l2_modulator *a); |
| 463 | /* Crop ioctls */ | 474 | /* Crop ioctls */ |
| 464 | int (*vidioc_cropcap) (struct file *file, void *fh, | 475 | int (*vidioc_cropcap)(struct file *file, void *fh, |
| 465 | struct v4l2_cropcap *a); | 476 | struct v4l2_cropcap *a); |
| 466 | int (*vidioc_g_crop) (struct file *file, void *fh, | 477 | int (*vidioc_g_crop)(struct file *file, void *fh, |
| 467 | struct v4l2_crop *a); | 478 | struct v4l2_crop *a); |
| 468 | int (*vidioc_s_crop) (struct file *file, void *fh, | 479 | int (*vidioc_s_crop)(struct file *file, void *fh, |
| 469 | const struct v4l2_crop *a); | 480 | const struct v4l2_crop *a); |
| 470 | int (*vidioc_g_selection) (struct file *file, void *fh, | 481 | int (*vidioc_g_selection)(struct file *file, void *fh, |
| 471 | struct v4l2_selection *s); | 482 | struct v4l2_selection *s); |
| 472 | int (*vidioc_s_selection) (struct file *file, void *fh, | 483 | int (*vidioc_s_selection)(struct file *file, void *fh, |
| 473 | struct v4l2_selection *s); | 484 | struct v4l2_selection *s); |
| 474 | /* Compression ioctls */ | 485 | /* Compression ioctls */ |
| 475 | int (*vidioc_g_jpegcomp) (struct file *file, void *fh, | 486 | int (*vidioc_g_jpegcomp)(struct file *file, void *fh, |
| 476 | struct v4l2_jpegcompression *a); | 487 | struct v4l2_jpegcompression *a); |
| 477 | int (*vidioc_s_jpegcomp) (struct file *file, void *fh, | 488 | int (*vidioc_s_jpegcomp)(struct file *file, void *fh, |
| 478 | const struct v4l2_jpegcompression *a); | 489 | const struct v4l2_jpegcompression *a); |
| 479 | int (*vidioc_g_enc_index) (struct file *file, void *fh, | 490 | int (*vidioc_g_enc_index)(struct file *file, void *fh, |
| 480 | struct v4l2_enc_idx *a); | 491 | struct v4l2_enc_idx *a); |
| 481 | int (*vidioc_encoder_cmd) (struct file *file, void *fh, | 492 | int (*vidioc_encoder_cmd)(struct file *file, void *fh, |
| 482 | struct v4l2_encoder_cmd *a); | 493 | struct v4l2_encoder_cmd *a); |
| 483 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, | 494 | int (*vidioc_try_encoder_cmd)(struct file *file, void *fh, |
| 484 | struct v4l2_encoder_cmd *a); | 495 | struct v4l2_encoder_cmd *a); |
| 485 | int (*vidioc_decoder_cmd) (struct file *file, void *fh, | 496 | int (*vidioc_decoder_cmd)(struct file *file, void *fh, |
| 486 | struct v4l2_decoder_cmd *a); | 497 | struct v4l2_decoder_cmd *a); |
| 487 | int (*vidioc_try_decoder_cmd) (struct file *file, void *fh, | 498 | int (*vidioc_try_decoder_cmd)(struct file *file, void *fh, |
| 488 | struct v4l2_decoder_cmd *a); | 499 | struct v4l2_decoder_cmd *a); |
| 489 | 500 | ||
| 490 | /* Stream type-dependent parameter ioctls */ | 501 | /* Stream type-dependent parameter ioctls */ |
| 491 | int (*vidioc_g_parm) (struct file *file, void *fh, | 502 | int (*vidioc_g_parm)(struct file *file, void *fh, |
| 492 | struct v4l2_streamparm *a); | 503 | struct v4l2_streamparm *a); |
| 493 | int (*vidioc_s_parm) (struct file *file, void *fh, | 504 | int (*vidioc_s_parm)(struct file *file, void *fh, |
| 494 | struct v4l2_streamparm *a); | 505 | struct v4l2_streamparm *a); |
| 495 | 506 | ||
| 496 | /* Tuner ioctls */ | 507 | /* Tuner ioctls */ |
| 497 | int (*vidioc_g_tuner) (struct file *file, void *fh, | 508 | int (*vidioc_g_tuner)(struct file *file, void *fh, |
| 498 | struct v4l2_tuner *a); | 509 | struct v4l2_tuner *a); |
| 499 | int (*vidioc_s_tuner) (struct file *file, void *fh, | 510 | int (*vidioc_s_tuner)(struct file *file, void *fh, |
| 500 | const struct v4l2_tuner *a); | 511 | const struct v4l2_tuner *a); |
| 501 | int (*vidioc_g_frequency) (struct file *file, void *fh, | 512 | int (*vidioc_g_frequency)(struct file *file, void *fh, |
| 502 | struct v4l2_frequency *a); | 513 | struct v4l2_frequency *a); |
| 503 | int (*vidioc_s_frequency) (struct file *file, void *fh, | 514 | int (*vidioc_s_frequency)(struct file *file, void *fh, |
| 504 | const struct v4l2_frequency *a); | 515 | const struct v4l2_frequency *a); |
| 505 | int (*vidioc_enum_freq_bands) (struct file *file, void *fh, | 516 | int (*vidioc_enum_freq_bands)(struct file *file, void *fh, |
| 506 | struct v4l2_frequency_band *band); | 517 | struct v4l2_frequency_band *band); |
| 507 | 518 | ||
| 508 | /* Sliced VBI cap */ | 519 | /* Sliced VBI cap */ |
| 509 | int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh, | 520 | int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh, |
| 510 | struct v4l2_sliced_vbi_cap *a); | 521 | struct v4l2_sliced_vbi_cap *a); |
| 511 | 522 | ||
| 512 | /* Log status ioctl */ | 523 | /* Log status ioctl */ |
| 513 | int (*vidioc_log_status) (struct file *file, void *fh); | 524 | int (*vidioc_log_status)(struct file *file, void *fh); |
| 514 | 525 | ||
| 515 | int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, | 526 | int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh, |
| 516 | const struct v4l2_hw_freq_seek *a); | 527 | const struct v4l2_hw_freq_seek *a); |
| 517 | 528 | ||
| 518 | /* Debugging ioctls */ | 529 | /* Debugging ioctls */ |
| 519 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 530 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
| 520 | int (*vidioc_g_register) (struct file *file, void *fh, | 531 | int (*vidioc_g_register)(struct file *file, void *fh, |
| 521 | struct v4l2_dbg_register *reg); | 532 | struct v4l2_dbg_register *reg); |
| 522 | int (*vidioc_s_register) (struct file *file, void *fh, | 533 | int (*vidioc_s_register)(struct file *file, void *fh, |
| 523 | const struct v4l2_dbg_register *reg); | 534 | const struct v4l2_dbg_register *reg); |
| 524 | 535 | ||
| 525 | int (*vidioc_g_chip_info) (struct file *file, void *fh, | 536 | int (*vidioc_g_chip_info)(struct file *file, void *fh, |
| 526 | struct v4l2_dbg_chip_info *chip); | 537 | struct v4l2_dbg_chip_info *chip); |
| 527 | #endif | 538 | #endif |
| 528 | 539 | ||
| 529 | int (*vidioc_enum_framesizes) (struct file *file, void *fh, | 540 | int (*vidioc_enum_framesizes)(struct file *file, void *fh, |
| 530 | struct v4l2_frmsizeenum *fsize); | 541 | struct v4l2_frmsizeenum *fsize); |
| 531 | 542 | ||
| 532 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, | 543 | int (*vidioc_enum_frameintervals)(struct file *file, void *fh, |
| 533 | struct v4l2_frmivalenum *fival); | 544 | struct v4l2_frmivalenum *fival); |
| 534 | 545 | ||
| 535 | /* DV Timings IOCTLs */ | 546 | /* DV Timings IOCTLs */ |
| 536 | int (*vidioc_s_dv_timings) (struct file *file, void *fh, | 547 | int (*vidioc_s_dv_timings)(struct file *file, void *fh, |
| 537 | struct v4l2_dv_timings *timings); | 548 | struct v4l2_dv_timings *timings); |
| 538 | int (*vidioc_g_dv_timings) (struct file *file, void *fh, | 549 | int (*vidioc_g_dv_timings)(struct file *file, void *fh, |
| 539 | struct v4l2_dv_timings *timings); | 550 | struct v4l2_dv_timings *timings); |
| 540 | int (*vidioc_query_dv_timings) (struct file *file, void *fh, | 551 | int (*vidioc_query_dv_timings)(struct file *file, void *fh, |
| 541 | struct v4l2_dv_timings *timings); | 552 | struct v4l2_dv_timings *timings); |
| 542 | int (*vidioc_enum_dv_timings) (struct file *file, void *fh, | 553 | int (*vidioc_enum_dv_timings)(struct file *file, void *fh, |
| 543 | struct v4l2_enum_dv_timings *timings); | 554 | struct v4l2_enum_dv_timings *timings); |
| 544 | int (*vidioc_dv_timings_cap) (struct file *file, void *fh, | 555 | int (*vidioc_dv_timings_cap)(struct file *file, void *fh, |
| 545 | struct v4l2_dv_timings_cap *cap); | 556 | struct v4l2_dv_timings_cap *cap); |
| 546 | int (*vidioc_g_edid) (struct file *file, void *fh, struct v4l2_edid *edid); | 557 | int (*vidioc_g_edid)(struct file *file, void *fh, |
| 547 | int (*vidioc_s_edid) (struct file *file, void *fh, struct v4l2_edid *edid); | 558 | struct v4l2_edid *edid); |
| 548 | 559 | int (*vidioc_s_edid)(struct file *file, void *fh, | |
| 549 | int (*vidioc_subscribe_event) (struct v4l2_fh *fh, | 560 | struct v4l2_edid *edid); |
| 550 | const struct v4l2_event_subscription *sub); | 561 | |
| 562 | int (*vidioc_subscribe_event)(struct v4l2_fh *fh, | ||
| 563 | const struct v4l2_event_subscription *sub); | ||
| 551 | int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, | 564 | int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, |
| 552 | const struct v4l2_event_subscription *sub); | 565 | const struct v4l2_event_subscription *sub); |
| 553 | 566 | ||
| 554 | /* For other private ioctls */ | 567 | /* For other private ioctls */ |
| 555 | long (*vidioc_default) (struct file *file, void *fh, | 568 | long (*vidioc_default)(struct file *file, void *fh, |
| 556 | bool valid_prio, unsigned int cmd, void *arg); | 569 | bool valid_prio, unsigned int cmd, void *arg); |
| 557 | }; | 570 | }; |
| 558 | 571 | ||
| 559 | 572 | ||
| @@ -573,38 +586,123 @@ struct v4l2_ioctl_ops { | |||
| 573 | #define V4L2_DEV_DEBUG_POLL 0x10 | 586 | #define V4L2_DEV_DEBUG_POLL 0x10 |
| 574 | 587 | ||
| 575 | /* Video standard functions */ | 588 | /* Video standard functions */ |
| 576 | extern const char *v4l2_norm_to_name(v4l2_std_id id); | 589 | |
| 577 | extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); | 590 | /** |
| 578 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, | 591 | * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID. |
| 592 | * | ||
| 593 | * @id: analog TV standard ID. | ||
| 594 | * | ||
| 595 | * Return: returns a string with the name of the analog TV standard. | ||
| 596 | * If the standard is not found or if @id points to multiple standard, | ||
| 597 | * it returns "Unknown". | ||
| 598 | */ | ||
| 599 | const char *v4l2_norm_to_name(v4l2_std_id id); | ||
| 600 | |||
| 601 | /** | ||
| 602 | * v4l2_video_std_frame_period - Ancillary routine that fills a | ||
| 603 | * struct &v4l2_fract pointer with the default framerate fraction. | ||
| 604 | * | ||
| 605 | * @id: analog TV sdandard ID. | ||
| 606 | * @frameperiod: struct &v4l2_fract pointer to be filled | ||
| 607 | * | ||
| 608 | */ | ||
| 609 | void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); | ||
| 610 | |||
| 611 | /** | ||
| 612 | * v4l2_video_std_construct - Ancillary routine that fills in the fields of | ||
| 613 | * a &v4l2_standard structure according to the @id parameter. | ||
| 614 | * | ||
| 615 | * @vs: struct &v4l2_standard pointer to be filled | ||
| 616 | * @id: analog TV sdandard ID. | ||
| 617 | * @name: name of the standard to be used | ||
| 618 | * | ||
| 619 | * .. note:: | ||
| 620 | * | ||
| 621 | * This ancillary routine is obsolete. Shouldn't be used on newer drivers. | ||
| 622 | */ | ||
| 623 | int v4l2_video_std_construct(struct v4l2_standard *vs, | ||
| 579 | int id, const char *name); | 624 | int id, const char *name); |
| 580 | /* Prints the ioctl in a human-readable format. If prefix != NULL, | ||
| 581 | then do printk(KERN_DEBUG "%s: ", prefix) first. */ | ||
| 582 | extern void v4l_printk_ioctl(const char *prefix, unsigned int cmd); | ||
| 583 | 625 | ||
| 584 | /* Internal use only: get the mutex (if any) that we need to lock for the | 626 | /** |
| 585 | given command. */ | 627 | * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a |
| 628 | * human-readable format. | ||
| 629 | * | ||
| 630 | * @prefix: prefix to be added at the ioctl prints. | ||
| 631 | * @cmd: ioctl name | ||
| 632 | * | ||
| 633 | * .. note:: | ||
| 634 | * | ||
| 635 | * If prefix != %NULL, then it will issue a | ||
| 636 | * ``printk(KERN_DEBUG "%s: ", prefix)`` first. | ||
| 637 | */ | ||
| 638 | void v4l_printk_ioctl(const char *prefix, unsigned int cmd); | ||
| 639 | |||
| 586 | struct video_device; | 640 | struct video_device; |
| 587 | extern struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd); | 641 | |
| 642 | |||
| 643 | /** | ||
| 644 | * v4l2_ioctl_get_lock - get the mutex (if any) that it is need to lock for | ||
| 645 | * a given command. | ||
| 646 | * | ||
| 647 | * @vdev: Pointer to struct &video_device. | ||
| 648 | * @cmd: Ioctl name. | ||
| 649 | * | ||
| 650 | * .. note:: Internal use only. Should not be used outside V4L2 core. | ||
| 651 | */ | ||
| 652 | struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned int cmd); | ||
| 588 | 653 | ||
| 589 | /* names for fancy debug output */ | 654 | /* names for fancy debug output */ |
| 590 | extern const char *v4l2_field_names[]; | 655 | extern const char *v4l2_field_names[]; |
| 591 | extern const char *v4l2_type_names[]; | 656 | extern const char *v4l2_type_names[]; |
| 592 | 657 | ||
| 593 | #ifdef CONFIG_COMPAT | 658 | #ifdef CONFIG_COMPAT |
| 594 | /* 32 Bits compatibility layer for 64 bits processors */ | 659 | /** |
| 595 | extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, | 660 | * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors |
| 596 | unsigned long arg); | 661 | * |
| 662 | * @file: Pointer to struct &file. | ||
| 663 | * @cmd: Ioctl name. | ||
| 664 | * @arg: Ioctl argument. | ||
| 665 | */ | ||
| 666 | long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd, | ||
| 667 | unsigned long arg); | ||
| 597 | #endif | 668 | #endif |
| 598 | 669 | ||
| 599 | typedef long (*v4l2_kioctl)(struct file *file, | 670 | /** |
| 600 | unsigned int cmd, void *arg); | 671 | * typedef v4l2_kioctl - Typedef used to pass an ioctl handler. |
| 672 | * | ||
| 673 | * @file: Pointer to struct &file. | ||
| 674 | * @cmd: Ioctl name. | ||
| 675 | * @arg: Ioctl argument. | ||
| 676 | */ | ||
| 677 | typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg); | ||
| 601 | 678 | ||
| 602 | /* Include support for obsoleted stuff */ | 679 | /** |
| 603 | extern long video_usercopy(struct file *file, unsigned int cmd, | 680 | * video_usercopy - copies data from/to userspace memory when an ioctl is |
| 604 | unsigned long arg, v4l2_kioctl func); | 681 | * issued. |
| 682 | * | ||
| 683 | * @file: Pointer to struct &file. | ||
| 684 | * @cmd: Ioctl name. | ||
| 685 | * @arg: Ioctl argument. | ||
| 686 | * @func: function that will handle the ioctl | ||
| 687 | * | ||
| 688 | * .. note:: | ||
| 689 | * | ||
| 690 | * This routine should be used only inside the V4L2 core. | ||
| 691 | */ | ||
| 692 | long int video_usercopy(struct file *file, unsigned int cmd, | ||
| 693 | unsigned long int arg, v4l2_kioctl func); | ||
| 605 | 694 | ||
| 606 | /* Standard handlers for V4L ioctl's */ | 695 | /** |
| 607 | extern long video_ioctl2(struct file *file, | 696 | * video_ioctl2 - Handles a V4L2 ioctl. |
| 608 | unsigned int cmd, unsigned long arg); | 697 | * |
| 698 | * @file: Pointer to struct &file. | ||
| 699 | * @cmd: Ioctl name. | ||
| 700 | * @arg: Ioctl argument. | ||
| 701 | * | ||
| 702 | * Method used to hancle an ioctl. Should be used to fill the | ||
| 703 | * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers. | ||
| 704 | */ | ||
| 705 | long int video_ioctl2(struct file *file, | ||
| 706 | unsigned int cmd, unsigned long int arg); | ||
| 609 | 707 | ||
| 610 | #endif /* _V4L2_IOCTL_H */ | 708 | #endif /* _V4L2_IOCTL_H */ |
diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index 28c3f9d9c209..2634d9dc9916 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h | |||
| @@ -53,7 +53,7 @@ enum tuner_pad_index { | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * enum if_vid_dec_index - video IF-PLL pad index for | 56 | * enum if_vid_dec_pad_index - video IF-PLL pad index for |
| 57 | * MEDIA_ENT_F_IF_VID_DECODER | 57 | * MEDIA_ENT_F_IF_VID_DECODER |
| 58 | * | 58 | * |
| 59 | * @IF_VID_DEC_PAD_IF_INPUT: video Intermediate Frequency (IF) sink pad | 59 | * @IF_VID_DEC_PAD_IF_INPUT: video Intermediate Frequency (IF) sink pad |
| @@ -68,7 +68,7 @@ enum if_vid_dec_pad_index { | |||
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * enum if_aud_dec_index - audio/sound IF-PLL pad index for | 71 | * enum if_aud_dec_pad_index - audio/sound IF-PLL pad index for |
| 72 | * MEDIA_ENT_F_IF_AUD_DECODER | 72 | * MEDIA_ENT_F_IF_AUD_DECODER |
| 73 | * | 73 | * |
| 74 | * @IF_AUD_DEC_PAD_IF_INPUT: audio Intermediate Frequency (IF) sink pad | 74 | * @IF_AUD_DEC_PAD_IF_INPUT: audio Intermediate Frequency (IF) sink pad |
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 5a9597dd1ee0..1b355344c804 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h | |||
| @@ -41,9 +41,9 @@ | |||
| 41 | * This function does not have to (and will usually not) wait | 41 | * This function does not have to (and will usually not) wait |
| 42 | * until the device enters a state when it can be stopped. | 42 | * until the device enters a state when it can be stopped. |
| 43 | * @lock: optional. Define a driver's own lock callback, instead of using | 43 | * @lock: optional. Define a driver's own lock callback, instead of using |
| 44 | * m2m_ctx->q_lock. | 44 | * &v4l2_m2m_ctx->q_lock. |
| 45 | * @unlock: optional. Define a driver's own unlock callback, instead of | 45 | * @unlock: optional. Define a driver's own unlock callback, instead of |
| 46 | * using m2m_ctx->q_lock. | 46 | * using &v4l2_m2m_ctx->q_lock. |
| 47 | */ | 47 | */ |
| 48 | struct v4l2_m2m_ops { | 48 | struct v4l2_m2m_ops { |
| 49 | void (*device_run)(void *priv); | 49 | void (*device_run)(void *priv); |
| @@ -55,29 +55,51 @@ struct v4l2_m2m_ops { | |||
| 55 | 55 | ||
| 56 | struct v4l2_m2m_dev; | 56 | struct v4l2_m2m_dev; |
| 57 | 57 | ||
| 58 | /** | ||
| 59 | * struct v4l2_m2m_queue_ctx - represents a queue for buffers ready to be | ||
| 60 | * processed | ||
| 61 | * | ||
| 62 | * @q: pointer to struct &vb2_queue | ||
| 63 | * @rdy_queue: List of V4L2 mem-to-mem queues | ||
| 64 | * @rdy_spinlock: spin lock to protect the struct usage | ||
| 65 | * @num_rdy: number of buffers ready to be processed | ||
| 66 | * @buffered: is the queue buffered? | ||
| 67 | * | ||
| 68 | * Queue for buffers ready to be processed as soon as this | ||
| 69 | * instance receives access to the device. | ||
| 70 | */ | ||
| 71 | |||
| 58 | struct v4l2_m2m_queue_ctx { | 72 | struct v4l2_m2m_queue_ctx { |
| 59 | /* private: internal use only */ | ||
| 60 | struct vb2_queue q; | 73 | struct vb2_queue q; |
| 61 | 74 | ||
| 62 | /* Queue for buffers ready to be processed as soon as this | ||
| 63 | * instance receives access to the device */ | ||
| 64 | struct list_head rdy_queue; | 75 | struct list_head rdy_queue; |
| 65 | spinlock_t rdy_spinlock; | 76 | spinlock_t rdy_spinlock; |
| 66 | u8 num_rdy; | 77 | u8 num_rdy; |
| 67 | bool buffered; | 78 | bool buffered; |
| 68 | }; | 79 | }; |
| 69 | 80 | ||
| 81 | /** | ||
| 82 | * struct v4l2_m2m_ctx - Memory to memory context structure | ||
| 83 | * | ||
| 84 | * @q_lock: struct &mutex lock | ||
| 85 | * @m2m_dev: opaque pointer to the internal data to handle M2M context | ||
| 86 | * @cap_q_ctx: Capture (output to memory) queue context | ||
| 87 | * @out_q_ctx: Output (input from memory) queue context | ||
| 88 | * @queue: List of memory to memory contexts | ||
| 89 | * @job_flags: Job queue flags, used internally by v4l2-mem2mem.c: | ||
| 90 | * %TRANS_QUEUED, %TRANS_RUNNING and %TRANS_ABORT. | ||
| 91 | * @finished: Wait queue used to signalize when a job queue finished. | ||
| 92 | * @priv: Instance private data | ||
| 93 | */ | ||
| 70 | struct v4l2_m2m_ctx { | 94 | struct v4l2_m2m_ctx { |
| 71 | /* optional cap/out vb2 queues lock */ | 95 | /* optional cap/out vb2 queues lock */ |
| 72 | struct mutex *q_lock; | 96 | struct mutex *q_lock; |
| 73 | 97 | ||
| 74 | /* private: internal use only */ | 98 | /* internal use only */ |
| 75 | struct v4l2_m2m_dev *m2m_dev; | 99 | struct v4l2_m2m_dev *m2m_dev; |
| 76 | 100 | ||
| 77 | /* Capture (output to memory) queue context */ | ||
| 78 | struct v4l2_m2m_queue_ctx cap_q_ctx; | 101 | struct v4l2_m2m_queue_ctx cap_q_ctx; |
| 79 | 102 | ||
| 80 | /* Output (input from memory) queue context */ | ||
| 81 | struct v4l2_m2m_queue_ctx out_q_ctx; | 103 | struct v4l2_m2m_queue_ctx out_q_ctx; |
| 82 | 104 | ||
| 83 | /* For device job queue */ | 105 | /* For device job queue */ |
| @@ -85,22 +107,75 @@ struct v4l2_m2m_ctx { | |||
| 85 | unsigned long job_flags; | 107 | unsigned long job_flags; |
| 86 | wait_queue_head_t finished; | 108 | wait_queue_head_t finished; |
| 87 | 109 | ||
| 88 | /* Instance private data */ | ||
| 89 | void *priv; | 110 | void *priv; |
| 90 | }; | 111 | }; |
| 91 | 112 | ||
| 113 | /** | ||
| 114 | * struct v4l2_m2m_buffer - Memory to memory buffer | ||
| 115 | * | ||
| 116 | * @vb: pointer to struct &vb2_v4l2_buffer | ||
| 117 | * @list: list of m2m buffers | ||
| 118 | */ | ||
| 92 | struct v4l2_m2m_buffer { | 119 | struct v4l2_m2m_buffer { |
| 93 | struct vb2_v4l2_buffer vb; | 120 | struct vb2_v4l2_buffer vb; |
| 94 | struct list_head list; | 121 | struct list_head list; |
| 95 | }; | 122 | }; |
| 96 | 123 | ||
| 124 | /** | ||
| 125 | * v4l2_m2m_get_curr_priv() - return driver private data for the currently | ||
| 126 | * running instance or NULL if no instance is running | ||
| 127 | * | ||
| 128 | * @m2m_dev: opaque pointer to the internal data to handle M2M context | ||
| 129 | */ | ||
| 97 | void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); | 130 | void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); |
| 98 | 131 | ||
| 132 | /** | ||
| 133 | * v4l2_m2m_get_vq() - return vb2_queue for the given type | ||
| 134 | * | ||
| 135 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 136 | * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type | ||
| 137 | */ | ||
| 99 | struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, | 138 | struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, |
| 100 | enum v4l2_buf_type type); | 139 | enum v4l2_buf_type type); |
| 101 | 140 | ||
| 141 | /** | ||
| 142 | * v4l2_m2m_try_schedule() - check whether an instance is ready to be added to | ||
| 143 | * the pending job queue and add it if so. | ||
| 144 | * | ||
| 145 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 146 | * | ||
| 147 | * There are three basic requirements an instance has to meet to be able to run: | ||
| 148 | * 1) at least one source buffer has to be queued, | ||
| 149 | * 2) at least one destination buffer has to be queued, | ||
| 150 | * 3) streaming has to be on. | ||
| 151 | * | ||
| 152 | * If a queue is buffered (for example a decoder hardware ringbuffer that has | ||
| 153 | * to be drained before doing streamoff), allow scheduling without v4l2 buffers | ||
| 154 | * on that queue. | ||
| 155 | * | ||
| 156 | * There may also be additional, custom requirements. In such case the driver | ||
| 157 | * should supply a custom callback (job_ready in v4l2_m2m_ops) that should | ||
| 158 | * return 1 if the instance is ready. | ||
| 159 | * An example of the above could be an instance that requires more than one | ||
| 160 | * src/dst buffer per transaction. | ||
| 161 | */ | ||
| 102 | void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); | 162 | void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); |
| 103 | 163 | ||
| 164 | /** | ||
| 165 | * v4l2_m2m_job_finish() - inform the framework that a job has been finished | ||
| 166 | * and have it clean up | ||
| 167 | * | ||
| 168 | * @m2m_dev: opaque pointer to the internal data to handle M2M context | ||
| 169 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 170 | * | ||
| 171 | * Called by a driver to yield back the device after it has finished with it. | ||
| 172 | * Should be called as soon as possible after reaching a state which allows | ||
| 173 | * other instances to take control of the device. | ||
| 174 | * | ||
| 175 | * This function has to be called only after &v4l2_m2m_ops->device_run | ||
| 176 | * callback has been called on the driver. To prevent recursion, it should | ||
| 177 | * not be called directly from the &v4l2_m2m_ops->device_run callback though. | ||
| 178 | */ | ||
| 104 | void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, | 179 | void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, |
| 105 | struct v4l2_m2m_ctx *m2m_ctx); | 180 | struct v4l2_m2m_ctx *m2m_ctx); |
| 106 | 181 | ||
| @@ -110,38 +185,165 @@ v4l2_m2m_buf_done(struct vb2_v4l2_buffer *buf, enum vb2_buffer_state state) | |||
| 110 | vb2_buffer_done(&buf->vb2_buf, state); | 185 | vb2_buffer_done(&buf->vb2_buf, state); |
| 111 | } | 186 | } |
| 112 | 187 | ||
| 188 | /** | ||
| 189 | * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer | ||
| 190 | * | ||
| 191 | * @file: pointer to struct &file | ||
| 192 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 193 | * @reqbufs: pointer to struct &v4l2_requestbuffers | ||
| 194 | */ | ||
| 113 | int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 195 | int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 114 | struct v4l2_requestbuffers *reqbufs); | 196 | struct v4l2_requestbuffers *reqbufs); |
| 115 | 197 | ||
| 198 | /** | ||
| 199 | * v4l2_m2m_querybuf() - multi-queue-aware QUERYBUF multiplexer | ||
| 200 | * | ||
| 201 | * @file: pointer to struct &file | ||
| 202 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 203 | * @buf: pointer to struct &v4l2_buffer | ||
| 204 | * | ||
| 205 | * See v4l2_m2m_mmap() documentation for details. | ||
| 206 | */ | ||
| 116 | int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 207 | int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 117 | struct v4l2_buffer *buf); | 208 | struct v4l2_buffer *buf); |
| 118 | 209 | ||
| 210 | /** | ||
| 211 | * v4l2_m2m_qbuf() - enqueue a source or destination buffer, depending on | ||
| 212 | * the type | ||
| 213 | * | ||
| 214 | * @file: pointer to struct &file | ||
| 215 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 216 | * @buf: pointer to struct &v4l2_buffer | ||
| 217 | */ | ||
| 119 | int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 218 | int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 120 | struct v4l2_buffer *buf); | 219 | struct v4l2_buffer *buf); |
| 220 | |||
| 221 | /** | ||
| 222 | * v4l2_m2m_dqbuf() - dequeue a source or destination buffer, depending on | ||
| 223 | * the type | ||
| 224 | * | ||
| 225 | * @file: pointer to struct &file | ||
| 226 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 227 | * @buf: pointer to struct &v4l2_buffer | ||
| 228 | */ | ||
| 121 | int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 229 | int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 122 | struct v4l2_buffer *buf); | 230 | struct v4l2_buffer *buf); |
| 231 | |||
| 232 | /** | ||
| 233 | * v4l2_m2m_prepare_buf() - prepare a source or destination buffer, depending on | ||
| 234 | * the type | ||
| 235 | * | ||
| 236 | * @file: pointer to struct &file | ||
| 237 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 238 | * @buf: pointer to struct &v4l2_buffer | ||
| 239 | */ | ||
| 123 | int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 240 | int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 124 | struct v4l2_buffer *buf); | 241 | struct v4l2_buffer *buf); |
| 242 | |||
| 243 | /** | ||
| 244 | * v4l2_m2m_create_bufs() - create a source or destination buffer, depending | ||
| 245 | * on the type | ||
| 246 | * | ||
| 247 | * @file: pointer to struct &file | ||
| 248 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 249 | * @create: pointer to struct &v4l2_create_buffers | ||
| 250 | */ | ||
| 125 | int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 251 | int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 126 | struct v4l2_create_buffers *create); | 252 | struct v4l2_create_buffers *create); |
| 127 | 253 | ||
| 254 | /** | ||
| 255 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on | ||
| 256 | * the type | ||
| 257 | * | ||
| 258 | * @file: pointer to struct &file | ||
| 259 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 260 | * @eb: pointer to struct &v4l2_exportbuffer | ||
| 261 | */ | ||
| 128 | int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 262 | int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 129 | struct v4l2_exportbuffer *eb); | 263 | struct v4l2_exportbuffer *eb); |
| 130 | 264 | ||
| 265 | /** | ||
| 266 | * v4l2_m2m_streamon() - turn on streaming for a video queue | ||
| 267 | * | ||
| 268 | * @file: pointer to struct &file | ||
| 269 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 270 | * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type | ||
| 271 | */ | ||
| 131 | int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 272 | int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 132 | enum v4l2_buf_type type); | 273 | enum v4l2_buf_type type); |
| 274 | |||
| 275 | /** | ||
| 276 | * v4l2_m2m_streamoff() - turn off streaming for a video queue | ||
| 277 | * | ||
| 278 | * @file: pointer to struct &file | ||
| 279 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 280 | * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type | ||
| 281 | */ | ||
| 133 | int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 282 | int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 134 | enum v4l2_buf_type type); | 283 | enum v4l2_buf_type type); |
| 135 | 284 | ||
| 285 | /** | ||
| 286 | * v4l2_m2m_poll() - poll replacement, for destination buffers only | ||
| 287 | * | ||
| 288 | * @file: pointer to struct &file | ||
| 289 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 290 | * @wait: pointer to struct &poll_table_struct | ||
| 291 | * | ||
| 292 | * Call from the driver's poll() function. Will poll both queues. If a buffer | ||
| 293 | * is available to dequeue (with dqbuf) from the source queue, this will | ||
| 294 | * indicate that a non-blocking write can be performed, while read will be | ||
| 295 | * returned in case of the destination queue. | ||
| 296 | */ | ||
| 136 | unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 297 | unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 137 | struct poll_table_struct *wait); | 298 | struct poll_table_struct *wait); |
| 138 | 299 | ||
| 300 | /** | ||
| 301 | * v4l2_m2m_mmap() - source and destination queues-aware mmap multiplexer | ||
| 302 | * | ||
| 303 | * @file: pointer to struct &file | ||
| 304 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 305 | * @vma: pointer to struct &vm_area_struct | ||
| 306 | * | ||
| 307 | * Call from driver's mmap() function. Will handle mmap() for both queues | ||
| 308 | * seamlessly for videobuffer, which will receive normal per-queue offsets and | ||
| 309 | * proper videobuf queue pointers. The differentiation is made outside videobuf | ||
| 310 | * by adding a predefined offset to buffers from one of the queues and | ||
| 311 | * subtracting it before passing it back to videobuf. Only drivers (and | ||
| 312 | * thus applications) receive modified offsets. | ||
| 313 | */ | ||
| 139 | int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 314 | int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| 140 | struct vm_area_struct *vma); | 315 | struct vm_area_struct *vma); |
| 141 | 316 | ||
| 317 | /** | ||
| 318 | * v4l2_m2m_init() - initialize per-driver m2m data | ||
| 319 | * | ||
| 320 | * @m2m_ops: pointer to struct v4l2_m2m_ops | ||
| 321 | * | ||
| 322 | * Usually called from driver's ``probe()`` function. | ||
| 323 | * | ||
| 324 | * Return: returns an opaque pointer to the internal data to handle M2M context | ||
| 325 | */ | ||
| 142 | struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); | 326 | struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); |
| 327 | |||
| 328 | /** | ||
| 329 | * v4l2_m2m_release() - cleans up and frees a m2m_dev structure | ||
| 330 | * | ||
| 331 | * @m2m_dev: opaque pointer to the internal data to handle M2M context | ||
| 332 | * | ||
| 333 | * Usually called from driver's ``remove()`` function. | ||
| 334 | */ | ||
| 143 | void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); | 335 | void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); |
| 144 | 336 | ||
| 337 | /** | ||
| 338 | * v4l2_m2m_ctx_init() - allocate and initialize a m2m context | ||
| 339 | * | ||
| 340 | * @m2m_dev: opaque pointer to the internal data to handle M2M context | ||
| 341 | * @drv_priv: driver's instance private data | ||
| 342 | * @queue_init: a callback for queue type-specific initialization function | ||
| 343 | * to be used for initializing videobuf_queues | ||
| 344 | * | ||
| 345 | * Usually called from driver's ``open()`` function. | ||
| 346 | */ | ||
| 145 | struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, | 347 | struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, |
| 146 | void *drv_priv, | 348 | void *drv_priv, |
| 147 | int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)); | 349 | int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)); |
| @@ -158,8 +360,23 @@ static inline void v4l2_m2m_set_dst_buffered(struct v4l2_m2m_ctx *m2m_ctx, | |||
| 158 | m2m_ctx->cap_q_ctx.buffered = buffered; | 360 | m2m_ctx->cap_q_ctx.buffered = buffered; |
| 159 | } | 361 | } |
| 160 | 362 | ||
| 363 | /** | ||
| 364 | * v4l2_m2m_ctx_release() - release m2m context | ||
| 365 | * | ||
| 366 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 367 | * | ||
| 368 | * Usually called from driver's release() function. | ||
| 369 | */ | ||
| 161 | void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); | 370 | void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); |
| 162 | 371 | ||
| 372 | /** | ||
| 373 | * v4l2_m2m_buf_queue() - add a buffer to the proper ready buffers list. | ||
| 374 | * | ||
| 375 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx | ||
| 376 | * @vbuf: pointer to struct &vb2_v4l2_buffer | ||
| 377 | * | ||
| 378 | * Call from videobuf_queue_ops->ops->buf_queue, videobuf_queue_ops callback. | ||
| 379 | */ | ||
| 163 | void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, | 380 | void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, |
| 164 | struct vb2_v4l2_buffer *vbuf); | 381 | struct vb2_v4l2_buffer *vbuf); |
| 165 | 382 | ||
| @@ -167,7 +384,7 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, | |||
| 167 | * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for | 384 | * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for |
| 168 | * use | 385 | * use |
| 169 | * | 386 | * |
| 170 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 387 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 171 | */ | 388 | */ |
| 172 | static inline | 389 | static inline |
| 173 | unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) | 390 | unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) |
| @@ -176,10 +393,10 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 176 | } | 393 | } |
| 177 | 394 | ||
| 178 | /** | 395 | /** |
| 179 | * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers | 396 | * v4l2_m2m_num_dst_bufs_ready() - return the number of destination buffers |
| 180 | * ready for use | 397 | * ready for use |
| 181 | * | 398 | * |
| 182 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 399 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 183 | */ | 400 | */ |
| 184 | static inline | 401 | static inline |
| 185 | unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) | 402 | unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) |
| @@ -187,13 +404,18 @@ unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 187 | return m2m_ctx->cap_q_ctx.num_rdy; | 404 | return m2m_ctx->cap_q_ctx.num_rdy; |
| 188 | } | 405 | } |
| 189 | 406 | ||
| 407 | /** | ||
| 408 | * v4l2_m2m_next_buf() - return next buffer from the list of ready buffers | ||
| 409 | * | ||
| 410 | * @q_ctx: pointer to struct @v4l2_m2m_queue_ctx | ||
| 411 | */ | ||
| 190 | void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); | 412 | void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); |
| 191 | 413 | ||
| 192 | /** | 414 | /** |
| 193 | * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready | 415 | * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready |
| 194 | * buffers | 416 | * buffers |
| 195 | * | 417 | * |
| 196 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 418 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 197 | */ | 419 | */ |
| 198 | static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) | 420 | static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) |
| 199 | { | 421 | { |
| @@ -204,7 +426,7 @@ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 204 | * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of | 426 | * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of |
| 205 | * ready buffers | 427 | * ready buffers |
| 206 | * | 428 | * |
| 207 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 429 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 208 | */ | 430 | */ |
| 209 | static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) | 431 | static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) |
| 210 | { | 432 | { |
| @@ -214,7 +436,7 @@ static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 214 | /** | 436 | /** |
| 215 | * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers | 437 | * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers |
| 216 | * | 438 | * |
| 217 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 439 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 218 | */ | 440 | */ |
| 219 | static inline | 441 | static inline |
| 220 | struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) | 442 | struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) |
| @@ -225,7 +447,7 @@ struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 225 | /** | 447 | /** |
| 226 | * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers | 448 | * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers |
| 227 | * | 449 | * |
| 228 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 450 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 229 | */ | 451 | */ |
| 230 | static inline | 452 | static inline |
| 231 | struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) | 453 | struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) |
| @@ -233,13 +455,19 @@ struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 233 | return &m2m_ctx->cap_q_ctx.q; | 455 | return &m2m_ctx->cap_q_ctx.q; |
| 234 | } | 456 | } |
| 235 | 457 | ||
| 458 | /** | ||
| 459 | * v4l2_m2m_buf_remove() - take off a buffer from the list of ready buffers and | ||
| 460 | * return it | ||
| 461 | * | ||
| 462 | * @q_ctx: pointer to struct @v4l2_m2m_queue_ctx | ||
| 463 | */ | ||
| 236 | void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx); | 464 | void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx); |
| 237 | 465 | ||
| 238 | /** | 466 | /** |
| 239 | * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready | 467 | * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready |
| 240 | * buffers and return it | 468 | * buffers and return it |
| 241 | * | 469 | * |
| 242 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 470 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 243 | */ | 471 | */ |
| 244 | static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) | 472 | static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) |
| 245 | { | 473 | { |
| @@ -250,7 +478,7 @@ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) | |||
| 250 | * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of | 478 | * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of |
| 251 | * ready buffers and return it | 479 | * ready buffers and return it |
| 252 | * | 480 | * |
| 253 | * @m2m_ctx: pointer to struct v4l2_m2m_ctx | 481 | * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx |
| 254 | */ | 482 | */ |
| 255 | static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) | 483 | static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) |
| 256 | { | 484 | { |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2a2240c99b30..cf778c5dca18 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
| @@ -184,8 +184,6 @@ struct v4l2_subdev_io_pin_config { | |||
| 184 | * for it to be warned when the value of a control changes. | 184 | * for it to be warned when the value of a control changes. |
| 185 | * | 185 | * |
| 186 | * @unsubscribe_event: remove event subscription from the control framework. | 186 | * @unsubscribe_event: remove event subscription from the control framework. |
| 187 | * | ||
| 188 | * @registered_async: the subdevice has been registered async. | ||
| 189 | */ | 187 | */ |
| 190 | struct v4l2_subdev_core_ops { | 188 | struct v4l2_subdev_core_ops { |
| 191 | int (*log_status)(struct v4l2_subdev *sd); | 189 | int (*log_status)(struct v4l2_subdev *sd); |
| @@ -211,11 +209,11 @@ struct v4l2_subdev_core_ops { | |||
| 211 | struct v4l2_event_subscription *sub); | 209 | struct v4l2_event_subscription *sub); |
| 212 | int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh, | 210 | int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh, |
| 213 | struct v4l2_event_subscription *sub); | 211 | struct v4l2_event_subscription *sub); |
| 214 | int (*registered_async)(struct v4l2_subdev *sd); | ||
| 215 | }; | 212 | }; |
| 216 | 213 | ||
| 217 | /** | 214 | /** |
| 218 | * struct s_radio - Callbacks used when v4l device was opened in radio mode. | 215 | * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened |
| 216 | * in radio mode. | ||
| 219 | * | 217 | * |
| 220 | * @s_radio: callback for %VIDIOC_S_RADIO ioctl handler code. | 218 | * @s_radio: callback for %VIDIOC_S_RADIO ioctl handler code. |
| 221 | * | 219 | * |
| @@ -229,7 +227,7 @@ struct v4l2_subdev_core_ops { | |||
| 229 | * | 227 | * |
| 230 | * @g_tuner: callback for %VIDIOC_G_TUNER ioctl handler code. | 228 | * @g_tuner: callback for %VIDIOC_G_TUNER ioctl handler code. |
| 231 | * | 229 | * |
| 232 | * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. &vt->type must be | 230 | * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. @vt->type must be |
| 233 | * filled in. Normally done by video_ioctl2 or the | 231 | * filled in. Normally done by video_ioctl2 or the |
| 234 | * bridge driver. | 232 | * bridge driver. |
| 235 | * | 233 | * |
| @@ -358,11 +356,7 @@ struct v4l2_mbus_frame_desc { | |||
| 358 | * @s_stream: used to notify the driver that a video stream will start or has | 356 | * @s_stream: used to notify the driver that a video stream will start or has |
| 359 | * stopped. | 357 | * stopped. |
| 360 | * | 358 | * |
| 361 | * @cropcap: callback for %VIDIOC_CROPCAP ioctl handler code. | 359 | * @g_pixelaspect: callback to return the pixelaspect ratio. |
| 362 | * | ||
| 363 | * @g_crop: callback for %VIDIOC_G_CROP ioctl handler code. | ||
| 364 | * | ||
| 365 | * @s_crop: callback for %VIDIOC_S_CROP ioctl handler code. | ||
| 366 | * | 360 | * |
| 367 | * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. | 361 | * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. |
| 368 | * | 362 | * |
| @@ -402,9 +396,7 @@ struct v4l2_subdev_video_ops { | |||
| 402 | int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); | 396 | int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); |
| 403 | int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); | 397 | int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); |
| 404 | int (*s_stream)(struct v4l2_subdev *sd, int enable); | 398 | int (*s_stream)(struct v4l2_subdev *sd, int enable); |
| 405 | int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); | 399 | int (*g_pixelaspect)(struct v4l2_subdev *sd, struct v4l2_fract *aspect); |
| 406 | int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); | ||
| 407 | int (*s_crop)(struct v4l2_subdev *sd, const struct v4l2_crop *crop); | ||
| 408 | int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | 400 | int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); |
| 409 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | 401 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); |
| 410 | int (*g_frame_interval)(struct v4l2_subdev *sd, | 402 | int (*g_frame_interval)(struct v4l2_subdev *sd, |
| @@ -430,7 +422,7 @@ struct v4l2_subdev_video_ops { | |||
| 430 | * in video mode via the vbi device node. | 422 | * in video mode via the vbi device node. |
| 431 | * | 423 | * |
| 432 | * @decode_vbi_line: video decoders that support sliced VBI need to implement | 424 | * @decode_vbi_line: video decoders that support sliced VBI need to implement |
| 433 | * this ioctl. Field p of the &struct v4l2_sliced_vbi_line is set to the | 425 | * this ioctl. Field p of the &struct v4l2_decode_vbi_line is set to the |
| 434 | * start of the VBI data that was generated by the decoder. The driver | 426 | * start of the VBI data that was generated by the decoder. The driver |
| 435 | * then parses the sliced VBI data and sets the other fields in the | 427 | * then parses the sliced VBI data and sets the other fields in the |
| 436 | * struct accordingly. The pointer p is updated to point to the start of | 428 | * struct accordingly. The pointer p is updated to point to the start of |
| @@ -773,7 +765,7 @@ struct v4l2_subdev_platform_data { | |||
| 773 | * @entity: pointer to &struct media_entity | 765 | * @entity: pointer to &struct media_entity |
| 774 | * @list: List of sub-devices | 766 | * @list: List of sub-devices |
| 775 | * @owner: The owner is the same as the driver's &struct device owner. | 767 | * @owner: The owner is the same as the driver's &struct device owner. |
| 776 | * @owner_v4l2_dev: true if the &sd->owner matches the owner of &v4l2_dev->dev | 768 | * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev |
| 777 | * ownner. Initialized by v4l2_device_register_subdev(). | 769 | * ownner. Initialized by v4l2_device_register_subdev(). |
| 778 | * @flags: subdev flags. Can be: | 770 | * @flags: subdev flags. Can be: |
| 779 | * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; | 771 | * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; |
| @@ -783,9 +775,9 @@ struct v4l2_subdev_platform_data { | |||
| 783 | * %V4L2_SUBDEV_FL_HAS_EVENTS - Set this flag if this subdev generates | 775 | * %V4L2_SUBDEV_FL_HAS_EVENTS - Set this flag if this subdev generates |
| 784 | * events. | 776 | * events. |
| 785 | * | 777 | * |
| 786 | * @v4l2_dev: pointer to &struct v4l2_device | 778 | * @v4l2_dev: pointer to struct &v4l2_device |
| 787 | * @ops: pointer to &struct v4l2_subdev_ops | 779 | * @ops: pointer to struct &v4l2_subdev_ops |
| 788 | * @internal_ops: pointer to &struct v4l2_subdev_internal_ops. | 780 | * @internal_ops: pointer to struct &v4l2_subdev_internal_ops. |
| 789 | * Never call these internal ops from within a driver! | 781 | * Never call these internal ops from within a driver! |
| 790 | * @ctrl_handler: The control handler of this subdev. May be NULL. | 782 | * @ctrl_handler: The control handler of this subdev. May be NULL. |
| 791 | * @name: Name of the sub-device. Please notice that the name must be unique. | 783 | * @name: Name of the sub-device. Please notice that the name must be unique. |
| @@ -896,7 +888,7 @@ static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) | |||
| 896 | } | 888 | } |
| 897 | 889 | ||
| 898 | /** | 890 | /** |
| 899 | * v4l2_set_subdevdata - Sets V4L2 dev private host data | 891 | * v4l2_set_subdev_hostdata - Sets V4L2 dev private host data |
| 900 | * | 892 | * |
| 901 | * @sd: pointer to &struct v4l2_subdev | 893 | * @sd: pointer to &struct v4l2_subdev |
| 902 | * @p: pointer to the private data to be stored. | 894 | * @p: pointer to the private data to be stored. |
| @@ -907,7 +899,7 @@ static inline void v4l2_set_subdev_hostdata(struct v4l2_subdev *sd, void *p) | |||
| 907 | } | 899 | } |
| 908 | 900 | ||
| 909 | /** | 901 | /** |
| 910 | * v4l2_get_subdevdata - Gets V4L2 dev private data | 902 | * v4l2_get_subdev_hostdata - Gets V4L2 dev private data |
| 911 | * | 903 | * |
| 912 | * @sd: pointer to &struct v4l2_subdev | 904 | * @sd: pointer to &struct v4l2_subdev |
| 913 | * | 905 | * |
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index a4a9a55a0c42..ac5898a55fd9 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
| @@ -20,6 +20,20 @@ | |||
| 20 | #define VB2_MAX_FRAME (32) | 20 | #define VB2_MAX_FRAME (32) |
| 21 | #define VB2_MAX_PLANES (8) | 21 | #define VB2_MAX_PLANES (8) |
| 22 | 22 | ||
| 23 | /** | ||
| 24 | * enum vb2_memory - type of memory model used to make the buffers visible | ||
| 25 | * on userspace. | ||
| 26 | * | ||
| 27 | * @VB2_MEMORY_UNKNOWN: Buffer status is unknown or it is not used yet on | ||
| 28 | * userspace. | ||
| 29 | * @VB2_MEMORY_MMAP: The buffers are allocated by the Kernel and it is | ||
| 30 | * memory mapped via mmap() ioctl. This model is | ||
| 31 | * also used when the user is using the buffers via | ||
| 32 | * read() or write() system calls. | ||
| 33 | * @VB2_MEMORY_USERPTR: The buffers was allocated in userspace and it is | ||
| 34 | * memory mapped via mmap() ioctl. | ||
| 35 | * @VB2_MEMORY_DMABUF: The buffers are passed to userspace via DMA buffer. | ||
| 36 | */ | ||
| 23 | enum vb2_memory { | 37 | enum vb2_memory { |
| 24 | VB2_MEMORY_UNKNOWN = 0, | 38 | VB2_MEMORY_UNKNOWN = 0, |
| 25 | VB2_MEMORY_MMAP = 1, | 39 | VB2_MEMORY_MMAP = 1, |
| @@ -33,15 +47,15 @@ struct vb2_threadio_data; | |||
| 33 | /** | 47 | /** |
| 34 | * struct vb2_mem_ops - memory handling/memory allocator operations | 48 | * struct vb2_mem_ops - memory handling/memory allocator operations |
| 35 | * @alloc: allocate video memory and, optionally, allocator private data, | 49 | * @alloc: allocate video memory and, optionally, allocator private data, |
| 36 | * return NULL on failure or a pointer to allocator private, | 50 | * return ERR_PTR() on failure or a pointer to allocator private, |
| 37 | * per-buffer data on success; the returned private structure | 51 | * per-buffer data on success; the returned private structure |
| 38 | * will then be passed as buf_priv argument to other ops in this | 52 | * will then be passed as @buf_priv argument to other ops in this |
| 39 | * structure. Additional gfp_flags to use when allocating the | 53 | * structure. Additional gfp_flags to use when allocating the |
| 40 | * are also passed to this operation. These flags are from the | 54 | * are also passed to this operation. These flags are from the |
| 41 | * gfp_flags field of vb2_queue. | 55 | * gfp_flags field of vb2_queue. |
| 42 | * @put: inform the allocator that the buffer will no longer be used; | 56 | * @put: inform the allocator that the buffer will no longer be used; |
| 43 | * usually will result in the allocator freeing the buffer (if | 57 | * usually will result in the allocator freeing the buffer (if |
| 44 | * no other users of this buffer are present); the buf_priv | 58 | * no other users of this buffer are present); the @buf_priv |
| 45 | * argument is the allocator private per-buffer structure | 59 | * argument is the allocator private per-buffer structure |
| 46 | * previously returned from the alloc callback. | 60 | * previously returned from the alloc callback. |
| 47 | * @get_dmabuf: acquire userspace memory for a hardware operation; used for | 61 | * @get_dmabuf: acquire userspace memory for a hardware operation; used for |
| @@ -50,18 +64,18 @@ struct vb2_threadio_data; | |||
| 50 | * USERPTR memory types; vaddr is the address passed to the | 64 | * USERPTR memory types; vaddr is the address passed to the |
| 51 | * videobuf layer when queuing a video buffer of USERPTR type; | 65 | * videobuf layer when queuing a video buffer of USERPTR type; |
| 52 | * should return an allocator private per-buffer structure | 66 | * should return an allocator private per-buffer structure |
| 53 | * associated with the buffer on success, NULL on failure; | 67 | * associated with the buffer on success, ERR_PTR() on failure; |
| 54 | * the returned private structure will then be passed as buf_priv | 68 | * the returned private structure will then be passed as @buf_priv |
| 55 | * argument to other ops in this structure. | 69 | * argument to other ops in this structure. |
| 56 | * @put_userptr: inform the allocator that a USERPTR buffer will no longer | 70 | * @put_userptr: inform the allocator that a USERPTR buffer will no longer |
| 57 | * be used. | 71 | * be used. |
| 58 | * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; | 72 | * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; |
| 59 | * used for DMABUF memory types; dev is the alloc device | 73 | * used for DMABUF memory types; dev is the alloc device |
| 60 | * dbuf is the shared dma_buf; returns NULL on failure; | 74 | * dbuf is the shared dma_buf; returns ERR_PTR() on failure; |
| 61 | * allocator private per-buffer structure on success; | 75 | * allocator private per-buffer structure on success; |
| 62 | * this needs to be used for further accesses to the buffer. | 76 | * this needs to be used for further accesses to the buffer. |
| 63 | * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF | 77 | * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF |
| 64 | * buffer is no longer used; the buf_priv argument is the | 78 | * buffer is no longer used; the @buf_priv argument is the |
| 65 | * allocator private per-buffer structure previously returned | 79 | * allocator private per-buffer structure previously returned |
| 66 | * from the attach_dmabuf callback. | 80 | * from the attach_dmabuf callback. |
| 67 | * @map_dmabuf: request for access to the dmabuf from allocator; the allocator | 81 | * @map_dmabuf: request for access to the dmabuf from allocator; the allocator |
| @@ -95,11 +109,13 @@ struct vb2_threadio_data; | |||
| 95 | * | 109 | * |
| 96 | * #) Required ops for read/write access types: alloc, put, num_users, vaddr. | 110 | * #) Required ops for read/write access types: alloc, put, num_users, vaddr. |
| 97 | * | 111 | * |
| 98 | * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf, unmap_dmabuf. | 112 | * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, |
| 113 | * map_dmabuf, unmap_dmabuf. | ||
| 99 | */ | 114 | */ |
| 100 | struct vb2_mem_ops { | 115 | struct vb2_mem_ops { |
| 101 | void *(*alloc)(struct device *dev, unsigned long attrs, | 116 | void *(*alloc)(struct device *dev, unsigned long attrs, |
| 102 | unsigned long size, enum dma_data_direction dma_dir, | 117 | unsigned long size, |
| 118 | enum dma_data_direction dma_dir, | ||
| 103 | gfp_t gfp_flags); | 119 | gfp_t gfp_flags); |
| 104 | void (*put)(void *buf_priv); | 120 | void (*put)(void *buf_priv); |
| 105 | struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); | 121 | struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); |
| @@ -112,7 +128,8 @@ struct vb2_mem_ops { | |||
| 112 | void (*prepare)(void *buf_priv); | 128 | void (*prepare)(void *buf_priv); |
| 113 | void (*finish)(void *buf_priv); | 129 | void (*finish)(void *buf_priv); |
| 114 | 130 | ||
| 115 | void *(*attach_dmabuf)(struct device *dev, struct dma_buf *dbuf, | 131 | void *(*attach_dmabuf)(struct device *dev, |
| 132 | struct dma_buf *dbuf, | ||
| 116 | unsigned long size, | 133 | unsigned long size, |
| 117 | enum dma_data_direction dma_dir); | 134 | enum dma_data_direction dma_dir); |
| 118 | void (*detach_dmabuf)(void *buf_priv); | 135 | void (*detach_dmabuf)(void *buf_priv); |
| @@ -277,7 +294,7 @@ struct vb2_buffer { | |||
| 277 | /** | 294 | /** |
| 278 | * struct vb2_ops - driver-specific callbacks | 295 | * struct vb2_ops - driver-specific callbacks |
| 279 | * | 296 | * |
| 280 | * @queue_setup: called from %VIDIOC_REQBUFS and %VIDIOC_CREATE_BUFS | 297 | * @queue_setup: called from VIDIOC_REQBUFS() and VIDIOC_CREATE_BUFS() |
| 281 | * handlers before memory allocation. It can be called | 298 | * handlers before memory allocation. It can be called |
| 282 | * twice: if the original number of requested buffers | 299 | * twice: if the original number of requested buffers |
| 283 | * could not be allocated, then it will be called a | 300 | * could not be allocated, then it will be called a |
| @@ -288,11 +305,11 @@ struct vb2_buffer { | |||
| 288 | * buffer in \*num_planes, the size of each plane should be | 305 | * buffer in \*num_planes, the size of each plane should be |
| 289 | * set in the sizes\[\] array and optional per-plane | 306 | * set in the sizes\[\] array and optional per-plane |
| 290 | * allocator specific device in the alloc_devs\[\] array. | 307 | * allocator specific device in the alloc_devs\[\] array. |
| 291 | * When called from %VIDIOC_REQBUFS, \*num_planes == 0, the | 308 | * When called from VIDIOC_REQBUFS,() \*num_planes == 0, |
| 292 | * driver has to use the currently configured format to | 309 | * the driver has to use the currently configured format to |
| 293 | * determine the plane sizes and \*num_buffers is the total | 310 | * determine the plane sizes and \*num_buffers is the total |
| 294 | * number of buffers that are being allocated. When called | 311 | * number of buffers that are being allocated. When called |
| 295 | * from %VIDIOC_CREATE_BUFS, \*num_planes != 0 and it | 312 | * from VIDIOC_CREATE_BUFS,() \*num_planes != 0 and it |
| 296 | * describes the requested number of planes and sizes\[\] | 313 | * describes the requested number of planes and sizes\[\] |
| 297 | * contains the requested plane sizes. If either | 314 | * contains the requested plane sizes. If either |
| 298 | * \*num_planes or the requested sizes are invalid callback | 315 | * \*num_planes or the requested sizes are invalid callback |
| @@ -311,11 +328,11 @@ struct vb2_buffer { | |||
| 311 | * initialization failure (return != 0) will prevent | 328 | * initialization failure (return != 0) will prevent |
| 312 | * queue setup from completing successfully; optional. | 329 | * queue setup from completing successfully; optional. |
| 313 | * @buf_prepare: called every time the buffer is queued from userspace | 330 | * @buf_prepare: called every time the buffer is queued from userspace |
| 314 | * and from the %VIDIOC_PREPARE_BUF ioctl; drivers may | 331 | * and from the VIDIOC_PREPARE_BUF() ioctl; drivers may |
| 315 | * perform any initialization required before each | 332 | * perform any initialization required before each |
| 316 | * hardware operation in this callback; drivers can | 333 | * hardware operation in this callback; drivers can |
| 317 | * access/modify the buffer here as it is still synced for | 334 | * access/modify the buffer here as it is still synced for |
| 318 | * the CPU; drivers that support %VIDIOC_CREATE_BUFS must | 335 | * the CPU; drivers that support VIDIOC_CREATE_BUFS() must |
| 319 | * also validate the buffer size; if an error is returned, | 336 | * also validate the buffer size; if an error is returned, |
| 320 | * the buffer will not be queued in driver; optional. | 337 | * the buffer will not be queued in driver; optional. |
| 321 | * @buf_finish: called before every dequeue of the buffer back to | 338 | * @buf_finish: called before every dequeue of the buffer back to |
| @@ -339,24 +356,25 @@ struct vb2_buffer { | |||
| 339 | * driver can return an error if hardware fails, in that | 356 | * driver can return an error if hardware fails, in that |
| 340 | * case all buffers that have been already given by | 357 | * case all buffers that have been already given by |
| 341 | * the @buf_queue callback are to be returned by the driver | 358 | * the @buf_queue callback are to be returned by the driver |
| 342 | * by calling @vb2_buffer_done\(%VB2_BUF_STATE_QUEUED\). | 359 | * by calling vb2_buffer_done() with %VB2_BUF_STATE_QUEUED. |
| 343 | * If you need a minimum number of buffers before you can | 360 | * If you need a minimum number of buffers before you can |
| 344 | * start streaming, then set @min_buffers_needed in the | 361 | * start streaming, then set @min_buffers_needed in the |
| 345 | * vb2_queue structure. If that is non-zero then | 362 | * vb2_queue structure. If that is non-zero then |
| 346 | * start_streaming won't be called until at least that | 363 | * @start_streaming won't be called until at least that |
| 347 | * many buffers have been queued up by userspace. | 364 | * many buffers have been queued up by userspace. |
| 348 | * @stop_streaming: called when 'streaming' state must be disabled; driver | 365 | * @stop_streaming: called when 'streaming' state must be disabled; driver |
| 349 | * should stop any DMA transactions or wait until they | 366 | * should stop any DMA transactions or wait until they |
| 350 | * finish and give back all buffers it got from &buf_queue | 367 | * finish and give back all buffers it got from &buf_queue |
| 351 | * callback by calling @vb2_buffer_done\(\) with either | 368 | * callback by calling vb2_buffer_done() with either |
| 352 | * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use | 369 | * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use |
| 353 | * vb2_wait_for_all_buffers() function | 370 | * vb2_wait_for_all_buffers() function |
| 354 | * @buf_queue: passes buffer vb to the driver; driver may start | 371 | * @buf_queue: passes buffer vb to the driver; driver may start |
| 355 | * hardware operation on this buffer; driver should give | 372 | * hardware operation on this buffer; driver should give |
| 356 | * the buffer back by calling vb2_buffer_done() function; | 373 | * the buffer back by calling vb2_buffer_done() function; |
| 357 | * it is allways called after calling %VIDIOC_STREAMON ioctl; | 374 | * it is allways called after calling VIDIOC_STREAMON() |
| 358 | * might be called before start_streaming callback if user | 375 | * ioctl; might be called before @start_streaming callback |
| 359 | * pre-queued buffers before calling %VIDIOC_STREAMON. | 376 | * if user pre-queued buffers before calling |
| 377 | * VIDIOC_STREAMON(). | ||
| 360 | */ | 378 | */ |
| 361 | struct vb2_ops { | 379 | struct vb2_ops { |
| 362 | int (*queue_setup)(struct vb2_queue *q, | 380 | int (*queue_setup)(struct vb2_queue *q, |
| @@ -378,7 +396,7 @@ struct vb2_ops { | |||
| 378 | }; | 396 | }; |
| 379 | 397 | ||
| 380 | /** | 398 | /** |
| 381 | * struct vb2_ops - driver-specific callbacks | 399 | * struct vb2_buf_ops - driver-specific callbacks |
| 382 | * | 400 | * |
| 383 | * @verify_planes_array: Verify that a given user space structure contains | 401 | * @verify_planes_array: Verify that a given user space structure contains |
| 384 | * enough planes for the buffer. This is called | 402 | * enough planes for the buffer. This is called |
| @@ -404,7 +422,7 @@ struct vb2_buf_ops { | |||
| 404 | * | 422 | * |
| 405 | * @type: private buffer type whose content is defined by the vb2-core | 423 | * @type: private buffer type whose content is defined by the vb2-core |
| 406 | * caller. For example, for V4L2, it should match | 424 | * caller. For example, for V4L2, it should match |
| 407 | * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h | 425 | * the types defined on enum &v4l2_buf_type |
| 408 | * @io_modes: supported io methods (see vb2_io_modes enum) | 426 | * @io_modes: supported io methods (see vb2_io_modes enum) |
| 409 | * @dev: device to use for the default allocation context if the driver | 427 | * @dev: device to use for the default allocation context if the driver |
| 410 | * doesn't fill in the @alloc_devs array. | 428 | * doesn't fill in the @alloc_devs array. |
| @@ -439,12 +457,12 @@ struct vb2_buf_ops { | |||
| 439 | * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 | 457 | * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 |
| 440 | * to force the buffer allocation to a specific memory zone. | 458 | * to force the buffer allocation to a specific memory zone. |
| 441 | * @min_buffers_needed: the minimum number of buffers needed before | 459 | * @min_buffers_needed: the minimum number of buffers needed before |
| 442 | * start_streaming() can be called. Used when a DMA engine | 460 | * @start_streaming can be called. Used when a DMA engine |
| 443 | * cannot be started unless at least this number of buffers | 461 | * cannot be started unless at least this number of buffers |
| 444 | * have been queued into the driver. | 462 | * have been queued into the driver. |
| 445 | */ | 463 | */ |
| 446 | /* | 464 | /* |
| 447 | * Private elements (won't appear at the DocBook): | 465 | * Private elements (won't appear at the uAPI book): |
| 448 | * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped | 466 | * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped |
| 449 | * @memory: current memory type used | 467 | * @memory: current memory type used |
| 450 | * @bufs: videobuf buffer structures | 468 | * @bufs: videobuf buffer structures |
| @@ -457,7 +475,7 @@ struct vb2_buf_ops { | |||
| 457 | * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued | 475 | * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued |
| 458 | * @alloc_devs: memory type/allocator-specific per-plane device | 476 | * @alloc_devs: memory type/allocator-specific per-plane device |
| 459 | * @streaming: current streaming state | 477 | * @streaming: current streaming state |
| 460 | * @start_streaming_called: start_streaming() was called successfully and we | 478 | * @start_streaming_called: @start_streaming was called successfully and we |
| 461 | * started streaming. | 479 | * started streaming. |
| 462 | * @error: a fatal error occurred on the queue | 480 | * @error: a fatal error occurred on the queue |
| 463 | * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for | 481 | * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for |
| @@ -536,36 +554,286 @@ struct vb2_queue { | |||
| 536 | #endif | 554 | #endif |
| 537 | }; | 555 | }; |
| 538 | 556 | ||
| 557 | /** | ||
| 558 | * vb2_plane_vaddr() - Return a kernel virtual address of a given plane | ||
| 559 | * @vb: vb2_buffer to which the plane in question belongs to | ||
| 560 | * @plane_no: plane number for which the address is to be returned | ||
| 561 | * | ||
| 562 | * This function returns a kernel virtual address of a given plane if | ||
| 563 | * such a mapping exist, NULL otherwise. | ||
| 564 | */ | ||
| 539 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); | 565 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); |
| 566 | |||
| 567 | /** | ||
| 568 | * vb2_plane_cookie() - Return allocator specific cookie for the given plane | ||
| 569 | * @vb: vb2_buffer to which the plane in question belongs to | ||
| 570 | * @plane_no: plane number for which the cookie is to be returned | ||
| 571 | * | ||
| 572 | * This function returns an allocator specific cookie for a given plane if | ||
| 573 | * available, NULL otherwise. The allocator should provide some simple static | ||
| 574 | * inline function, which would convert this cookie to the allocator specific | ||
| 575 | * type that can be used directly by the driver to access the buffer. This can | ||
| 576 | * be for example physical address, pointer to scatter list or IOMMU mapping. | ||
| 577 | */ | ||
| 540 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); | 578 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); |
| 541 | 579 | ||
| 580 | /** | ||
| 581 | * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished | ||
| 582 | * @vb: vb2_buffer returned from the driver | ||
| 583 | * @state: either %VB2_BUF_STATE_DONE if the operation finished | ||
| 584 | * successfully, %VB2_BUF_STATE_ERROR if the operation finished | ||
| 585 | * with an error or %VB2_BUF_STATE_QUEUED if the driver wants to | ||
| 586 | * requeue buffers. If start_streaming fails then it should return | ||
| 587 | * buffers with state %VB2_BUF_STATE_QUEUED to put them back into | ||
| 588 | * the queue. | ||
| 589 | * | ||
| 590 | * This function should be called by the driver after a hardware operation on | ||
| 591 | * a buffer is finished and the buffer may be returned to userspace. The driver | ||
| 592 | * cannot use this buffer anymore until it is queued back to it by videobuf | ||
| 593 | * by the means of &vb2_ops->buf_queue callback. Only buffers previously queued | ||
| 594 | * to the driver by &vb2_ops->buf_queue can be passed to this function. | ||
| 595 | * | ||
| 596 | * While streaming a buffer can only be returned in state DONE or ERROR. | ||
| 597 | * The start_streaming op can also return them in case the DMA engine cannot | ||
| 598 | * be started for some reason. In that case the buffers should be returned with | ||
| 599 | * state QUEUED. | ||
| 600 | */ | ||
| 542 | void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state); | 601 | void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state); |
| 602 | |||
| 603 | /** | ||
| 604 | * vb2_discard_done() - discard all buffers marked as DONE | ||
| 605 | * @q: videobuf2 queue | ||
| 606 | * | ||
| 607 | * This function is intended to be used with suspend/resume operations. It | ||
| 608 | * discards all 'done' buffers as they would be too old to be requested after | ||
| 609 | * resume. | ||
| 610 | * | ||
| 611 | * Drivers must stop the hardware and synchronize with interrupt handlers and/or | ||
| 612 | * delayed works before calling this function to make sure no buffer will be | ||
| 613 | * touched by the driver and/or hardware. | ||
| 614 | */ | ||
| 543 | void vb2_discard_done(struct vb2_queue *q); | 615 | void vb2_discard_done(struct vb2_queue *q); |
| 616 | |||
| 617 | /** | ||
| 618 | * vb2_wait_for_all_buffers() - wait until all buffers are given back to vb2 | ||
| 619 | * @q: videobuf2 queue | ||
| 620 | * | ||
| 621 | * This function will wait until all buffers that have been given to the driver | ||
| 622 | * by &vb2_ops->buf_queue are given back to vb2 with vb2_buffer_done(). It | ||
| 623 | * doesn't call wait_prepare()/wait_finish() pair. It is intended to be called | ||
| 624 | * with all locks taken, for example from &vb2_ops->stop_streaming callback. | ||
| 625 | */ | ||
| 544 | int vb2_wait_for_all_buffers(struct vb2_queue *q); | 626 | int vb2_wait_for_all_buffers(struct vb2_queue *q); |
| 545 | 627 | ||
| 628 | /** | ||
| 629 | * vb2_core_querybuf() - query video buffer information | ||
| 630 | * @q: videobuf queue | ||
| 631 | * @index: id number of the buffer | ||
| 632 | * @pb: buffer struct passed from userspace | ||
| 633 | * | ||
| 634 | * Should be called from vidioc_querybuf ioctl handler in driver. | ||
| 635 | * The passed buffer should have been verified. | ||
| 636 | * This function fills the relevant information for the userspace. | ||
| 637 | */ | ||
| 546 | void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); | 638 | void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); |
| 639 | |||
| 640 | /** | ||
| 641 | * vb2_core_reqbufs() - Initiate streaming | ||
| 642 | * @q: videobuf2 queue | ||
| 643 | * @memory: memory type | ||
| 644 | * @count: requested buffer count | ||
| 645 | * | ||
| 646 | * Should be called from vidioc_reqbufs ioctl handler of a driver. | ||
| 647 | * | ||
| 648 | * This function: | ||
| 649 | * | ||
| 650 | * #) verifies streaming parameters passed from the userspace, | ||
| 651 | * #) sets up the queue, | ||
| 652 | * #) negotiates number of buffers and planes per buffer with the driver | ||
| 653 | * to be used during streaming, | ||
| 654 | * #) allocates internal buffer structures (struct vb2_buffer), according to | ||
| 655 | * the agreed parameters, | ||
| 656 | * #) for MMAP memory type, allocates actual video memory, using the | ||
| 657 | * memory handling/allocation routines provided during queue initialization | ||
| 658 | * | ||
| 659 | * If req->count is 0, all the memory will be freed instead. | ||
| 660 | * If the queue has been allocated previously (by a previous vb2_reqbufs) call | ||
| 661 | * and the queue is not busy, memory will be reallocated. | ||
| 662 | * | ||
| 663 | * The return values from this function are intended to be directly returned | ||
| 664 | * from vidioc_reqbufs handler in driver. | ||
| 665 | */ | ||
| 547 | int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, | 666 | int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, |
| 548 | unsigned int *count); | 667 | unsigned int *count); |
| 668 | |||
| 669 | /** | ||
| 670 | * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs | ||
| 671 | * @q: videobuf2 queue | ||
| 672 | * @memory: memory type | ||
| 673 | * @count: requested buffer count | ||
| 674 | * @requested_planes: number of planes requested | ||
| 675 | * @requested_sizes: array with the size of the planes | ||
| 676 | * | ||
| 677 | * Should be called from VIDIOC_CREATE_BUFS() ioctl handler of a driver. | ||
| 678 | * This function: | ||
| 679 | * | ||
| 680 | * #) verifies parameter sanity | ||
| 681 | * #) calls the .queue_setup() queue operation | ||
| 682 | * #) performs any necessary memory allocations | ||
| 683 | * | ||
| 684 | * Return: the return values from this function are intended to be directly | ||
| 685 | * returned from VIDIOC_CREATE_BUFS() handler in driver. | ||
| 686 | */ | ||
| 549 | int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, | 687 | int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, |
| 550 | unsigned int *count, unsigned requested_planes, | 688 | unsigned int *count, unsigned int requested_planes, |
| 551 | const unsigned int requested_sizes[]); | 689 | const unsigned int requested_sizes[]); |
| 690 | |||
| 691 | /** | ||
| 692 | * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace | ||
| 693 | * to the kernel | ||
| 694 | * @q: videobuf2 queue | ||
| 695 | * @index: id number of the buffer | ||
| 696 | * @pb: buffer structure passed from userspace to vidioc_prepare_buf | ||
| 697 | * handler in driver | ||
| 698 | * | ||
| 699 | * Should be called from vidioc_prepare_buf ioctl handler of a driver. | ||
| 700 | * The passed buffer should have been verified. | ||
| 701 | * This function calls buf_prepare callback in the driver (if provided), | ||
| 702 | * in which driver-specific buffer initialization can be performed, | ||
| 703 | * | ||
| 704 | * The return values from this function are intended to be directly returned | ||
| 705 | * from vidioc_prepare_buf handler in driver. | ||
| 706 | */ | ||
| 552 | int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb); | 707 | int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb); |
| 708 | |||
| 709 | /** | ||
| 710 | * vb2_core_qbuf() - Queue a buffer from userspace | ||
| 711 | * | ||
| 712 | * @q: videobuf2 queue | ||
| 713 | * @index: id number of the buffer | ||
| 714 | * @pb: buffer structure passed from userspace to vidioc_qbuf handler | ||
| 715 | * in driver | ||
| 716 | * | ||
| 717 | * Should be called from vidioc_qbuf ioctl handler of a driver. | ||
| 718 | * The passed buffer should have been verified. | ||
| 719 | * | ||
| 720 | * This function: | ||
| 721 | * | ||
| 722 | * #) if necessary, calls buf_prepare callback in the driver (if provided), in | ||
| 723 | * which driver-specific buffer initialization can be performed, | ||
| 724 | * #) if streaming is on, queues the buffer in driver by the means of | ||
| 725 | * &vb2_ops->buf_queue callback for processing. | ||
| 726 | * | ||
| 727 | * The return values from this function are intended to be directly returned | ||
| 728 | * from vidioc_qbuf handler in driver. | ||
| 729 | */ | ||
| 553 | int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb); | 730 | int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb); |
| 731 | |||
| 732 | /** | ||
| 733 | * vb2_core_dqbuf() - Dequeue a buffer to the userspace | ||
| 734 | * @q: videobuf2 queue | ||
| 735 | * @pindex: pointer to the buffer index. May be NULL | ||
| 736 | * @pb: buffer structure passed from userspace to vidioc_dqbuf handler | ||
| 737 | * in driver | ||
| 738 | * @nonblocking: if true, this call will not sleep waiting for a buffer if no | ||
| 739 | * buffers ready for dequeuing are present. Normally the driver | ||
| 740 | * would be passing (file->f_flags & O_NONBLOCK) here | ||
| 741 | * | ||
| 742 | * Should be called from vidioc_dqbuf ioctl handler of a driver. | ||
| 743 | * The passed buffer should have been verified. | ||
| 744 | * | ||
| 745 | * This function: | ||
| 746 | * | ||
| 747 | * #) calls buf_finish callback in the driver (if provided), in which | ||
| 748 | * driver can perform any additional operations that may be required before | ||
| 749 | * returning the buffer to userspace, such as cache sync, | ||
| 750 | * #) the buffer struct members are filled with relevant information for | ||
| 751 | * the userspace. | ||
| 752 | * | ||
| 753 | * The return values from this function are intended to be directly returned | ||
| 754 | * from vidioc_dqbuf handler in driver. | ||
| 755 | */ | ||
| 554 | int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, | 756 | int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, |
| 555 | bool nonblocking); | 757 | bool nonblocking); |
| 556 | 758 | ||
| 557 | int vb2_core_streamon(struct vb2_queue *q, unsigned int type); | 759 | int vb2_core_streamon(struct vb2_queue *q, unsigned int type); |
| 558 | int vb2_core_streamoff(struct vb2_queue *q, unsigned int type); | 760 | int vb2_core_streamoff(struct vb2_queue *q, unsigned int type); |
| 559 | 761 | ||
| 762 | /** | ||
| 763 | * vb2_core_expbuf() - Export a buffer as a file descriptor | ||
| 764 | * @q: videobuf2 queue | ||
| 765 | * @fd: file descriptor associated with DMABUF (set by driver) * | ||
| 766 | * @type: buffer type | ||
| 767 | * @index: id number of the buffer | ||
| 768 | * @plane: index of the plane to be exported, 0 for single plane queues | ||
| 769 | * @flags: flags for newly created file, currently only O_CLOEXEC is | ||
| 770 | * supported, refer to manual of open syscall for more details | ||
| 771 | * | ||
| 772 | * The return values from this function are intended to be directly returned | ||
| 773 | * from vidioc_expbuf handler in driver. | ||
| 774 | */ | ||
| 560 | int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, | 775 | int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, |
| 561 | unsigned int index, unsigned int plane, unsigned int flags); | 776 | unsigned int index, unsigned int plane, unsigned int flags); |
| 562 | 777 | ||
| 778 | /** | ||
| 779 | * vb2_core_queue_init() - initialize a videobuf2 queue | ||
| 780 | * @q: videobuf2 queue; this structure should be allocated in driver | ||
| 781 | * | ||
| 782 | * The vb2_queue structure should be allocated by the driver. The driver is | ||
| 783 | * responsible of clearing it's content and setting initial values for some | ||
| 784 | * required entries before calling this function. | ||
| 785 | * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer | ||
| 786 | * to the struct vb2_queue description in include/media/videobuf2-core.h | ||
| 787 | * for more information. | ||
| 788 | */ | ||
| 563 | int vb2_core_queue_init(struct vb2_queue *q); | 789 | int vb2_core_queue_init(struct vb2_queue *q); |
| 790 | |||
| 791 | /** | ||
| 792 | * vb2_core_queue_release() - stop streaming, release the queue and free memory | ||
| 793 | * @q: videobuf2 queue | ||
| 794 | * | ||
| 795 | * This function stops streaming and performs necessary clean ups, including | ||
| 796 | * freeing video buffer memory. The driver is responsible for freeing | ||
| 797 | * the vb2_queue structure itself. | ||
| 798 | */ | ||
| 564 | void vb2_core_queue_release(struct vb2_queue *q); | 799 | void vb2_core_queue_release(struct vb2_queue *q); |
| 565 | 800 | ||
| 801 | /** | ||
| 802 | * vb2_queue_error() - signal a fatal error on the queue | ||
| 803 | * @q: videobuf2 queue | ||
| 804 | * | ||
| 805 | * Flag that a fatal unrecoverable error has occurred and wake up all processes | ||
| 806 | * waiting on the queue. Polling will now set POLLERR and queuing and dequeuing | ||
| 807 | * buffers will return -EIO. | ||
| 808 | * | ||
| 809 | * The error flag will be cleared when cancelling the queue, either from | ||
| 810 | * vb2_streamoff or vb2_queue_release. Drivers should thus not call this | ||
| 811 | * function before starting the stream, otherwise the error flag will remain set | ||
| 812 | * until the queue is released when closing the device node. | ||
| 813 | */ | ||
| 566 | void vb2_queue_error(struct vb2_queue *q); | 814 | void vb2_queue_error(struct vb2_queue *q); |
| 567 | 815 | ||
| 816 | /** | ||
| 817 | * vb2_mmap() - map video buffers into application address space | ||
| 818 | * @q: videobuf2 queue | ||
| 819 | * @vma: vma passed to the mmap file operation handler in the driver | ||
| 820 | * | ||
| 821 | * Should be called from mmap file operation handler of a driver. | ||
| 822 | * This function maps one plane of one of the available video buffers to | ||
| 823 | * userspace. To map whole video memory allocated on reqbufs, this function | ||
| 824 | * has to be called once per each plane per each buffer previously allocated. | ||
| 825 | * | ||
| 826 | * When the userspace application calls mmap, it passes to it an offset returned | ||
| 827 | * to it earlier by the means of vidioc_querybuf handler. That offset acts as | ||
| 828 | * a "cookie", which is then used to identify the plane to be mapped. | ||
| 829 | * This function finds a plane with a matching offset and a mapping is performed | ||
| 830 | * by the means of a provided memory operation. | ||
| 831 | * | ||
| 832 | * The return values from this function are intended to be directly returned | ||
| 833 | * from the mmap handler in driver. | ||
| 834 | */ | ||
| 568 | int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); | 835 | int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); |
| 836 | |||
| 569 | #ifndef CONFIG_MMU | 837 | #ifndef CONFIG_MMU |
| 570 | unsigned long vb2_get_unmapped_area(struct vb2_queue *q, | 838 | unsigned long vb2_get_unmapped_area(struct vb2_queue *q, |
| 571 | unsigned long addr, | 839 | unsigned long addr, |
| @@ -573,15 +841,36 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q, | |||
| 573 | unsigned long pgoff, | 841 | unsigned long pgoff, |
| 574 | unsigned long flags); | 842 | unsigned long flags); |
| 575 | #endif | 843 | #endif |
| 844 | |||
| 845 | /** | ||
| 846 | * vb2_core_poll() - implements poll userspace operation | ||
| 847 | * @q: videobuf2 queue | ||
| 848 | * @file: file argument passed to the poll file operation handler | ||
| 849 | * @wait: wait argument passed to the poll file operation handler | ||
| 850 | * | ||
| 851 | * This function implements poll file operation handler for a driver. | ||
| 852 | * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will | ||
| 853 | * be informed that the file descriptor of a video device is available for | ||
| 854 | * reading. | ||
| 855 | * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor | ||
| 856 | * will be reported as available for writing. | ||
| 857 | * | ||
| 858 | * The return values from this function are intended to be directly returned | ||
| 859 | * from poll handler in driver. | ||
| 860 | */ | ||
| 576 | unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, | 861 | unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, |
| 577 | poll_table *wait); | 862 | poll_table *wait); |
| 863 | |||
| 578 | size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, | 864 | size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, |
| 579 | loff_t *ppos, int nonblock); | 865 | loff_t *ppos, int nonblock); |
| 580 | size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, | 866 | size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, |
| 581 | loff_t *ppos, int nonblock); | 867 | loff_t *ppos, int nonblock); |
| 582 | 868 | ||
| 583 | /* | 869 | /** |
| 584 | * vb2_thread_fnc - callback function for use with vb2_thread | 870 | * typedef vb2_thread_fnc - callback function for use with vb2_thread |
| 871 | * | ||
| 872 | * @vb: pointer to struct &vb2_buffer | ||
| 873 | * @priv: pointer to a private pointer | ||
| 585 | * | 874 | * |
| 586 | * This is called whenever a buffer is dequeued in the thread. | 875 | * This is called whenever a buffer is dequeued in the thread. |
| 587 | */ | 876 | */ |
| @@ -597,9 +886,11 @@ typedef int (*vb2_thread_fnc)(struct vb2_buffer *vb, void *priv); | |||
| 597 | * This starts a thread that will queue and dequeue until an error occurs | 886 | * This starts a thread that will queue and dequeue until an error occurs |
| 598 | * or @vb2_thread_stop is called. | 887 | * or @vb2_thread_stop is called. |
| 599 | * | 888 | * |
| 600 | * This function should not be used for anything else but the videobuf2-dvb | 889 | * .. attention:: |
| 601 | * support. If you think you have another good use-case for this, then please | 890 | * |
| 602 | * contact the linux-media mailinglist first. | 891 | * This function should not be used for anything else but the videobuf2-dvb |
| 892 | * support. If you think you have another good use-case for this, then please | ||
| 893 | * contact the linux-media mailing list first. | ||
| 603 | */ | 894 | */ |
| 604 | int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, | 895 | int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, |
| 605 | const char *thread_name); | 896 | const char *thread_name); |
| @@ -717,7 +1008,26 @@ static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q) | |||
| 717 | * The following functions are not part of the vb2 core API, but are useful | 1008 | * The following functions are not part of the vb2 core API, but are useful |
| 718 | * functions for videobuf2-*. | 1009 | * functions for videobuf2-*. |
| 719 | */ | 1010 | */ |
| 1011 | |||
| 1012 | /** | ||
| 1013 | * vb2_buffer_in_use() - return true if the buffer is in use and | ||
| 1014 | * the queue cannot be freed (by the means of REQBUFS(0)) call | ||
| 1015 | * | ||
| 1016 | * @vb: buffer for which plane size should be returned | ||
| 1017 | * @q: videobuf queue | ||
| 1018 | */ | ||
| 720 | bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb); | 1019 | bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb); |
| 1020 | |||
| 1021 | /** | ||
| 1022 | * vb2_verify_memory_type() - Check whether the memory type and buffer type | ||
| 1023 | * passed to a buffer operation are compatible with the queue. | ||
| 1024 | * | ||
| 1025 | * @q: videobuf queue | ||
| 1026 | * @memory: memory model, as defined by enum &vb2_memory. | ||
| 1027 | * @type: private buffer type whose content is defined by the vb2-core | ||
| 1028 | * caller. For example, for V4L2, it should match | ||
| 1029 | * the types defined on enum &v4l2_buf_type | ||
| 1030 | */ | ||
| 721 | int vb2_verify_memory_type(struct vb2_queue *q, | 1031 | int vb2_verify_memory_type(struct vb2_queue *q, |
| 722 | enum vb2_memory memory, unsigned int type); | 1032 | enum vb2_memory memory, unsigned int type); |
| 723 | #endif /* _MEDIA_VIDEOBUF2_CORE_H */ | 1033 | #endif /* _MEDIA_VIDEOBUF2_CORE_H */ |
diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index 3cc836f76675..036127c54bbf 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h | |||
| @@ -25,11 +25,13 @@ | |||
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * struct vb2_v4l2_buffer - video buffer information for v4l2 | 27 | * struct vb2_v4l2_buffer - video buffer information for v4l2 |
| 28 | * | ||
| 28 | * @vb2_buf: video buffer 2 | 29 | * @vb2_buf: video buffer 2 |
| 29 | * @flags: buffer informational flags | 30 | * @flags: buffer informational flags |
| 30 | * @field: enum v4l2_field; field order of the image in the buffer | 31 | * @field: enum v4l2_field; field order of the image in the buffer |
| 31 | * @timecode: frame timecode | 32 | * @timecode: frame timecode |
| 32 | * @sequence: sequence count of this frame | 33 | * @sequence: sequence count of this frame |
| 34 | * | ||
| 33 | * Should contain enough information to be able to cover all the fields | 35 | * Should contain enough information to be able to cover all the fields |
| 34 | * of struct v4l2_buffer at videodev2.h | 36 | * of struct v4l2_buffer at videodev2.h |
| 35 | */ | 37 | */ |
| @@ -49,22 +51,183 @@ struct vb2_v4l2_buffer { | |||
| 49 | container_of(vb, struct vb2_v4l2_buffer, vb2_buf) | 51 | container_of(vb, struct vb2_v4l2_buffer, vb2_buf) |
| 50 | 52 | ||
| 51 | int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); | 53 | int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); |
| 54 | |||
| 55 | /** | ||
| 56 | * vb2_reqbufs() - Wrapper for vb2_core_reqbufs() that also verifies | ||
| 57 | * the memory and type values. | ||
| 58 | * | ||
| 59 | * @q: videobuf2 queue | ||
| 60 | * @req: struct passed from userspace to vidioc_reqbufs handler | ||
| 61 | * in driver | ||
| 62 | */ | ||
| 52 | int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); | 63 | int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); |
| 53 | 64 | ||
| 65 | /** | ||
| 66 | * vb2_create_bufs() - Wrapper for vb2_core_create_bufs() that also verifies | ||
| 67 | * the memory and type values. | ||
| 68 | * | ||
| 69 | * @q: videobuf2 queue | ||
| 70 | * @create: creation parameters, passed from userspace to vidioc_create_bufs | ||
| 71 | * handler in driver | ||
| 72 | */ | ||
| 54 | int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); | 73 | int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); |
| 74 | |||
| 75 | /** | ||
| 76 | * vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel | ||
| 77 | * | ||
| 78 | * @q: videobuf2 queue | ||
| 79 | * @b: buffer structure passed from userspace to vidioc_prepare_buf | ||
| 80 | * handler in driver | ||
| 81 | * | ||
| 82 | * Should be called from vidioc_prepare_buf ioctl handler of a driver. | ||
| 83 | * This function: | ||
| 84 | * | ||
| 85 | * #) verifies the passed buffer, | ||
| 86 | * #) calls buf_prepare callback in the driver (if provided), in which | ||
| 87 | * driver-specific buffer initialization can be performed. | ||
| 88 | * | ||
| 89 | * The return values from this function are intended to be directly returned | ||
| 90 | * from vidioc_prepare_buf handler in driver. | ||
| 91 | */ | ||
| 55 | int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); | 92 | int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); |
| 56 | 93 | ||
| 94 | /** | ||
| 95 | * vb2_qbuf() - Queue a buffer from userspace | ||
| 96 | * @q: videobuf2 queue | ||
| 97 | * @b: buffer structure passed from userspace to VIDIOC_QBUF() handler | ||
| 98 | * in driver | ||
| 99 | * | ||
| 100 | * Should be called from VIDIOC_QBUF() ioctl handler of a driver. | ||
| 101 | * | ||
| 102 | * This function: | ||
| 103 | * | ||
| 104 | * #) verifies the passed buffer, | ||
| 105 | * #) if necessary, calls buf_prepare callback in the driver (if provided), in | ||
| 106 | * which driver-specific buffer initialization can be performed, | ||
| 107 | * #) if streaming is on, queues the buffer in driver by the means of buf_queue | ||
| 108 | * callback for processing. | ||
| 109 | * | ||
| 110 | * The return values from this function are intended to be directly returned | ||
| 111 | * from VIDIOC_QBUF() handler in driver. | ||
| 112 | */ | ||
| 57 | int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); | 113 | int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); |
| 114 | |||
| 115 | /** | ||
| 116 | * vb2_expbuf() - Export a buffer as a file descriptor | ||
| 117 | * @q: videobuf2 queue | ||
| 118 | * @eb: export buffer structure passed from userspace to VIDIOC_EXPBUF() | ||
| 119 | * handler in driver | ||
| 120 | * | ||
| 121 | * The return values from this function are intended to be directly returned | ||
| 122 | * from VIDIOC_EXPBUF() handler in driver. | ||
| 123 | */ | ||
| 58 | int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); | 124 | int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); |
| 125 | |||
| 126 | /** | ||
| 127 | * vb2_dqbuf() - Dequeue a buffer to the userspace | ||
| 128 | * @q: videobuf2 queue | ||
| 129 | * @b: buffer structure passed from userspace to VIDIOC_DQBUF() handler | ||
| 130 | * in driver | ||
| 131 | * @nonblocking: if true, this call will not sleep waiting for a buffer if no | ||
| 132 | * buffers ready for dequeuing are present. Normally the driver | ||
| 133 | * would be passing (file->f_flags & O_NONBLOCK) here | ||
| 134 | * | ||
| 135 | * Should be called from VIDIOC_DQBUF() ioctl handler of a driver. | ||
| 136 | * | ||
| 137 | * This function: | ||
| 138 | * | ||
| 139 | * #) verifies the passed buffer, | ||
| 140 | * #) calls buf_finish callback in the driver (if provided), in which | ||
| 141 | * driver can perform any additional operations that may be required before | ||
| 142 | * returning the buffer to userspace, such as cache sync, | ||
| 143 | * #) the buffer struct members are filled with relevant information for | ||
| 144 | * the userspace. | ||
| 145 | * | ||
| 146 | * The return values from this function are intended to be directly returned | ||
| 147 | * from VIDIOC_DQBUF() handler in driver. | ||
| 148 | */ | ||
| 59 | int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); | 149 | int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); |
| 60 | 150 | ||
| 151 | /** | ||
| 152 | * vb2_streamon - start streaming | ||
| 153 | * @q: videobuf2 queue | ||
| 154 | * @type: type argument passed from userspace to vidioc_streamon handler | ||
| 155 | * | ||
| 156 | * Should be called from vidioc_streamon handler of a driver. | ||
| 157 | * | ||
| 158 | * This function: | ||
| 159 | * | ||
| 160 | * 1) verifies current state | ||
| 161 | * 2) passes any previously queued buffers to the driver and starts streaming | ||
| 162 | * | ||
| 163 | * The return values from this function are intended to be directly returned | ||
| 164 | * from vidioc_streamon handler in the driver. | ||
| 165 | */ | ||
| 61 | int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); | 166 | int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); |
| 167 | |||
| 168 | /** | ||
| 169 | * vb2_streamoff - stop streaming | ||
| 170 | * @q: videobuf2 queue | ||
| 171 | * @type: type argument passed from userspace to vidioc_streamoff handler | ||
| 172 | * | ||
| 173 | * Should be called from vidioc_streamoff handler of a driver. | ||
| 174 | * | ||
| 175 | * This function: | ||
| 176 | * | ||
| 177 | * #) verifies current state, | ||
| 178 | * #) stop streaming and dequeues any queued buffers, including those previously | ||
| 179 | * passed to the driver (after waiting for the driver to finish). | ||
| 180 | * | ||
| 181 | * This call can be used for pausing playback. | ||
| 182 | * The return values from this function are intended to be directly returned | ||
| 183 | * from vidioc_streamoff handler in the driver | ||
| 184 | */ | ||
| 62 | int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); | 185 | int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); |
| 63 | 186 | ||
| 187 | /** | ||
| 188 | * vb2_queue_init() - initialize a videobuf2 queue | ||
| 189 | * @q: videobuf2 queue; this structure should be allocated in driver | ||
| 190 | * | ||
| 191 | * The vb2_queue structure should be allocated by the driver. The driver is | ||
| 192 | * responsible of clearing it's content and setting initial values for some | ||
| 193 | * required entries before calling this function. | ||
| 194 | * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer | ||
| 195 | * to the struct vb2_queue description in include/media/videobuf2-core.h | ||
| 196 | * for more information. | ||
| 197 | */ | ||
| 64 | int __must_check vb2_queue_init(struct vb2_queue *q); | 198 | int __must_check vb2_queue_init(struct vb2_queue *q); |
| 199 | |||
| 200 | /** | ||
| 201 | * vb2_queue_release() - stop streaming, release the queue and free memory | ||
| 202 | * @q: videobuf2 queue | ||
| 203 | * | ||
| 204 | * This function stops streaming and performs necessary clean ups, including | ||
| 205 | * freeing video buffer memory. The driver is responsible for freeing | ||
| 206 | * the vb2_queue structure itself. | ||
| 207 | */ | ||
| 65 | void vb2_queue_release(struct vb2_queue *q); | 208 | void vb2_queue_release(struct vb2_queue *q); |
| 209 | |||
| 210 | /** | ||
| 211 | * vb2_poll() - implements poll userspace operation | ||
| 212 | * @q: videobuf2 queue | ||
| 213 | * @file: file argument passed to the poll file operation handler | ||
| 214 | * @wait: wait argument passed to the poll file operation handler | ||
| 215 | * | ||
| 216 | * This function implements poll file operation handler for a driver. | ||
| 217 | * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will | ||
| 218 | * be informed that the file descriptor of a video device is available for | ||
| 219 | * reading. | ||
| 220 | * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor | ||
| 221 | * will be reported as available for writing. | ||
| 222 | * | ||
| 223 | * If the driver uses struct v4l2_fh, then vb2_poll() will also check for any | ||
| 224 | * pending events. | ||
| 225 | * | ||
| 226 | * The return values from this function are intended to be directly returned | ||
| 227 | * from poll handler in driver. | ||
| 228 | */ | ||
| 66 | unsigned int vb2_poll(struct vb2_queue *q, struct file *file, | 229 | unsigned int vb2_poll(struct vb2_queue *q, struct file *file, |
| 67 | poll_table *wait); | 230 | poll_table *wait); |
| 68 | 231 | ||
| 69 | /* | 232 | /* |
| 70 | * The following functions are not part of the vb2 core API, but are simple | 233 | * The following functions are not part of the vb2 core API, but are simple |
| @@ -105,9 +268,22 @@ unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr, | |||
| 105 | unsigned long len, unsigned long pgoff, unsigned long flags); | 268 | unsigned long len, unsigned long pgoff, unsigned long flags); |
| 106 | #endif | 269 | #endif |
| 107 | 270 | ||
| 108 | /* struct vb2_ops helpers, only use if vq->lock is non-NULL. */ | 271 | /** |
| 109 | 272 | * vb2_ops_wait_prepare - helper function to lock a struct &vb2_queue | |
| 273 | * | ||
| 274 | * @vq: pointer to struct vb2_queue | ||
| 275 | * | ||
| 276 | * ..note:: only use if vq->lock is non-NULL. | ||
| 277 | */ | ||
| 110 | void vb2_ops_wait_prepare(struct vb2_queue *vq); | 278 | void vb2_ops_wait_prepare(struct vb2_queue *vq); |
| 279 | |||
| 280 | /** | ||
| 281 | * vb2_ops_wait_finish - helper function to unlock a struct &vb2_queue | ||
| 282 | * | ||
| 283 | * @vq: pointer to struct vb2_queue | ||
| 284 | * | ||
| 285 | * ..note:: only use if vq->lock is non-NULL. | ||
| 286 | */ | ||
| 111 | void vb2_ops_wait_finish(struct vb2_queue *vq); | 287 | void vb2_ops_wait_finish(struct vb2_queue *vq); |
| 112 | 288 | ||
| 113 | #endif /* _MEDIA_VIDEOBUF2_V4L2_H */ | 289 | #endif /* _MEDIA_VIDEOBUF2_V4L2_H */ |
diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 9322d9775fb7..458b400373d4 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h | |||
| @@ -26,7 +26,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, | |||
| 26 | struct vsp1_du_atomic_config { | 26 | struct vsp1_du_atomic_config { |
| 27 | u32 pixelformat; | 27 | u32 pixelformat; |
| 28 | unsigned int pitch; | 28 | unsigned int pitch; |
| 29 | dma_addr_t mem[2]; | 29 | dma_addr_t mem[3]; |
| 30 | struct v4l2_rect src; | 30 | struct v4l2_rect src; |
| 31 | struct v4l2_rect dst; | 31 | struct v4l2_rect dst; |
| 32 | unsigned int alpha; | 32 | unsigned int alpha; |
diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h index 49392564f9d6..260f033a5b54 100644 --- a/include/uapi/linux/dvb/video.h +++ b/include/uapi/linux/dvb/video.h | |||
| @@ -206,7 +206,8 @@ typedef __u16 video_attributes_t; | |||
| 206 | /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ | 206 | /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ |
| 207 | /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ | 207 | /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ |
| 208 | /* 2 source letterboxed (1=yes, 0=no) */ | 208 | /* 2 source letterboxed (1=yes, 0=no) */ |
| 209 | /* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ | 209 | /* 0 film/camera mode (0= |
| 210 | *camera, 1=film (625/50 only)) */ | ||
| 210 | 211 | ||
| 211 | 212 | ||
| 212 | /* bit definitions for capabilities: */ | 213 | /* bit definitions for capabilities: */ |
diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index 190d491d5b13..2168759c1287 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h | |||
| @@ -97,7 +97,7 @@ | |||
| 97 | #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 | 97 | #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 |
| 98 | #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 | 98 | #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 |
| 99 | 99 | ||
| 100 | /* Bayer - next is 0x3019 */ | 100 | /* Bayer - next is 0x3021 */ |
| 101 | #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 | 101 | #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 |
| 102 | #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 | 102 | #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 |
| 103 | #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 | 103 | #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 |
| @@ -122,6 +122,14 @@ | |||
| 122 | #define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 | 122 | #define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 |
| 123 | #define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 | 123 | #define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 |
| 124 | #define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 | 124 | #define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 |
| 125 | #define MEDIA_BUS_FMT_SBGGR14_1X14 0x3019 | ||
| 126 | #define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a | ||
| 127 | #define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b | ||
| 128 | #define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c | ||
| 129 | #define MEDIA_BUS_FMT_SBGGR16_1X16 0x301d | ||
| 130 | #define MEDIA_BUS_FMT_SGBRG16_1X16 0x301e | ||
| 131 | #define MEDIA_BUS_FMT_SGRBG16_1X16 0x301f | ||
| 132 | #define MEDIA_BUS_FMT_SRGGB16_1X16 0x3020 | ||
| 125 | 133 | ||
| 126 | /* JPEG compressed formats - next is 0x4002 */ | 134 | /* JPEG compressed formats - next is 0x4002 */ |
| 127 | #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 | 135 | #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 |
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 7acf0f634f70..4890787731b8 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h | |||
| @@ -307,6 +307,7 @@ struct media_links_enum { | |||
| 307 | #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) | 307 | #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) |
| 308 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) | 308 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) |
| 309 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) | 309 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) |
| 310 | #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) | ||
| 310 | 311 | ||
| 311 | #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) | 312 | #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) |
| 312 | #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) | 313 | #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) |
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index 086168e18ca8..f31957166337 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h | |||
| @@ -934,4 +934,16 @@ | |||
| 934 | V4L2_DV_FL_REDUCED_BLANKING) \ | 934 | V4L2_DV_FL_REDUCED_BLANKING) \ |
| 935 | } | 935 | } |
| 936 | 936 | ||
| 937 | /* SDI timings definitions */ | ||
| 938 | |||
| 939 | /* SMPTE-125M */ | ||
| 940 | #define V4L2_DV_BT_SDI_720X487I60 { \ | ||
| 941 | .type = V4L2_DV_BT_656_1120, \ | ||
| 942 | V4L2_INIT_BT_TIMINGS(720, 487, 1, \ | ||
| 943 | V4L2_DV_HSYNC_POS_POL, \ | ||
| 944 | 13500000, 16, 121, 0, 0, 19, 0, 0, 19, 0, \ | ||
| 945 | V4L2_DV_BT_STD_SDI, \ | ||
| 946 | V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \ | ||
| 947 | } | ||
| 948 | |||
| 937 | #endif | 949 | #endif |
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 724f43e69d03..94f123f3e04e 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h | |||
| @@ -292,13 +292,11 @@ enum v4l2_ycbcr_encoding { | |||
| 292 | * various colorspaces: | 292 | * various colorspaces: |
| 293 | * | 293 | * |
| 294 | * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, | 294 | * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, |
| 295 | * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and | 295 | * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_SRGB, |
| 296 | * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 | 296 | * V4L2_COLORSPACE_ADOBERGB and V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 |
| 297 | * | 297 | * |
| 298 | * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709 | 298 | * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709 |
| 299 | * | 299 | * |
| 300 | * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC | ||
| 301 | * | ||
| 302 | * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020 | 300 | * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020 |
| 303 | * | 301 | * |
| 304 | * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M | 302 | * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M |
| @@ -317,8 +315,14 @@ enum v4l2_ycbcr_encoding { | |||
| 317 | /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */ | 315 | /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */ |
| 318 | V4L2_YCBCR_ENC_XV709 = 4, | 316 | V4L2_YCBCR_ENC_XV709 = 4, |
| 319 | 317 | ||
| 320 | /* sYCC (Y'CbCr encoding of sRGB) */ | 318 | #ifndef __KERNEL__ |
| 319 | /* | ||
| 320 | * sYCC (Y'CbCr encoding of sRGB), identical to ENC_601. It was added | ||
| 321 | * originally due to a misunderstanding of the sYCC standard. It should | ||
| 322 | * not be used, instead use V4L2_YCBCR_ENC_601. | ||
| 323 | */ | ||
| 321 | V4L2_YCBCR_ENC_SYCC = 5, | 324 | V4L2_YCBCR_ENC_SYCC = 5, |
| 325 | #endif | ||
| 322 | 326 | ||
| 323 | /* BT.2020 Non-constant Luminance Y'CbCr */ | 327 | /* BT.2020 Non-constant Luminance Y'CbCr */ |
| 324 | V4L2_YCBCR_ENC_BT2020 = 6, | 328 | V4L2_YCBCR_ENC_BT2020 = 6, |
| @@ -345,8 +349,8 @@ enum v4l2_quantization { | |||
| 345 | /* | 349 | /* |
| 346 | * The default for R'G'B' quantization is always full range, except | 350 | * The default for R'G'B' quantization is always full range, except |
| 347 | * for the BT2020 colorspace. For Y'CbCr the quantization is always | 351 | * for the BT2020 colorspace. For Y'CbCr the quantization is always |
| 348 | * limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709: | 352 | * limited range, except for COLORSPACE_JPEG, SRGB, ADOBERGB, |
| 349 | * those are full range. | 353 | * XV601 or XV709: those are full range. |
| 350 | */ | 354 | */ |
| 351 | V4L2_QUANTIZATION_DEFAULT = 0, | 355 | V4L2_QUANTIZATION_DEFAULT = 0, |
| 352 | V4L2_QUANTIZATION_FULL_RANGE = 1, | 356 | V4L2_QUANTIZATION_FULL_RANGE = 1, |
| @@ -361,7 +365,8 @@ enum v4l2_quantization { | |||
| 361 | #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ | 365 | #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ |
| 362 | (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ | 366 | (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ |
| 363 | (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | 367 | (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ |
| 364 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \ | 368 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ |
| 369 | (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ | ||
| 365 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) | 370 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) |
| 366 | 371 | ||
| 367 | enum v4l2_priority { | 372 | enum v4l2_priority { |
| @@ -440,6 +445,8 @@ struct v4l2_capability { | |||
| 440 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ | 445 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |
| 441 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ | 446 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ |
| 442 | 447 | ||
| 448 | #define V4L2_CAP_TOUCH 0x10000000 /* Is a touch device */ | ||
| 449 | |||
| 443 | #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ | 450 | #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ |
| 444 | 451 | ||
| 445 | /* | 452 | /* |
| @@ -635,6 +642,12 @@ struct v4l2_pix_format { | |||
| 635 | #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ | 642 | #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ |
| 636 | #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ | 643 | #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ |
| 637 | 644 | ||
| 645 | /* Touch formats - used for Touch devices */ | ||
| 646 | #define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ | ||
| 647 | #define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */ | ||
| 648 | #define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */ | ||
| 649 | #define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */ | ||
| 650 | |||
| 638 | /* priv field value to indicates that subsequent fields are valid. */ | 651 | /* priv field value to indicates that subsequent fields are valid. */ |
| 639 | #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe | 652 | #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe |
| 640 | 653 | ||
| @@ -1261,6 +1274,7 @@ struct v4l2_bt_timings { | |||
| 1261 | #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */ | 1274 | #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */ |
| 1262 | #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */ | 1275 | #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */ |
| 1263 | #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */ | 1276 | #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */ |
| 1277 | #define V4L2_DV_BT_STD_SDI (1 << 4) /* SDI Timings */ | ||
| 1264 | 1278 | ||
| 1265 | /* Flags */ | 1279 | /* Flags */ |
| 1266 | 1280 | ||
| @@ -1292,6 +1306,11 @@ struct v4l2_bt_timings { | |||
| 1292 | * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861 | 1306 | * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861 |
| 1293 | * except for the 640x480 format are CE formats. */ | 1307 | * except for the 640x480 format are CE formats. */ |
| 1294 | #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4) | 1308 | #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4) |
| 1309 | /* Some formats like SMPTE-125M have an interlaced signal with a odd | ||
| 1310 | * total height. For these formats, if this flag is set, the first | ||
| 1311 | * field has the extra line. If not, it is the second field. | ||
| 1312 | */ | ||
| 1313 | #define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE (1 << 5) | ||
| 1295 | 1314 | ||
| 1296 | /* A few useful defines to calculate the total blanking and frame sizes */ | 1315 | /* A few useful defines to calculate the total blanking and frame sizes */ |
| 1297 | #define V4L2_DV_BT_BLANKING_WIDTH(bt) \ | 1316 | #define V4L2_DV_BT_BLANKING_WIDTH(bt) \ |
| @@ -1401,6 +1420,7 @@ struct v4l2_input { | |||
| 1401 | /* Values for the 'type' field */ | 1420 | /* Values for the 'type' field */ |
| 1402 | #define V4L2_INPUT_TYPE_TUNER 1 | 1421 | #define V4L2_INPUT_TYPE_TUNER 1 |
| 1403 | #define V4L2_INPUT_TYPE_CAMERA 2 | 1422 | #define V4L2_INPUT_TYPE_CAMERA 2 |
| 1423 | #define V4L2_INPUT_TYPE_TOUCH 3 | ||
| 1404 | 1424 | ||
| 1405 | /* field 'status' - general */ | 1425 | /* field 'status' - general */ |
| 1406 | #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ | 1426 | #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ |
| @@ -1415,6 +1435,8 @@ struct v4l2_input { | |||
| 1415 | /* field 'status' - analog */ | 1435 | /* field 'status' - analog */ |
| 1416 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ | 1436 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ |
| 1417 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ | 1437 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ |
| 1438 | #define V4L2_IN_ST_NO_V_LOCK 0x00000400 /* No vertical sync lock */ | ||
| 1439 | #define V4L2_IN_ST_NO_STD_LOCK 0x00000800 /* No standard format lock */ | ||
| 1418 | 1440 | ||
| 1419 | /* field 'status' - digital */ | 1441 | /* field 'status' - digital */ |
| 1420 | #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ | 1442 | #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ |
