v4l2-subdev.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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-mediabus.h>
  27. /**
  28. * enum v4l2_subdev_format_whence - Media bus format type
  29. * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
  30. * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
  31. */
  32. enum v4l2_subdev_format_whence {
  33. V4L2_SUBDEV_FORMAT_TRY = 0,
  34. V4L2_SUBDEV_FORMAT_ACTIVE = 1,
  35. };
  36. /**
  37. * struct v4l2_subdev_format - Pad-level media bus format
  38. * @which: format type (from enum v4l2_subdev_format_whence)
  39. * @pad: pad number, as reported by the media API
  40. * @format: media bus format (format code and frame size)
  41. */
  42. struct v4l2_subdev_format {
  43. __u32 which;
  44. __u32 pad;
  45. struct v4l2_mbus_framefmt format;
  46. __u32 reserved[8];
  47. };
  48. /**
  49. * struct v4l2_subdev_crop - Pad-level crop settings
  50. * @which: format type (from enum v4l2_subdev_format_whence)
  51. * @pad: pad number, as reported by the media API
  52. * @rect: pad crop rectangle boundaries
  53. */
  54. struct v4l2_subdev_crop {
  55. __u32 which;
  56. __u32 pad;
  57. struct v4l2_rect rect;
  58. __u32 reserved[8];
  59. };
  60. /**
  61. * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
  62. * @pad: pad number, as reported by the media API
  63. * @index: format index during enumeration
  64. * @code: format code (from enum v4l2_mbus_pixelcode)
  65. */
  66. struct v4l2_subdev_mbus_code_enum {
  67. __u32 pad;
  68. __u32 index;
  69. __u32 code;
  70. __u32 reserved[9];
  71. };
  72. /**
  73. * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  74. * @pad: pad number, as reported by the media API
  75. * @index: format index during enumeration
  76. * @code: format code (from enum v4l2_mbus_pixelcode)
  77. */
  78. struct v4l2_subdev_frame_size_enum {
  79. __u32 index;
  80. __u32 pad;
  81. __u32 code;
  82. __u32 min_width;
  83. __u32 max_width;
  84. __u32 min_height;
  85. __u32 max_height;
  86. __u32 reserved[9];
  87. };
  88. /**
  89. * struct v4l2_subdev_frame_interval - Pad-level frame rate
  90. * @pad: pad number, as reported by the media API
  91. * @interval: frame interval in seconds
  92. */
  93. struct v4l2_subdev_frame_interval {
  94. __u32 pad;
  95. struct v4l2_fract interval;
  96. __u32 reserved[9];
  97. };
  98. /**
  99. * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
  100. * @pad: pad number, as reported by the media API
  101. * @index: frame interval index during enumeration
  102. * @code: format code (from enum v4l2_mbus_pixelcode)
  103. * @width: frame width in pixels
  104. * @height: frame height in pixels
  105. * @interval: frame interval in seconds
  106. */
  107. struct v4l2_subdev_frame_interval_enum {
  108. __u32 index;
  109. __u32 pad;
  110. __u32 code;
  111. __u32 width;
  112. __u32 height;
  113. struct v4l2_fract interval;
  114. __u32 reserved[9];
  115. };
  116. #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
  117. #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
  118. #define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
  119. _IOWR('V', 21, struct v4l2_subdev_frame_interval)
  120. #define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
  121. _IOWR('V', 22, struct v4l2_subdev_frame_interval)
  122. #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
  123. _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
  124. #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
  125. _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
  126. #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
  127. _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
  128. #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
  129. #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
  130. #endif