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