xref: /linux/include/uapi/linux/v4l2-subdev.h (revision 9cfd65e80959836fed78704e8a127d4e10448d56)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * V4L2 subdev userspace API
3607ca46eSDavid Howells  *
4607ca46eSDavid Howells  * Copyright (C) 2010 Nokia Corporation
5607ca46eSDavid Howells  *
6607ca46eSDavid Howells  * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7607ca46eSDavid Howells  *	     Sakari Ailus <sakari.ailus@iki.fi>
8607ca46eSDavid Howells  *
9607ca46eSDavid Howells  * This program is free software; you can redistribute it and/or modify
10607ca46eSDavid Howells  * it under the terms of the GNU General Public License version 2 as
11607ca46eSDavid Howells  * published by the Free Software Foundation.
12607ca46eSDavid Howells  *
13607ca46eSDavid Howells  * This program is distributed in the hope that it will be useful,
14607ca46eSDavid Howells  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15607ca46eSDavid Howells  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16607ca46eSDavid Howells  * GNU General Public License for more details.
17607ca46eSDavid Howells  *
18607ca46eSDavid Howells  * You should have received a copy of the GNU General Public License
19607ca46eSDavid Howells  * along with this program; if not, write to the Free Software
20607ca46eSDavid Howells  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21607ca46eSDavid Howells  */
22607ca46eSDavid Howells 
23607ca46eSDavid Howells #ifndef __LINUX_V4L2_SUBDEV_H
24607ca46eSDavid Howells #define __LINUX_V4L2_SUBDEV_H
25607ca46eSDavid Howells 
26607ca46eSDavid Howells #include <linux/ioctl.h>
27607ca46eSDavid Howells #include <linux/types.h>
28607ca46eSDavid Howells #include <linux/v4l2-common.h>
29607ca46eSDavid Howells #include <linux/v4l2-mediabus.h>
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /**
32607ca46eSDavid Howells  * enum v4l2_subdev_format_whence - Media bus format type
33607ca46eSDavid Howells  * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
34607ca46eSDavid Howells  * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
35607ca46eSDavid Howells  */
36607ca46eSDavid Howells enum v4l2_subdev_format_whence {
37607ca46eSDavid Howells 	V4L2_SUBDEV_FORMAT_TRY = 0,
38607ca46eSDavid Howells 	V4L2_SUBDEV_FORMAT_ACTIVE = 1,
39607ca46eSDavid Howells };
40607ca46eSDavid Howells 
41607ca46eSDavid Howells /**
42607ca46eSDavid Howells  * struct v4l2_subdev_format - Pad-level media bus format
43607ca46eSDavid Howells  * @which: format type (from enum v4l2_subdev_format_whence)
44607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
45607ca46eSDavid Howells  * @format: media bus format (format code and frame size)
46607ca46eSDavid Howells  */
47607ca46eSDavid Howells struct v4l2_subdev_format {
48607ca46eSDavid Howells 	__u32 which;
49607ca46eSDavid Howells 	__u32 pad;
50607ca46eSDavid Howells 	struct v4l2_mbus_framefmt format;
51607ca46eSDavid Howells 	__u32 reserved[8];
52607ca46eSDavid Howells };
53607ca46eSDavid Howells 
54607ca46eSDavid Howells /**
55607ca46eSDavid Howells  * struct v4l2_subdev_crop - Pad-level crop settings
56607ca46eSDavid Howells  * @which: format type (from enum v4l2_subdev_format_whence)
57607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
58607ca46eSDavid Howells  * @rect: pad crop rectangle boundaries
59607ca46eSDavid Howells  */
60607ca46eSDavid Howells struct v4l2_subdev_crop {
61607ca46eSDavid Howells 	__u32 which;
62607ca46eSDavid Howells 	__u32 pad;
63607ca46eSDavid Howells 	struct v4l2_rect rect;
64607ca46eSDavid Howells 	__u32 reserved[8];
65607ca46eSDavid Howells };
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /**
68607ca46eSDavid Howells  * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
69607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
70607ca46eSDavid Howells  * @index: format index during enumeration
71607ca46eSDavid Howells  * @code: format code (from enum v4l2_mbus_pixelcode)
72607ca46eSDavid Howells  */
73607ca46eSDavid Howells struct v4l2_subdev_mbus_code_enum {
74607ca46eSDavid Howells 	__u32 pad;
75607ca46eSDavid Howells 	__u32 index;
76607ca46eSDavid Howells 	__u32 code;
77607ca46eSDavid Howells 	__u32 reserved[9];
78607ca46eSDavid Howells };
79607ca46eSDavid Howells 
80607ca46eSDavid Howells /**
81607ca46eSDavid Howells  * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
82607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
83607ca46eSDavid Howells  * @index: format index during enumeration
84607ca46eSDavid Howells  * @code: format code (from enum v4l2_mbus_pixelcode)
85607ca46eSDavid Howells  */
86607ca46eSDavid Howells struct v4l2_subdev_frame_size_enum {
87607ca46eSDavid Howells 	__u32 index;
88607ca46eSDavid Howells 	__u32 pad;
89607ca46eSDavid Howells 	__u32 code;
90607ca46eSDavid Howells 	__u32 min_width;
91607ca46eSDavid Howells 	__u32 max_width;
92607ca46eSDavid Howells 	__u32 min_height;
93607ca46eSDavid Howells 	__u32 max_height;
94607ca46eSDavid Howells 	__u32 reserved[9];
95607ca46eSDavid Howells };
96607ca46eSDavid Howells 
97607ca46eSDavid Howells /**
98607ca46eSDavid Howells  * struct v4l2_subdev_frame_interval - Pad-level frame rate
99607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
100607ca46eSDavid Howells  * @interval: frame interval in seconds
101607ca46eSDavid Howells  */
102607ca46eSDavid Howells struct v4l2_subdev_frame_interval {
103607ca46eSDavid Howells 	__u32 pad;
104607ca46eSDavid Howells 	struct v4l2_fract interval;
105607ca46eSDavid Howells 	__u32 reserved[9];
106607ca46eSDavid Howells };
107607ca46eSDavid Howells 
108607ca46eSDavid Howells /**
109607ca46eSDavid Howells  * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
110607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
111607ca46eSDavid Howells  * @index: frame interval index during enumeration
112607ca46eSDavid Howells  * @code: format code (from enum v4l2_mbus_pixelcode)
113607ca46eSDavid Howells  * @width: frame width in pixels
114607ca46eSDavid Howells  * @height: frame height in pixels
115607ca46eSDavid Howells  * @interval: frame interval in seconds
116607ca46eSDavid Howells  */
117607ca46eSDavid Howells struct v4l2_subdev_frame_interval_enum {
118607ca46eSDavid Howells 	__u32 index;
119607ca46eSDavid Howells 	__u32 pad;
120607ca46eSDavid Howells 	__u32 code;
121607ca46eSDavid Howells 	__u32 width;
122607ca46eSDavid Howells 	__u32 height;
123607ca46eSDavid Howells 	struct v4l2_fract interval;
124607ca46eSDavid Howells 	__u32 reserved[9];
125607ca46eSDavid Howells };
126607ca46eSDavid Howells 
127607ca46eSDavid Howells /**
128607ca46eSDavid Howells  * struct v4l2_subdev_selection - selection info
129607ca46eSDavid Howells  *
130607ca46eSDavid Howells  * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
131607ca46eSDavid Howells  * @pad: pad number, as reported by the media API
132607ca46eSDavid Howells  * @target: Selection target, used to choose one of possible rectangles,
133607ca46eSDavid Howells  *	    defined in v4l2-common.h; V4L2_SEL_TGT_* .
134607ca46eSDavid Howells  * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
135607ca46eSDavid Howells  * @r: coordinates of the selection window
136607ca46eSDavid Howells  * @reserved: for future use, set to zero for now
137607ca46eSDavid Howells  *
138607ca46eSDavid Howells  * Hardware may use multiple helper windows to process a video stream.
139607ca46eSDavid Howells  * The structure is used to exchange this selection areas between
140607ca46eSDavid Howells  * an application and a driver.
141607ca46eSDavid Howells  */
142607ca46eSDavid Howells struct v4l2_subdev_selection {
143607ca46eSDavid Howells 	__u32 which;
144607ca46eSDavid Howells 	__u32 pad;
145607ca46eSDavid Howells 	__u32 target;
146607ca46eSDavid Howells 	__u32 flags;
147607ca46eSDavid Howells 	struct v4l2_rect r;
148607ca46eSDavid Howells 	__u32 reserved[8];
149607ca46eSDavid Howells };
150607ca46eSDavid Howells 
151254a4777SHans Verkuil /* Backwards compatibility define --- to be removed */
152254a4777SHans Verkuil #define v4l2_subdev_edid v4l2_edid
153607ca46eSDavid Howells 
154607ca46eSDavid Howells #define VIDIOC_SUBDEV_G_FMT			_IOWR('V',  4, struct v4l2_subdev_format)
155607ca46eSDavid Howells #define VIDIOC_SUBDEV_S_FMT			_IOWR('V',  5, struct v4l2_subdev_format)
156c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_G_FRAME_INTERVAL		_IOWR('V', 21, struct v4l2_subdev_frame_interval)
157c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_S_FRAME_INTERVAL		_IOWR('V', 22, struct v4l2_subdev_frame_interval)
158c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_ENUM_MBUS_CODE		_IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
159c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE		_IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
160c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL	_IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
161607ca46eSDavid Howells #define VIDIOC_SUBDEV_G_CROP			_IOWR('V', 59, struct v4l2_subdev_crop)
162607ca46eSDavid Howells #define VIDIOC_SUBDEV_S_CROP			_IOWR('V', 60, struct v4l2_subdev_crop)
163c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_G_SELECTION		_IOWR('V', 61, struct v4l2_subdev_selection)
164c4fa146cSLaurent Pinchart #define VIDIOC_SUBDEV_S_SELECTION		_IOWR('V', 62, struct v4l2_subdev_selection)
165*9cfd65e8SLaurent Pinchart /* The following ioctls are identical to the ioctls in videodev2.h */
166254a4777SHans Verkuil #define VIDIOC_SUBDEV_G_EDID			_IOWR('V', 40, struct v4l2_edid)
167254a4777SHans Verkuil #define VIDIOC_SUBDEV_S_EDID			_IOWR('V', 41, struct v4l2_edid)
168*9cfd65e8SLaurent Pinchart #define VIDIOC_SUBDEV_S_DV_TIMINGS		_IOWR('V', 87, struct v4l2_dv_timings)
169*9cfd65e8SLaurent Pinchart #define VIDIOC_SUBDEV_G_DV_TIMINGS		_IOWR('V', 88, struct v4l2_dv_timings)
170*9cfd65e8SLaurent Pinchart #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS		_IOWR('V', 98, struct v4l2_enum_dv_timings)
171*9cfd65e8SLaurent Pinchart #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS		_IOR('V', 99, struct v4l2_dv_timings)
172*9cfd65e8SLaurent Pinchart #define VIDIOC_SUBDEV_DV_TIMINGS_CAP		_IOWR('V', 100, struct v4l2_dv_timings_cap)
173607ca46eSDavid Howells 
174607ca46eSDavid Howells #endif
175