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