v4l2-subdev.h 5.3 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 (from enum v4l2_mbus_pixelcode)
  66. */
  67. struct v4l2_subdev_mbus_code_enum {
  68. __u32 pad;
  69. __u32 index;
  70. __u32 code;
  71. __u32 reserved[9];
  72. };
  73. /**
  74. * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  75. * @pad: pad number, as reported by the media API
  76. * @index: format index during enumeration
  77. * @code: format code (from enum v4l2_mbus_pixelcode)
  78. */
  79. struct v4l2_subdev_frame_size_enum {
  80. __u32 index;
  81. __u32 pad;
  82. __u32 code;
  83. __u32 min_width;
  84. __u32 max_width;
  85. __u32 min_height;
  86. __u32 max_height;
  87. __u32 reserved[9];
  88. };
  89. /**
  90. * struct v4l2_subdev_frame_interval - Pad-level frame rate
  91. * @pad: pad number, as reported by the media API
  92. * @interval: frame interval in seconds
  93. */
  94. struct v4l2_subdev_frame_interval {
  95. __u32 pad;
  96. struct v4l2_fract interval;
  97. __u32 reserved[9];
  98. };
  99. /**
  100. * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
  101. * @pad: pad number, as reported by the media API
  102. * @index: frame interval index during enumeration
  103. * @code: format code (from enum v4l2_mbus_pixelcode)
  104. * @width: frame width in pixels
  105. * @height: frame height in pixels
  106. * @interval: frame interval in seconds
  107. */
  108. struct v4l2_subdev_frame_interval_enum {
  109. __u32 index;
  110. __u32 pad;
  111. __u32 code;
  112. __u32 width;
  113. __u32 height;
  114. struct v4l2_fract interval;
  115. __u32 reserved[9];
  116. };
  117. /**
  118. * struct v4l2_subdev_selection - selection info
  119. *
  120. * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
  121. * @pad: pad number, as reported by the media API
  122. * @target: Selection target, used to choose one of possible rectangles,
  123. * defined in v4l2-common.h; V4L2_SEL_TGT_* .
  124. * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
  125. * @r: coordinates of the selection window
  126. * @reserved: for future use, set to zero for now
  127. *
  128. * Hardware may use multiple helper windows to process a video stream.
  129. * The structure is used to exchange this selection areas between
  130. * an application and a driver.
  131. */
  132. struct v4l2_subdev_selection {
  133. __u32 which;
  134. __u32 pad;
  135. __u32 target;
  136. __u32 flags;
  137. struct v4l2_rect r;
  138. __u32 reserved[8];
  139. };
  140. struct v4l2_subdev_edid {
  141. __u32 pad;
  142. __u32 start_block;
  143. __u32 blocks;
  144. __u32 reserved[5];
  145. __u8 __user *edid;
  146. };
  147. #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
  148. #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
  149. #define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
  150. _IOWR('V', 21, struct v4l2_subdev_frame_interval)
  151. #define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
  152. _IOWR('V', 22, struct v4l2_subdev_frame_interval)
  153. #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
  154. _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
  155. #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
  156. _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
  157. #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
  158. _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
  159. #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
  160. #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
  161. #define VIDIOC_SUBDEV_G_SELECTION \
  162. _IOWR('V', 61, struct v4l2_subdev_selection)
  163. #define VIDIOC_SUBDEV_S_SELECTION \
  164. _IOWR('V', 62, struct v4l2_subdev_selection)
  165. #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_subdev_edid)
  166. #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_subdev_edid)
  167. #endif