Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 1 | #ifndef _USB_VIDEO_H_ |
| 2 | #define _USB_VIDEO_H_ |
| 3 | |
Laurent Pinchart | 227bd5b | 2011-07-30 16:19:49 -0300 | [diff] [blame] | 4 | #ifndef __KERNEL__ |
| 5 | #error "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead." |
| 6 | #endif /* __KERNEL__ */ |
| 7 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 8 | #include <linux/kernel.h> |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 9 | #include <linux/poll.h> |
Laurent Pinchart | 4ffc2d8 | 2010-01-21 05:39:52 -0300 | [diff] [blame] | 10 | #include <linux/usb.h> |
Laurent Pinchart | de05f63 | 2009-06-26 12:15:38 -0300 | [diff] [blame] | 11 | #include <linux/usb/video.h> |
Laurent Pinchart | 5f70881 | 2010-11-21 17:15:44 -0300 | [diff] [blame] | 12 | #include <linux/uvcvideo.h> |
Laurent Pinchart | 227bd5b | 2011-07-30 16:19:49 -0300 | [diff] [blame] | 13 | #include <linux/videodev2.h> |
Laurent Pinchart | 5a254d7 | 2010-01-21 05:39:47 -0300 | [diff] [blame] | 14 | #include <media/media-device.h> |
| 15 | #include <media/v4l2-device.h> |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 16 | #include <media/videobuf2-core.h> |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 17 | |
| 18 | /* -------------------------------------------------------------------------- |
| 19 | * UVC constants |
| 20 | */ |
| 21 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 22 | #define UVC_TERM_INPUT 0x0000 |
| 23 | #define UVC_TERM_OUTPUT 0x8000 |
Laurent Pinchart | 6241d8c | 2009-11-25 12:00:22 -0300 | [diff] [blame] | 24 | #define UVC_TERM_DIRECTION(term) ((term)->type & 0x8000) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 25 | |
| 26 | #define UVC_ENTITY_TYPE(entity) ((entity)->type & 0x7fff) |
| 27 | #define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0) |
| 28 | #define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0) |
| 29 | #define UVC_ENTITY_IS_ITERM(entity) \ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 30 | (UVC_ENTITY_IS_TERM(entity) && \ |
| 31 | ((entity)->type & 0x8000) == UVC_TERM_INPUT) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 32 | #define UVC_ENTITY_IS_OTERM(entity) \ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 33 | (UVC_ENTITY_IS_TERM(entity) && \ |
| 34 | ((entity)->type & 0x8000) == UVC_TERM_OUTPUT) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 35 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 36 | |
| 37 | /* ------------------------------------------------------------------------ |
| 38 | * GUIDs |
| 39 | */ |
| 40 | #define UVC_GUID_UVC_CAMERA \ |
| 41 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
| 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} |
| 43 | #define UVC_GUID_UVC_OUTPUT \ |
| 44 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
| 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02} |
| 46 | #define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \ |
| 47 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
| 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03} |
| 49 | #define UVC_GUID_UVC_PROCESSING \ |
| 50 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
| 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01} |
| 52 | #define UVC_GUID_UVC_SELECTOR \ |
| 53 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
| 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02} |
| 55 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 56 | #define UVC_GUID_FORMAT_MJPEG \ |
| 57 | { 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \ |
| 58 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 59 | #define UVC_GUID_FORMAT_YUY2 \ |
| 60 | { 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \ |
| 61 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Daniel Ritz | 68f194e | 2009-12-12 14:57:17 -0300 | [diff] [blame] | 62 | #define UVC_GUID_FORMAT_YUY2_ISIGHT \ |
| 63 | { 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \ |
| 64 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71} |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 65 | #define UVC_GUID_FORMAT_NV12 \ |
| 66 | { 'N', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \ |
| 67 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 68 | #define UVC_GUID_FORMAT_YV12 \ |
| 69 | { 'Y', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \ |
| 70 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 71 | #define UVC_GUID_FORMAT_I420 \ |
| 72 | { 'I', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \ |
| 73 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 74 | #define UVC_GUID_FORMAT_UYVY \ |
| 75 | { 'U', 'Y', 'V', 'Y', 0x00, 0x00, 0x10, 0x00, \ |
| 76 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 77 | #define UVC_GUID_FORMAT_Y800 \ |
| 78 | { 'Y', '8', '0', '0', 0x00, 0x00, 0x10, 0x00, \ |
| 79 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Laurent Pinchart | 61421206 | 2010-04-12 10:41:22 -0300 | [diff] [blame] | 80 | #define UVC_GUID_FORMAT_Y16 \ |
| 81 | { 'Y', '1', '6', ' ', 0x00, 0x00, 0x10, 0x00, \ |
| 82 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 83 | #define UVC_GUID_FORMAT_BY8 \ |
| 84 | { 'B', 'Y', '8', ' ', 0x00, 0x00, 0x10, 0x00, \ |
| 85 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Laurent Pinchart | 5079107 | 2011-03-06 08:32:04 -0300 | [diff] [blame] | 86 | #define UVC_GUID_FORMAT_RGBP \ |
| 87 | { 'R', 'G', 'B', 'P', 0x00, 0x00, 0x10, 0x00, \ |
| 88 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Hans de Goede | 7225a1d | 2011-05-11 09:56:20 -0300 | [diff] [blame] | 89 | #define UVC_GUID_FORMAT_M420 \ |
| 90 | { 'M', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \ |
| 91 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 92 | |
Stephan Lachowsky | 25ad8a8 | 2011-01-28 16:38:58 -0300 | [diff] [blame] | 93 | #define UVC_GUID_FORMAT_H264 \ |
| 94 | { 'H', '2', '6', '4', 0x00, 0x00, 0x10, 0x00, \ |
| 95 | 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} |
| 96 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 97 | /* ------------------------------------------------------------------------ |
| 98 | * Driver specific constants. |
| 99 | */ |
| 100 | |
Mauro Carvalho Chehab | fd3e582 | 2011-06-25 13:50:37 -0300 | [diff] [blame] | 101 | #define DRIVER_VERSION "1.1.1" |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 102 | |
| 103 | /* Number of isochronous URBs. */ |
| 104 | #define UVC_URBS 5 |
Laurent Pinchart | efdc8a9 | 2009-01-18 17:46:30 -0300 | [diff] [blame] | 105 | /* Maximum number of packets per URB. */ |
| 106 | #define UVC_MAX_PACKETS 32 |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 107 | /* Maximum number of video buffers. */ |
| 108 | #define UVC_MAX_VIDEO_BUFFERS 32 |
Ming Lei | a31a405 | 2008-09-16 03:32:20 -0300 | [diff] [blame] | 109 | /* Maximum status buffer size in bytes of interrupt URB. */ |
| 110 | #define UVC_MAX_STATUS_SIZE 16 |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 111 | |
| 112 | #define UVC_CTRL_CONTROL_TIMEOUT 300 |
Laurent Pinchart | 56d15cd | 2010-01-19 08:59:21 -0300 | [diff] [blame] | 113 | #define UVC_CTRL_STREAMING_TIMEOUT 5000 |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 114 | |
Martin Rubli | 8fb91b3 | 2010-09-08 04:15:23 -0300 | [diff] [blame] | 115 | /* Maximum allowed number of control mappings per device */ |
| 116 | #define UVC_MAX_CONTROL_MAPPINGS 1024 |
| 117 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 118 | /* Devices quirks */ |
| 119 | #define UVC_QUIRK_STATUS_INTERVAL 0x00000001 |
| 120 | #define UVC_QUIRK_PROBE_MINMAX 0x00000002 |
| 121 | #define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004 |
| 122 | #define UVC_QUIRK_BUILTIN_ISIGHT 0x00000008 |
| 123 | #define UVC_QUIRK_STREAM_NO_FID 0x00000010 |
| 124 | #define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 |
Laurent Pinchart | 50144ae | 2009-02-16 17:41:52 -0300 | [diff] [blame] | 125 | #define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 |
Laurent Pinchart | bab6f66 | 2009-07-19 18:39:56 -0300 | [diff] [blame] | 126 | #define UVC_QUIRK_PROBE_DEF 0x00000100 |
Laurent Pinchart | 86d8b6a | 2010-09-16 12:37:26 -0300 | [diff] [blame] | 127 | #define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200 |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 128 | |
| 129 | /* Format flags */ |
| 130 | #define UVC_FMT_FLAG_COMPRESSED 0x00000001 |
| 131 | #define UVC_FMT_FLAG_STREAM 0x00000002 |
| 132 | |
| 133 | /* ------------------------------------------------------------------------ |
| 134 | * Structures. |
| 135 | */ |
| 136 | |
| 137 | struct uvc_device; |
| 138 | |
| 139 | /* TODO: Put the most frequently accessed fields at the beginning of |
| 140 | * structures to maximize cache efficiency. |
| 141 | */ |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 142 | struct uvc_control_info { |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 143 | struct list_head mappings; |
| 144 | |
| 145 | __u8 entity[16]; |
Laurent Pinchart | ba2fa99 | 2010-09-20 05:53:21 -0300 | [diff] [blame] | 146 | __u8 index; /* Bit index in bmControls */ |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 147 | __u8 selector; |
| 148 | |
| 149 | __u16 size; |
| 150 | __u32 flags; |
| 151 | }; |
| 152 | |
| 153 | struct uvc_control_mapping { |
| 154 | struct list_head list; |
| 155 | |
| 156 | struct uvc_control_info *ctrl; |
| 157 | |
| 158 | __u32 id; |
| 159 | __u8 name[32]; |
| 160 | __u8 entity[16]; |
| 161 | __u8 selector; |
| 162 | |
| 163 | __u8 size; |
| 164 | __u8 offset; |
| 165 | enum v4l2_ctrl_type v4l2_type; |
| 166 | __u32 data_type; |
| 167 | |
| 168 | struct uvc_menu_info *menu_info; |
| 169 | __u32 menu_count; |
Laurent Pinchart | 9768352 | 2008-12-16 06:46:32 -0300 | [diff] [blame] | 170 | |
| 171 | __s32 (*get) (struct uvc_control_mapping *mapping, __u8 query, |
| 172 | const __u8 *data); |
| 173 | void (*set) (struct uvc_control_mapping *mapping, __s32 value, |
| 174 | __u8 *data); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 175 | }; |
| 176 | |
| 177 | struct uvc_control { |
| 178 | struct uvc_entity *entity; |
Laurent Pinchart | 071c8bb | 2010-09-29 16:00:08 -0300 | [diff] [blame] | 179 | struct uvc_control_info info; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 180 | |
| 181 | __u8 index; /* Used to match the uvc_control entry with a |
| 182 | uvc_control_info. */ |
Laurent Pinchart | 071c8bb | 2010-09-29 16:00:08 -0300 | [diff] [blame] | 183 | __u8 dirty:1, |
| 184 | loaded:1, |
| 185 | modified:1, |
| 186 | cached:1, |
| 187 | initialized:1; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 188 | |
Laurent Pinchart | b30ece5 | 2010-06-18 11:31:24 -0300 | [diff] [blame] | 189 | __u8 *uvc_data; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | struct uvc_format_desc { |
| 193 | char *name; |
| 194 | __u8 guid[16]; |
| 195 | __u32 fcc; |
| 196 | }; |
| 197 | |
| 198 | /* The term 'entity' refers to both UVC units and UVC terminals. |
| 199 | * |
| 200 | * The type field is either the terminal type (wTerminalType in the terminal |
| 201 | * descriptor), or the unit type (bDescriptorSubtype in the unit descriptor). |
| 202 | * As the bDescriptorSubtype field is one byte long, the type value will |
| 203 | * always have a null MSB for units. All terminal types defined by the UVC |
| 204 | * specification have a non-null MSB, so it is safe to use the MSB to |
| 205 | * differentiate between units and terminals as long as the descriptor parsing |
| 206 | * code makes sure terminal types have a non-null MSB. |
| 207 | * |
| 208 | * For terminals, the type's most significant bit stores the terminal |
| 209 | * direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should |
| 210 | * always be accessed with the UVC_ENTITY_* macros and never directly. |
| 211 | */ |
| 212 | |
| 213 | struct uvc_entity { |
| 214 | struct list_head list; /* Entity as part of a UVC device. */ |
| 215 | struct list_head chain; /* Entity as part of a video device |
| 216 | * chain. */ |
| 217 | __u8 id; |
| 218 | __u16 type; |
| 219 | char name[64]; |
| 220 | |
Laurent Pinchart | 4ffc2d8 | 2010-01-21 05:39:52 -0300 | [diff] [blame] | 221 | /* Media controller-related fields. */ |
Laurent Pinchart | 8a65a94 | 2010-01-21 08:56:19 -0300 | [diff] [blame] | 222 | struct video_device *vdev; |
Laurent Pinchart | 4ffc2d8 | 2010-01-21 05:39:52 -0300 | [diff] [blame] | 223 | struct v4l2_subdev subdev; |
| 224 | unsigned int num_pads; |
| 225 | unsigned int num_links; |
| 226 | struct media_pad *pads; |
| 227 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 228 | union { |
| 229 | struct { |
| 230 | __u16 wObjectiveFocalLengthMin; |
| 231 | __u16 wObjectiveFocalLengthMax; |
| 232 | __u16 wOcularFocalLength; |
| 233 | __u8 bControlSize; |
| 234 | __u8 *bmControls; |
| 235 | } camera; |
| 236 | |
| 237 | struct { |
| 238 | __u8 bControlSize; |
| 239 | __u8 *bmControls; |
| 240 | __u8 bTransportModeSize; |
| 241 | __u8 *bmTransportModes; |
| 242 | } media; |
| 243 | |
| 244 | struct { |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 245 | } output; |
| 246 | |
| 247 | struct { |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 248 | __u16 wMaxMultiplier; |
| 249 | __u8 bControlSize; |
| 250 | __u8 *bmControls; |
| 251 | __u8 bmVideoStandards; |
| 252 | } processing; |
| 253 | |
| 254 | struct { |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 255 | } selector; |
| 256 | |
| 257 | struct { |
| 258 | __u8 guidExtensionCode[16]; |
| 259 | __u8 bNumControls; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 260 | __u8 bControlSize; |
| 261 | __u8 *bmControls; |
| 262 | __u8 *bmControlsType; |
| 263 | } extension; |
| 264 | }; |
| 265 | |
Laurent Pinchart | 8ca5a63 | 2009-11-25 12:00:30 -0300 | [diff] [blame] | 266 | __u8 bNrInPins; |
| 267 | __u8 *baSourceID; |
| 268 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 269 | unsigned int ncontrols; |
| 270 | struct uvc_control *controls; |
| 271 | }; |
| 272 | |
| 273 | struct uvc_frame { |
| 274 | __u8 bFrameIndex; |
| 275 | __u8 bmCapabilities; |
| 276 | __u16 wWidth; |
| 277 | __u16 wHeight; |
| 278 | __u32 dwMinBitRate; |
| 279 | __u32 dwMaxBitRate; |
| 280 | __u32 dwMaxVideoFrameBufferSize; |
| 281 | __u8 bFrameIntervalType; |
| 282 | __u32 dwDefaultFrameInterval; |
| 283 | __u32 *dwFrameInterval; |
| 284 | }; |
| 285 | |
| 286 | struct uvc_format { |
| 287 | __u8 type; |
| 288 | __u8 index; |
| 289 | __u8 bpp; |
| 290 | __u8 colorspace; |
| 291 | __u32 fcc; |
| 292 | __u32 flags; |
| 293 | |
| 294 | char name[32]; |
| 295 | |
| 296 | unsigned int nframes; |
| 297 | struct uvc_frame *frame; |
| 298 | }; |
| 299 | |
| 300 | struct uvc_streaming_header { |
| 301 | __u8 bNumFormats; |
| 302 | __u8 bEndpointAddress; |
| 303 | __u8 bTerminalLink; |
| 304 | __u8 bControlSize; |
| 305 | __u8 *bmaControls; |
| 306 | /* The following fields are used by input headers only. */ |
| 307 | __u8 bmInfo; |
| 308 | __u8 bStillCaptureMethod; |
| 309 | __u8 bTriggerSupport; |
| 310 | __u8 bTriggerUsage; |
| 311 | }; |
| 312 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 313 | enum uvc_buffer_state { |
Laurent Pinchart | 2c2d264 | 2009-01-03 19:12:40 -0300 | [diff] [blame] | 314 | UVC_BUF_STATE_IDLE = 0, |
| 315 | UVC_BUF_STATE_QUEUED = 1, |
| 316 | UVC_BUF_STATE_ACTIVE = 2, |
Laurent Pinchart | d7c0d43 | 2009-12-16 21:20:45 -0300 | [diff] [blame] | 317 | UVC_BUF_STATE_READY = 3, |
| 318 | UVC_BUF_STATE_DONE = 4, |
| 319 | UVC_BUF_STATE_ERROR = 5, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 320 | }; |
| 321 | |
| 322 | struct uvc_buffer { |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 323 | struct vb2_buffer buf; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 324 | struct list_head queue; |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 325 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 326 | enum uvc_buffer_state state; |
Laurent Pinchart | 9bde9f2 | 2010-06-17 06:52:37 -0300 | [diff] [blame] | 327 | unsigned int error; |
Laurent Pinchart | 3d95e93 | 2011-10-24 11:49:19 -0300 | [diff] [blame] | 328 | |
| 329 | void *mem; |
| 330 | unsigned int length; |
| 331 | unsigned int bytesused; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 332 | }; |
| 333 | |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 334 | #define UVC_QUEUE_DISCONNECTED (1 << 0) |
| 335 | #define UVC_QUEUE_DROP_CORRUPTED (1 << 1) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 336 | |
| 337 | struct uvc_video_queue { |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 338 | struct vb2_queue queue; |
| 339 | struct mutex mutex; /* Protects queue */ |
Laurent Pinchart | ff92420 | 2008-12-28 22:32:29 -0300 | [diff] [blame] | 340 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 341 | unsigned int flags; |
Laurent Pinchart | ff92420 | 2008-12-28 22:32:29 -0300 | [diff] [blame] | 342 | unsigned int buf_used; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 343 | |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 344 | spinlock_t irqlock; /* Protects irqqueue */ |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 345 | struct list_head irqqueue; |
| 346 | }; |
| 347 | |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 348 | struct uvc_video_chain { |
| 349 | struct uvc_device *dev; |
| 350 | struct list_head list; |
| 351 | |
Laurent Pinchart | 6241d8c | 2009-11-25 12:00:22 -0300 | [diff] [blame] | 352 | struct list_head entities; /* All entities */ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 353 | struct uvc_entity *processing; /* Processing unit */ |
| 354 | struct uvc_entity *selector; /* Selector unit */ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 355 | |
Laurent Pinchart | 27a61c1 | 2010-10-02 09:04:53 -0300 | [diff] [blame] | 356 | struct mutex ctrl_mutex; /* Protects ctrl.info */ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 357 | }; |
| 358 | |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 359 | struct uvc_streaming { |
| 360 | struct list_head list; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 361 | struct uvc_device *dev; |
| 362 | struct video_device *vdev; |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 363 | struct uvc_video_chain *chain; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 364 | atomic_t active; |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 365 | |
| 366 | struct usb_interface *intf; |
| 367 | int intfnum; |
| 368 | __u16 maxpsize; |
| 369 | |
| 370 | struct uvc_streaming_header header; |
| 371 | enum v4l2_buf_type type; |
| 372 | |
| 373 | unsigned int nformats; |
| 374 | struct uvc_format *format; |
| 375 | |
| 376 | struct uvc_streaming_control ctrl; |
| 377 | struct uvc_format *cur_format; |
| 378 | struct uvc_frame *cur_frame; |
Laurent Pinchart | 6947756 | 2010-11-21 13:36:34 -0300 | [diff] [blame] | 379 | /* Protect access to ctrl, cur_format, cur_frame and hardware video |
| 380 | * probe control. |
| 381 | */ |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 382 | struct mutex mutex; |
| 383 | |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 384 | /* Buffers queue. */ |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 385 | unsigned int frozen : 1; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 386 | struct uvc_video_queue queue; |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 387 | void (*decode) (struct urb *urb, struct uvc_streaming *video, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 388 | struct uvc_buffer *buf); |
| 389 | |
| 390 | /* Context data used by the bulk completion handler. */ |
| 391 | struct { |
| 392 | __u8 header[256]; |
| 393 | unsigned int header_size; |
| 394 | int skip_payload; |
| 395 | __u32 payload_size; |
| 396 | __u32 max_payload_size; |
| 397 | } bulk; |
| 398 | |
| 399 | struct urb *urb[UVC_URBS]; |
| 400 | char *urb_buffer[UVC_URBS]; |
Laurent Pinchart | e01117c | 2008-07-04 00:36:21 -0300 | [diff] [blame] | 401 | dma_addr_t urb_dma[UVC_URBS]; |
| 402 | unsigned int urb_size; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 403 | |
Laurent Pinchart | 650b95f | 2010-10-02 11:06:05 -0300 | [diff] [blame] | 404 | __u32 sequence; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 405 | __u8 last_fid; |
| 406 | }; |
| 407 | |
| 408 | enum uvc_device_state { |
| 409 | UVC_DEV_DISCONNECTED = 1, |
| 410 | }; |
| 411 | |
| 412 | struct uvc_device { |
| 413 | struct usb_device *udev; |
| 414 | struct usb_interface *intf; |
Laurent Pinchart | 44f0079 | 2008-11-08 19:14:50 -0300 | [diff] [blame] | 415 | unsigned long warnings; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 416 | __u32 quirks; |
| 417 | int intfnum; |
| 418 | char name[32]; |
| 419 | |
| 420 | enum uvc_device_state state; |
Laurent Pinchart | 04a37e0 | 2009-05-19 10:08:03 -0300 | [diff] [blame] | 421 | atomic_t users; |
Martin Rubli | 8fb91b3 | 2010-09-08 04:15:23 -0300 | [diff] [blame] | 422 | atomic_t nmappings; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 423 | |
| 424 | /* Video control interface */ |
Laurent Pinchart | 5a254d7 | 2010-01-21 05:39:47 -0300 | [diff] [blame] | 425 | #ifdef CONFIG_MEDIA_CONTROLLER |
| 426 | struct media_device mdev; |
| 427 | #endif |
| 428 | struct v4l2_device vdev; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 429 | __u16 uvc_version; |
| 430 | __u32 clock_frequency; |
| 431 | |
| 432 | struct list_head entities; |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 433 | struct list_head chains; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 434 | |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 435 | /* Video Streaming interfaces */ |
| 436 | struct list_head streams; |
Laurent Pinchart | 716fdee | 2009-09-29 21:07:19 -0300 | [diff] [blame] | 437 | atomic_t nstreams; |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 438 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 439 | /* Status Interrupt Endpoint */ |
| 440 | struct usb_host_endpoint *int_ep; |
| 441 | struct urb *int_urb; |
Ming Lei | a31a405 | 2008-09-16 03:32:20 -0300 | [diff] [blame] | 442 | __u8 *status; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 443 | struct input_dev *input; |
Laurent Pinchart | f180152 | 2009-01-22 12:45:10 -0300 | [diff] [blame] | 444 | char input_phys[64]; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 445 | }; |
| 446 | |
| 447 | enum uvc_handle_state { |
| 448 | UVC_HANDLE_PASSIVE = 0, |
| 449 | UVC_HANDLE_ACTIVE = 1, |
| 450 | }; |
| 451 | |
| 452 | struct uvc_fh { |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 453 | struct uvc_video_chain *chain; |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 454 | struct uvc_streaming *stream; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 455 | enum uvc_handle_state state; |
| 456 | }; |
| 457 | |
| 458 | struct uvc_driver { |
| 459 | struct usb_driver driver; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 460 | }; |
| 461 | |
| 462 | /* ------------------------------------------------------------------------ |
| 463 | * Debugging, printing and logging |
| 464 | */ |
| 465 | |
| 466 | #define UVC_TRACE_PROBE (1 << 0) |
| 467 | #define UVC_TRACE_DESCR (1 << 1) |
| 468 | #define UVC_TRACE_CONTROL (1 << 2) |
| 469 | #define UVC_TRACE_FORMAT (1 << 3) |
| 470 | #define UVC_TRACE_CAPTURE (1 << 4) |
| 471 | #define UVC_TRACE_CALLS (1 << 5) |
| 472 | #define UVC_TRACE_IOCTL (1 << 6) |
| 473 | #define UVC_TRACE_FRAME (1 << 7) |
| 474 | #define UVC_TRACE_SUSPEND (1 << 8) |
| 475 | #define UVC_TRACE_STATUS (1 << 9) |
Laurent Pinchart | 663a419 | 2009-08-06 11:41:17 -0300 | [diff] [blame] | 476 | #define UVC_TRACE_VIDEO (1 << 10) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 477 | |
Laurent Pinchart | 44f0079 | 2008-11-08 19:14:50 -0300 | [diff] [blame] | 478 | #define UVC_WARN_MINMAX 0 |
| 479 | #define UVC_WARN_PROBE_DEF 1 |
Laurent Pinchart | c4d99f8 | 2010-09-30 09:04:03 -0300 | [diff] [blame^] | 480 | #define UVC_WARN_XU_GET_RES 2 |
Laurent Pinchart | 44f0079 | 2008-11-08 19:14:50 -0300 | [diff] [blame] | 481 | |
Laurent Pinchart | 310fe52 | 2009-12-09 22:57:48 -0300 | [diff] [blame] | 482 | extern unsigned int uvc_clock_param; |
Laurent Pinchart | 0fbd8ee | 2008-12-06 16:25:14 -0300 | [diff] [blame] | 483 | extern unsigned int uvc_no_drop_param; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 484 | extern unsigned int uvc_trace_param; |
Laurent Pinchart | b232a01 | 2009-10-09 20:55:23 -0300 | [diff] [blame] | 485 | extern unsigned int uvc_timeout_param; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 486 | |
| 487 | #define uvc_trace(flag, msg...) \ |
| 488 | do { \ |
| 489 | if (uvc_trace_param & flag) \ |
| 490 | printk(KERN_DEBUG "uvcvideo: " msg); \ |
| 491 | } while (0) |
| 492 | |
Laurent Pinchart | 44f0079 | 2008-11-08 19:14:50 -0300 | [diff] [blame] | 493 | #define uvc_warn_once(dev, warn, msg...) \ |
| 494 | do { \ |
| 495 | if (!test_and_set_bit(warn, &dev->warnings)) \ |
| 496 | printk(KERN_INFO "uvcvideo: " msg); \ |
| 497 | } while (0) |
| 498 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 499 | #define uvc_printk(level, msg...) \ |
| 500 | printk(level "uvcvideo: " msg) |
| 501 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 502 | /* -------------------------------------------------------------------------- |
| 503 | * Internal functions. |
| 504 | */ |
| 505 | |
| 506 | /* Core driver */ |
| 507 | extern struct uvc_driver uvc_driver; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 508 | |
Laurent Pinchart | 4ffc2d8 | 2010-01-21 05:39:52 -0300 | [diff] [blame] | 509 | extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id); |
| 510 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 511 | /* Video buffers queue management. */ |
Laurent Pinchart | ff92420 | 2008-12-28 22:32:29 -0300 | [diff] [blame] | 512 | extern void uvc_queue_init(struct uvc_video_queue *queue, |
Laurent Pinchart | 9bde9f2 | 2010-06-17 06:52:37 -0300 | [diff] [blame] | 513 | enum v4l2_buf_type type, int drop_corrupted); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 514 | extern int uvc_alloc_buffers(struct uvc_video_queue *queue, |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 515 | struct v4l2_requestbuffers *rb); |
| 516 | extern void uvc_free_buffers(struct uvc_video_queue *queue); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 517 | extern int uvc_query_buffer(struct uvc_video_queue *queue, |
| 518 | struct v4l2_buffer *v4l2_buf); |
| 519 | extern int uvc_queue_buffer(struct uvc_video_queue *queue, |
| 520 | struct v4l2_buffer *v4l2_buf); |
| 521 | extern int uvc_dequeue_buffer(struct uvc_video_queue *queue, |
| 522 | struct v4l2_buffer *v4l2_buf, int nonblocking); |
| 523 | extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable); |
| 524 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); |
| 525 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, |
| 526 | struct uvc_buffer *buf); |
Laurent Pinchart | 4aa2759 | 2010-11-21 15:18:08 -0300 | [diff] [blame] | 527 | extern int uvc_queue_mmap(struct uvc_video_queue *queue, |
| 528 | struct vm_area_struct *vma); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 529 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, |
| 530 | struct file *file, poll_table *wait); |
Bob Liu | 7296944 | 2011-04-29 07:11:35 -0300 | [diff] [blame] | 531 | #ifndef CONFIG_MMU |
| 532 | extern unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, |
| 533 | unsigned long pgoff); |
| 534 | #endif |
Laurent Pinchart | 23ff604 | 2009-06-04 09:26:39 -0300 | [diff] [blame] | 535 | extern int uvc_queue_allocated(struct uvc_video_queue *queue); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 536 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) |
| 537 | { |
Laurent Pinchart | 6998b6f | 2011-10-24 11:53:59 -0300 | [diff] [blame] | 538 | return vb2_is_streaming(&queue->queue); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | /* V4L2 interface */ |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame] | 542 | extern const struct v4l2_file_operations uvc_fops; |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 543 | |
Laurent Pinchart | 4ffc2d8 | 2010-01-21 05:39:52 -0300 | [diff] [blame] | 544 | /* Media controller */ |
| 545 | extern int uvc_mc_register_entities(struct uvc_video_chain *chain); |
| 546 | extern void uvc_mc_cleanup_entity(struct uvc_entity *entity); |
| 547 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 548 | /* Video */ |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 549 | extern int uvc_video_init(struct uvc_streaming *stream); |
| 550 | extern int uvc_video_suspend(struct uvc_streaming *stream); |
Ming Lei | d59a7b1 | 2011-07-16 00:51:00 -0300 | [diff] [blame] | 551 | extern int uvc_video_resume(struct uvc_streaming *stream, int reset); |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 552 | extern int uvc_video_enable(struct uvc_streaming *stream, int enable); |
| 553 | extern int uvc_probe_video(struct uvc_streaming *stream, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 554 | struct uvc_streaming_control *probe); |
| 555 | extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, |
| 556 | __u8 intfnum, __u8 cs, void *data, __u16 size); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 557 | |
| 558 | /* Status */ |
| 559 | extern int uvc_status_init(struct uvc_device *dev); |
| 560 | extern void uvc_status_cleanup(struct uvc_device *dev); |
Laurent Pinchart | 04a37e0 | 2009-05-19 10:08:03 -0300 | [diff] [blame] | 561 | extern int uvc_status_start(struct uvc_device *dev); |
| 562 | extern void uvc_status_stop(struct uvc_device *dev); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 563 | extern int uvc_status_suspend(struct uvc_device *dev); |
| 564 | extern int uvc_status_resume(struct uvc_device *dev); |
| 565 | |
| 566 | /* Controls */ |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 567 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 568 | struct v4l2_queryctrl *v4l2_ctrl); |
Laurent Pinchart | 23d9f3e | 2010-11-21 07:58:54 -0300 | [diff] [blame] | 569 | extern int uvc_query_v4l2_menu(struct uvc_video_chain *chain, |
| 570 | struct v4l2_querymenu *query_menu); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 571 | |
Laurent Pinchart | ba2fa99 | 2010-09-20 05:53:21 -0300 | [diff] [blame] | 572 | extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, |
| 573 | const struct uvc_control_mapping *mapping); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 574 | extern int uvc_ctrl_init_device(struct uvc_device *dev); |
| 575 | extern void uvc_ctrl_cleanup_device(struct uvc_device *dev); |
| 576 | extern int uvc_ctrl_resume_device(struct uvc_device *dev); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 577 | |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 578 | extern int uvc_ctrl_begin(struct uvc_video_chain *chain); |
| 579 | extern int __uvc_ctrl_commit(struct uvc_video_chain *chain, int rollback); |
| 580 | static inline int uvc_ctrl_commit(struct uvc_video_chain *chain) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 581 | { |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 582 | return __uvc_ctrl_commit(chain, 0); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 583 | } |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 584 | static inline int uvc_ctrl_rollback(struct uvc_video_chain *chain) |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 585 | { |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 586 | return __uvc_ctrl_commit(chain, 1); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 587 | } |
| 588 | |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 589 | extern int uvc_ctrl_get(struct uvc_video_chain *chain, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 590 | struct v4l2_ext_control *xctrl); |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 591 | extern int uvc_ctrl_set(struct uvc_video_chain *chain, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 592 | struct v4l2_ext_control *xctrl); |
| 593 | |
Laurent Pinchart | 8e11359 | 2009-07-01 20:24:47 -0300 | [diff] [blame] | 594 | extern int uvc_xu_ctrl_query(struct uvc_video_chain *chain, |
Martin Rubli | fe78d18 | 2010-10-02 19:10:16 -0300 | [diff] [blame] | 595 | struct uvc_xu_control_query *xqry); |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 596 | |
| 597 | /* Utility functions */ |
| 598 | extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator, |
| 599 | unsigned int n_terms, unsigned int threshold); |
| 600 | extern uint32_t uvc_fraction_to_interval(uint32_t numerator, |
| 601 | uint32_t denominator); |
| 602 | extern struct usb_host_endpoint *uvc_find_endpoint( |
| 603 | struct usb_host_interface *alts, __u8 epaddr); |
| 604 | |
| 605 | /* Quirks support */ |
Laurent Pinchart | 35f02a6 | 2009-06-28 08:37:50 -0300 | [diff] [blame] | 606 | void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream, |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 607 | struct uvc_buffer *buf); |
| 608 | |
Laurent Pinchart | c0efd23 | 2008-06-30 15:04:50 -0300 | [diff] [blame] | 609 | #endif |