v4l2-subdev.h 6.2 KB

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