logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

v4l2-subdev.h (10345B)


  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. #ifndef __LINUX_V4L2_SUBDEV_H
  11. #define __LINUX_V4L2_SUBDEV_H
  12. #include <linux/const.h>
  13. #include <linux/ioctl.h>
  14. #include <linux/types.h>
  15. #include <linux/v4l2-common.h>
  16. #include <linux/v4l2-mediabus.h>
  17. /**
  18. * enum v4l2_subdev_format_whence - Media bus format type
  19. * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
  20. * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
  21. */
  22. enum v4l2_subdev_format_whence {
  23. V4L2_SUBDEV_FORMAT_TRY = 0,
  24. V4L2_SUBDEV_FORMAT_ACTIVE = 1,
  25. };
  26. /**
  27. * struct v4l2_subdev_format - Pad-level media bus format
  28. * @which: format type (from enum v4l2_subdev_format_whence)
  29. * @pad: pad number, as reported by the media API
  30. * @format: media bus format (format code and frame size)
  31. * @stream: stream number, defined in subdev routing
  32. * @reserved: drivers and applications must zero this array
  33. */
  34. struct v4l2_subdev_format {
  35. __u32 which;
  36. __u32 pad;
  37. struct v4l2_mbus_framefmt format;
  38. __u32 stream;
  39. __u32 reserved[7];
  40. };
  41. /**
  42. * struct v4l2_subdev_crop - Pad-level crop settings
  43. * @which: format type (from enum v4l2_subdev_format_whence)
  44. * @pad: pad number, as reported by the media API
  45. * @rect: pad crop rectangle boundaries
  46. * @stream: stream number, defined in subdev routing
  47. * @reserved: drivers and applications must zero this array
  48. *
  49. * The subdev crop API is an obsolete interface and may be removed in the
  50. * future. It is superseded by the selection API. No new extensions to this
  51. * structure will be accepted.
  52. */
  53. struct v4l2_subdev_crop {
  54. __u32 which;
  55. __u32 pad;
  56. struct v4l2_rect rect;
  57. __u32 stream;
  58. __u32 reserved[7];
  59. };
  60. #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001
  61. #define V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC 0x00000002
  62. #define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC 0x00000004
  63. #define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
  64. #define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION 0x00000008
  65. /**
  66. * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
  67. * @pad: pad number, as reported by the media API
  68. * @index: format index during enumeration
  69. * @code: format code (MEDIA_BUS_FMT_ definitions)
  70. * @which: format type (from enum v4l2_subdev_format_whence)
  71. * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*)
  72. * @stream: stream number, defined in subdev routing
  73. * @reserved: drivers and applications must zero this array
  74. */
  75. struct v4l2_subdev_mbus_code_enum {
  76. __u32 pad;
  77. __u32 index;
  78. __u32 code;
  79. __u32 which;
  80. __u32 flags;
  81. __u32 stream;
  82. __u32 reserved[6];
  83. };
  84. /**
  85. * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  86. * @index: format index during enumeration
  87. * @pad: pad number, as reported by the media API
  88. * @code: format code (MEDIA_BUS_FMT_ definitions)
  89. * @min_width: minimum frame width, in pixels
  90. * @max_width: maximum frame width, in pixels
  91. * @min_height: minimum frame height, in pixels
  92. * @max_height: maximum frame height, in pixels
  93. * @which: format type (from enum v4l2_subdev_format_whence)
  94. * @stream: stream number, defined in subdev routing
  95. * @reserved: drivers and applications must zero this array
  96. */
  97. struct v4l2_subdev_frame_size_enum {
  98. __u32 index;
  99. __u32 pad;
  100. __u32 code;
  101. __u32 min_width;
  102. __u32 max_width;
  103. __u32 min_height;
  104. __u32 max_height;
  105. __u32 which;
  106. __u32 stream;
  107. __u32 reserved[7];
  108. };
  109. /**
  110. * struct v4l2_subdev_frame_interval - Pad-level frame rate
  111. * @pad: pad number, as reported by the media API
  112. * @interval: frame interval in seconds
  113. * @stream: stream number, defined in subdev routing
  114. * @which: interval type (from enum v4l2_subdev_format_whence)
  115. * @reserved: drivers and applications must zero this array
  116. */
  117. struct v4l2_subdev_frame_interval {
  118. __u32 pad;
  119. struct v4l2_fract interval;
  120. __u32 stream;
  121. __u32 which;
  122. __u32 reserved[7];
  123. };
  124. /**
  125. * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
  126. * @pad: pad number, as reported by the media API
  127. * @index: frame interval index during enumeration
  128. * @code: format code (MEDIA_BUS_FMT_ definitions)
  129. * @width: frame width in pixels
  130. * @height: frame height in pixels
  131. * @interval: frame interval in seconds
  132. * @which: interval type (from enum v4l2_subdev_format_whence)
  133. * @stream: stream number, defined in subdev routing
  134. * @reserved: drivers and applications must zero this array
  135. */
  136. struct v4l2_subdev_frame_interval_enum {
  137. __u32 index;
  138. __u32 pad;
  139. __u32 code;
  140. __u32 width;
  141. __u32 height;
  142. struct v4l2_fract interval;
  143. __u32 which;
  144. __u32 stream;
  145. __u32 reserved[7];
  146. };
  147. /**
  148. * struct v4l2_subdev_selection - selection info
  149. *
  150. * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
  151. * @pad: pad number, as reported by the media API
  152. * @target: Selection target, used to choose one of possible rectangles,
  153. * defined in v4l2-common.h; V4L2_SEL_TGT_* .
  154. * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
  155. * @r: coordinates of the selection window
  156. * @stream: stream number, defined in subdev routing
  157. * @reserved: for future use, set to zero for now
  158. *
  159. * Hardware may use multiple helper windows to process a video stream.
  160. * The structure is used to exchange this selection areas between
  161. * an application and a driver.
  162. */
  163. struct v4l2_subdev_selection {
  164. __u32 which;
  165. __u32 pad;
  166. __u32 target;
  167. __u32 flags;
  168. struct v4l2_rect r;
  169. __u32 stream;
  170. __u32 reserved[7];
  171. };
  172. /**
  173. * struct v4l2_subdev_capability - subdev capabilities
  174. * @version: the driver versioning number
  175. * @capabilities: the subdev capabilities, see V4L2_SUBDEV_CAP_*
  176. * @reserved: for future use, set to zero for now
  177. */
  178. struct v4l2_subdev_capability {
  179. __u32 version;
  180. __u32 capabilities;
  181. __u32 reserved[14];
  182. };
  183. /* The v4l2 sub-device video device node is registered in read-only mode. */
  184. #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001
  185. /* The v4l2 sub-device supports routing and multiplexed streams. */
  186. #define V4L2_SUBDEV_CAP_STREAMS 0x00000002
  187. /*
  188. * Is the route active? An active route will start when streaming is enabled
  189. * on a video node.
  190. */
  191. #define V4L2_SUBDEV_ROUTE_FL_ACTIVE (1U << 0)
  192. /**
  193. * struct v4l2_subdev_route - A route inside a subdev
  194. *
  195. * @sink_pad: the sink pad index
  196. * @sink_stream: the sink stream identifier
  197. * @source_pad: the source pad index
  198. * @source_stream: the source stream identifier
  199. * @flags: route flags V4L2_SUBDEV_ROUTE_FL_*
  200. * @reserved: drivers and applications must zero this array
  201. */
  202. struct v4l2_subdev_route {
  203. __u32 sink_pad;
  204. __u32 sink_stream;
  205. __u32 source_pad;
  206. __u32 source_stream;
  207. __u32 flags;
  208. __u32 reserved[5];
  209. };
  210. /**
  211. * struct v4l2_subdev_routing - Subdev routing information
  212. *
  213. * @which: configuration type (from enum v4l2_subdev_format_whence)
  214. * @len_routes: the length of the routes array, in routes; set by the user, not
  215. * modified by the kernel
  216. * @routes: pointer to the routes array
  217. * @num_routes: the total number of routes, possibly more than fits in the
  218. * routes array
  219. * @reserved: drivers and applications must zero this array
  220. */
  221. struct v4l2_subdev_routing {
  222. __u32 which;
  223. __u32 len_routes;
  224. __u64 routes;
  225. __u32 num_routes;
  226. __u32 reserved[11];
  227. };
  228. /*
  229. * The client is aware of streams. Setting this flag enables the use of 'stream'
  230. * fields (referring to the stream number) with various ioctls. If this is not
  231. * set (which is the default), the 'stream' fields will be forced to 0 by the
  232. * kernel.
  233. */
  234. #define V4L2_SUBDEV_CLIENT_CAP_STREAMS (1ULL << 0)
  235. /*
  236. * The client is aware of the struct v4l2_subdev_frame_interval which field. If
  237. * this is not set (which is the default), the which field is forced to
  238. * V4L2_SUBDEV_FORMAT_ACTIVE by the kernel.
  239. */
  240. #define V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH (1ULL << 1)
  241. /**
  242. * struct v4l2_subdev_client_capability - Capabilities of the client accessing
  243. * the subdev
  244. *
  245. * @capabilities: A bitmask of V4L2_SUBDEV_CLIENT_CAP_* flags.
  246. */
  247. struct v4l2_subdev_client_capability {
  248. __u64 capabilities;
  249. };
  250. /* Backwards compatibility define --- to be removed */
  251. #define v4l2_subdev_edid v4l2_edid
  252. #define VIDIOC_SUBDEV_QUERYCAP _IOR('V', 0, struct v4l2_subdev_capability)
  253. #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
  254. #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
  255. #define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
  256. #define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval)
  257. #define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
  258. #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
  259. #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
  260. #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
  261. #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
  262. #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection)
  263. #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection)
  264. #define VIDIOC_SUBDEV_G_ROUTING _IOWR('V', 38, struct v4l2_subdev_routing)
  265. #define VIDIOC_SUBDEV_S_ROUTING _IOWR('V', 39, struct v4l2_subdev_routing)
  266. #define VIDIOC_SUBDEV_G_CLIENT_CAP _IOR('V', 101, struct v4l2_subdev_client_capability)
  267. #define VIDIOC_SUBDEV_S_CLIENT_CAP _IOWR('V', 102, struct v4l2_subdev_client_capability)
  268. /* The following ioctls are identical to the ioctls in videodev2.h */
  269. #define VIDIOC_SUBDEV_G_STD _IOR('V', 23, v4l2_std_id)
  270. #define VIDIOC_SUBDEV_S_STD _IOW('V', 24, v4l2_std_id)
  271. #define VIDIOC_SUBDEV_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
  272. #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
  273. #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
  274. #define VIDIOC_SUBDEV_QUERYSTD _IOR('V', 63, v4l2_std_id)
  275. #define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
  276. #define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
  277. #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
  278. #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
  279. #define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
  280. #endif