Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 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 | |
| 23 | #ifndef __LINUX_V4L2_SUBDEV_H |
| 24 | #define __LINUX_V4L2_SUBDEV_H |
| 25 | |
| 26 | #include <linux/ioctl.h> |
| 27 | #include <linux/types.h> |
Sakari Ailus | 5689b28 | 2012-05-18 09:31:18 -0300 | [diff] [blame] | 28 | #include <linux/v4l2-common.h> |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 29 | #include <linux/v4l2-mediabus.h> |
| 30 | |
| 31 | /** |
| 32 | * enum v4l2_subdev_format_whence - Media bus format type |
| 33 | * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only |
| 34 | * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device |
| 35 | */ |
| 36 | enum v4l2_subdev_format_whence { |
| 37 | V4L2_SUBDEV_FORMAT_TRY = 0, |
| 38 | V4L2_SUBDEV_FORMAT_ACTIVE = 1, |
| 39 | }; |
| 40 | |
| 41 | /** |
| 42 | * struct v4l2_subdev_format - Pad-level media bus format |
| 43 | * @which: format type (from enum v4l2_subdev_format_whence) |
| 44 | * @pad: pad number, as reported by the media API |
| 45 | * @format: media bus format (format code and frame size) |
| 46 | */ |
| 47 | struct v4l2_subdev_format { |
| 48 | __u32 which; |
| 49 | __u32 pad; |
| 50 | struct v4l2_mbus_framefmt format; |
| 51 | __u32 reserved[8]; |
| 52 | }; |
| 53 | |
| 54 | /** |
Antti Koskipaa | f6a5cb1 | 2010-06-23 05:03:42 -0300 | [diff] [blame] | 55 | * struct v4l2_subdev_crop - Pad-level crop settings |
| 56 | * @which: format type (from enum v4l2_subdev_format_whence) |
| 57 | * @pad: pad number, as reported by the media API |
| 58 | * @rect: pad crop rectangle boundaries |
| 59 | */ |
| 60 | struct v4l2_subdev_crop { |
| 61 | __u32 which; |
| 62 | __u32 pad; |
| 63 | struct v4l2_rect rect; |
| 64 | __u32 reserved[8]; |
| 65 | }; |
| 66 | |
| 67 | /** |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 68 | * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration |
| 69 | * @pad: pad number, as reported by the media API |
| 70 | * @index: format index during enumeration |
Boris BREZILLON | 32b32ce | 2014-11-10 14:28:28 -0300 | [diff] [blame] | 71 | * @code: format code (MEDIA_BUS_FMT_ definitions) |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 72 | * @which: format type (from enum v4l2_subdev_format_whence) |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 73 | */ |
| 74 | struct v4l2_subdev_mbus_code_enum { |
| 75 | __u32 pad; |
| 76 | __u32 index; |
| 77 | __u32 code; |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 78 | __u32 which; |
| 79 | __u32 reserved[8]; |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | /** |
| 83 | * struct v4l2_subdev_frame_size_enum - Media bus format enumeration |
| 84 | * @pad: pad number, as reported by the media API |
| 85 | * @index: format index during enumeration |
Boris BREZILLON | 32b32ce | 2014-11-10 14:28:28 -0300 | [diff] [blame] | 86 | * @code: format code (MEDIA_BUS_FMT_ definitions) |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 87 | * @which: format type (from enum v4l2_subdev_format_whence) |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 88 | */ |
| 89 | struct v4l2_subdev_frame_size_enum { |
| 90 | __u32 index; |
| 91 | __u32 pad; |
| 92 | __u32 code; |
| 93 | __u32 min_width; |
| 94 | __u32 max_width; |
| 95 | __u32 min_height; |
| 96 | __u32 max_height; |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 97 | __u32 which; |
| 98 | __u32 reserved[8]; |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 99 | }; |
| 100 | |
Laurent Pinchart | 35c3017 | 2010-05-05 11:38:35 -0300 | [diff] [blame] | 101 | /** |
| 102 | * struct v4l2_subdev_frame_interval - Pad-level frame rate |
| 103 | * @pad: pad number, as reported by the media API |
| 104 | * @interval: frame interval in seconds |
| 105 | */ |
| 106 | struct v4l2_subdev_frame_interval { |
| 107 | __u32 pad; |
| 108 | struct v4l2_fract interval; |
| 109 | __u32 reserved[9]; |
| 110 | }; |
| 111 | |
| 112 | /** |
| 113 | * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration |
| 114 | * @pad: pad number, as reported by the media API |
| 115 | * @index: frame interval index during enumeration |
Boris BREZILLON | 32b32ce | 2014-11-10 14:28:28 -0300 | [diff] [blame] | 116 | * @code: format code (MEDIA_BUS_FMT_ definitions) |
Laurent Pinchart | 35c3017 | 2010-05-05 11:38:35 -0300 | [diff] [blame] | 117 | * @width: frame width in pixels |
| 118 | * @height: frame height in pixels |
| 119 | * @interval: frame interval in seconds |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 120 | * @which: format type (from enum v4l2_subdev_format_whence) |
Laurent Pinchart | 35c3017 | 2010-05-05 11:38:35 -0300 | [diff] [blame] | 121 | */ |
| 122 | struct v4l2_subdev_frame_interval_enum { |
| 123 | __u32 index; |
| 124 | __u32 pad; |
| 125 | __u32 code; |
| 126 | __u32 width; |
| 127 | __u32 height; |
| 128 | struct v4l2_fract interval; |
Hans Verkuil | e1c47e7 | 2015-03-04 01:47:55 -0800 | [diff] [blame] | 129 | __u32 which; |
| 130 | __u32 reserved[8]; |
Laurent Pinchart | 35c3017 | 2010-05-05 11:38:35 -0300 | [diff] [blame] | 131 | }; |
| 132 | |
Sakari Ailus | ae184cd | 2011-10-14 14:14:26 -0300 | [diff] [blame] | 133 | /** |
| 134 | * struct v4l2_subdev_selection - selection info |
| 135 | * |
| 136 | * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY |
| 137 | * @pad: pad number, as reported by the media API |
Sakari Ailus | 5689b28 | 2012-05-18 09:31:18 -0300 | [diff] [blame] | 138 | * @target: Selection target, used to choose one of possible rectangles, |
| 139 | * defined in v4l2-common.h; V4L2_SEL_TGT_* . |
Sakari Ailus | 563df3d | 2012-06-13 16:01:10 -0300 | [diff] [blame] | 140 | * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. |
Sakari Ailus | ae184cd | 2011-10-14 14:14:26 -0300 | [diff] [blame] | 141 | * @r: coordinates of the selection window |
| 142 | * @reserved: for future use, set to zero for now |
| 143 | * |
| 144 | * Hardware may use multiple helper windows to process a video stream. |
| 145 | * The structure is used to exchange this selection areas between |
| 146 | * an application and a driver. |
| 147 | */ |
| 148 | struct v4l2_subdev_selection { |
| 149 | __u32 which; |
| 150 | __u32 pad; |
| 151 | __u32 target; |
| 152 | __u32 flags; |
| 153 | struct v4l2_rect r; |
| 154 | __u32 reserved[8]; |
| 155 | }; |
| 156 | |
Hans Verkuil | 254a477 | 2014-03-04 07:46:47 -0300 | [diff] [blame] | 157 | /* Backwards compatibility define --- to be removed */ |
| 158 | #define v4l2_subdev_edid v4l2_edid |
Hans Verkuil | 777f4f8 | 2012-07-05 10:58:06 -0300 | [diff] [blame] | 159 | |
Laurent Pinchart | c4fa146 | 2014-01-29 10:06:13 -0300 | [diff] [blame] | 160 | #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) |
| 161 | #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) |
| 162 | #define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval) |
| 163 | #define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval) |
| 164 | #define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) |
| 165 | #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) |
| 166 | #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) |
| 167 | #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) |
| 168 | #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) |
| 169 | #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) |
| 170 | #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) |
Laurent Pinchart | 9cfd65e | 2014-01-29 10:07:13 -0300 | [diff] [blame] | 171 | /* The following ioctls are identical to the ioctls in videodev2.h */ |
Laurent Pinchart | c4fa146 | 2014-01-29 10:06:13 -0300 | [diff] [blame] | 172 | #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) |
| 173 | #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid) |
Laurent Pinchart | 9cfd65e | 2014-01-29 10:07:13 -0300 | [diff] [blame] | 174 | #define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) |
| 175 | #define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) |
| 176 | #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings) |
| 177 | #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings) |
| 178 | #define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap) |
Laurent Pinchart | 333c8b9 | 2010-03-15 20:26:04 -0300 | [diff] [blame] | 179 | |
| 180 | #endif |