v4l2-subdev.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * V4L2 subdev userspace API
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. *
  6. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  7. * Sakari Ailus <sakari.ailus@iki.fi>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef __LINUX_V4L2_SUBDEV_H
  23. #define __LINUX_V4L2_SUBDEV_H
  24. #include <linux/ioctl.h>
  25. #include <linux/types.h>
  26. #include <linux/v4l2-common.h>
  27. #include <linux/v4l2-mediabus.h>
  28. /**
  29. * enum v4l2_subdev_format_whence - Media bus format type
  30. * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
  31. * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
  32. */
  33. enum v4l2_subdev_format_whence {
  34. V4L2_SUBDEV_FORMAT_TRY = 0,
  35. V4L2_SUBDEV_FORMAT_ACTIVE = 1,
  36. };
  37. /**
  38. * struct v4l2_subdev_format - Pad-level media bus format
  39. * @which: format type (from enum v4l2_subdev_format_whence)
  40. * @pad: pad number, as reported by the media API
  41. * @format: media bus format (format code and frame size)
  42. */
  43. struct v4l2_subdev_format {
  44. __u32 which;
  45. __u32 pad;
  46. struct v4l2_mbus_framefmt format;
  47. __u32 reserved[8];
  48. };
  49. /**
  50. * struct v4l2_subdev_crop - Pad-level crop settings
  51. * @which: format type (from enum v4l2_subdev_format_whence)
  52. * @pad: pad number, as reported by the media API
  53. * @rect: pad crop rectangle boundaries
  54. */
  55. struct v4l2_subdev_crop {
  56. __u32 which;
  57. __u32 pad;
  58. struct v4l2_rect rect;
  59. __u32 reserved[8];
  60. };
  61. /**
  62. * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
  63. * @pad: pad number, as reported by the media API
  64. * @index: format index during enumeration
  65. * @code: format code (MEDIA_BUS_FMT_ definitions)
  66. * @which: format type (from enum v4l2_subdev_format_whence)
  67. */
  68. struct v4l2_subdev_mbus_code_enum {
  69. __u32 pad;
  70. __u32 index;
  71. __u32 code;
  72. __u32 which;
  73. __u32 reserved[8];
  74. };
  75. /**
  76. * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  77. * @pad: pad number, as reported by the media API
  78. * @index: format index during enumeration
  79. * @code: format code (MEDIA_BUS_FMT_ definitions)
  80. * @which: format type (from enum v4l2_subdev_format_whence)
  81. */
  82. struct v4l2_subdev_frame_size_enum {
  83. __u32 index;
  84. __u32 pad;
  85. __u32 code;
  86. __u32 min_width;
  87. __u32 max_width;
  88. __u32 min_height;
  89. __u32 max_height;
  90. __u32 which;
  91. __u32 reserved[8];
  92. };
  93. /**
  94. * struct v4l2_subdev_frame_interval - Pad-level frame rate
  95. * @pad: pad number, as reported by the media API
  96. * @interval: frame interval in seconds
  97. */
  98. struct v4l2_subdev_frame_interval {
  99. __u32 pad;
  100. struct v4l2_fract interval;
  101. __u32 reserved[9];
  102. };
  103. /**
  104. * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
  105. * @pad: pad number, as reported by the media API
  106. * @index: frame interval index during enumeration
  107. * @code: format code (MEDIA_BUS_FMT_ definitions)
  108. * @width: frame width in pixels
  109. * @height: frame height in pixels
  110. * @interval: frame interval in seconds
  111. * @which: format type (from enum v4l2_subdev_format_whence)
  112. */
  113. struct v4l2_subdev_frame_interval_enum {
  114. __u32 index;
  115. __u32 pad;
  116. __u32 code;
  117. __u32 width;
  118. __u32 height;
  119. struct v4l2_fract interval;
  120. __u32 which;
  121. __u32 reserved[8];
  122. };
  123. /**
  124. * struct v4l2_subdev_selection - selection info
  125. *
  126. * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
  127. * @pad: pad number, as reported by the media API
  128. * @target: Selection target, used to choose one of possible rectangles,
  129. * defined in v4l2-common.h; V4L2_SEL_TGT_* .
  130. * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
  131. * @r: coordinates of the selection window
  132. * @reserved: for future use, set to zero for now
  133. *
  134. * Hardware may use multiple helper windows to process a video stream.
  135. * The structure is used to exchange this selection areas between
  136. * an application and a driver.
  137. */
  138. struct v4l2_subdev_selection {
  139. __u32 which;
  140. __u32 pad;
  141. __u32 target;
  142. __u32 flags;
  143. struct v4l2_rect r;
  144. __u32 reserved[8];
  145. };
  146. /* Backwards compatibility define --- to be removed */
  147. #define v4l2_subdev_edid v4l2_edid
  148. #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
  149. #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
  150. #define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
  151. #define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval)
  152. #define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
  153. #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
  154. #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
  155. #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
  156. #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
  157. #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection)
  158. #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection)
  159. /* The following ioctls are identical to the ioctls in videodev2.h */
  160. #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
  161. #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
  162. #define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
  163. #define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
  164. #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
  165. #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
  166. #define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
  167. #endif