uvcvideo.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef __LINUX_UVCVIDEO_H_
  3. #define __LINUX_UVCVIDEO_H_
  4. #include <linux/ioctl.h>
  5. #include <linux/types.h>
  6. /*
  7. * Dynamic controls
  8. */
  9. /* Data types for UVC control data */
  10. #define UVC_CTRL_DATA_TYPE_RAW 0
  11. #define UVC_CTRL_DATA_TYPE_SIGNED 1
  12. #define UVC_CTRL_DATA_TYPE_UNSIGNED 2
  13. #define UVC_CTRL_DATA_TYPE_BOOLEAN 3
  14. #define UVC_CTRL_DATA_TYPE_ENUM 4
  15. #define UVC_CTRL_DATA_TYPE_BITMASK 5
  16. /* Control flags */
  17. #define UVC_CTRL_FLAG_SET_CUR (1 << 0)
  18. #define UVC_CTRL_FLAG_GET_CUR (1 << 1)
  19. #define UVC_CTRL_FLAG_GET_MIN (1 << 2)
  20. #define UVC_CTRL_FLAG_GET_MAX (1 << 3)
  21. #define UVC_CTRL_FLAG_GET_RES (1 << 4)
  22. #define UVC_CTRL_FLAG_GET_DEF (1 << 5)
  23. /* Control should be saved at suspend and restored at resume. */
  24. #define UVC_CTRL_FLAG_RESTORE (1 << 6)
  25. /* Control can be updated by the camera. */
  26. #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7)
  27. /* Control supports asynchronous reporting */
  28. #define UVC_CTRL_FLAG_ASYNCHRONOUS (1 << 8)
  29. #define UVC_CTRL_FLAG_GET_RANGE \
  30. (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
  31. UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
  32. UVC_CTRL_FLAG_GET_DEF)
  33. struct uvc_menu_info {
  34. __u32 value;
  35. __u8 name[32];
  36. };
  37. struct uvc_xu_control_mapping {
  38. __u32 id;
  39. __u8 name[32];
  40. __u8 entity[16];
  41. __u8 selector;
  42. __u8 size;
  43. __u8 offset;
  44. __u32 v4l2_type;
  45. __u32 data_type;
  46. struct uvc_menu_info __user *menu_info;
  47. __u32 menu_count;
  48. __u32 reserved[4];
  49. };
  50. struct uvc_xu_control_query {
  51. __u8 unit;
  52. __u8 selector;
  53. __u8 query; /* Video Class-Specific Request Code, */
  54. /* defined in linux/usb/video.h A.8. */
  55. __u16 size;
  56. __u8 __user *data;
  57. };
  58. #define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping)
  59. #define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query)
  60. /*
  61. * Metadata node
  62. */
  63. /**
  64. * struct uvc_meta_buf - metadata buffer building block
  65. * @ns - system timestamp of the payload in nanoseconds
  66. * @sof - USB Frame Number
  67. * @length - length of the payload header
  68. * @flags - payload header flags
  69. * @buf - optional device-specific header data
  70. *
  71. * UVC metadata nodes fill buffers with possibly multiple instances of this
  72. * struct. The first two fields are added by the driver, they can be used for
  73. * clock synchronisation. The rest is an exact copy of a UVC payload header.
  74. * Only complete objects with complete buffers are included. Therefore it's
  75. * always sizeof(meta->ts) + sizeof(meta->sof) + meta->length bytes large.
  76. */
  77. struct uvc_meta_buf {
  78. __u64 ns;
  79. __u16 sof;
  80. __u8 length;
  81. __u8 flags;
  82. __u8 buf[];
  83. } __packed;
  84. #endif