• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #ifndef __LINUX_V4L2_SUBDEV_H
12 #define __LINUX_V4L2_SUBDEV_H
13 
14 #include <linux/ioctl.h>
15 #include <linux/types.h>
16 #include <linux/v4l2-common.h>
17 #include <linux/v4l2-mediabus.h>
18 
19 /**
20  * enum v4l2_subdev_format_whence - Media bus format type
21  * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
22  * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
23  */
24 enum v4l2_subdev_format_whence {
25 	V4L2_SUBDEV_FORMAT_TRY = 0,
26 	V4L2_SUBDEV_FORMAT_ACTIVE = 1,
27 };
28 
29 /**
30  * struct v4l2_subdev_format - Pad-level media bus format
31  * @which: format type (from enum v4l2_subdev_format_whence)
32  * @pad: pad number, as reported by the media API
33  * @format: media bus format (format code and frame size)
34  * @reserved: drivers and applications must zero this array
35  */
36 struct v4l2_subdev_format {
37 	__u32 which;
38 	__u32 pad;
39 	struct v4l2_mbus_framefmt format;
40 	__u32 reserved[8];
41 };
42 
43 /**
44  * struct v4l2_subdev_crop - Pad-level crop settings
45  * @which: format type (from enum v4l2_subdev_format_whence)
46  * @pad: pad number, as reported by the media API
47  * @rect: pad crop rectangle boundaries
48  * @reserved: drivers and applications must zero this array
49  */
50 struct v4l2_subdev_crop {
51 	__u32 which;
52 	__u32 pad;
53 	struct v4l2_rect rect;
54 	__u32 reserved[8];
55 };
56 
57 #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE	0x00000001
58 #define V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC	0x00000002
59 #define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC	0x00000004
60 #define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC	V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
61 #define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION	0x00000008
62 
63 /**
64  * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
65  * @pad: pad number, as reported by the media API
66  * @index: format index during enumeration
67  * @code: format code (MEDIA_BUS_FMT_ definitions)
68  * @which: format type (from enum v4l2_subdev_format_whence)
69  * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*)
70  * @reserved: drivers and applications must zero this array
71  */
72 struct v4l2_subdev_mbus_code_enum {
73 	__u32 pad;
74 	__u32 index;
75 	__u32 code;
76 	__u32 which;
77 	__u32 flags;
78 	__u32 reserved[7];
79 };
80 
81 /**
82  * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
83  * @index: format index during enumeration
84  * @pad: pad number, as reported by the media API
85  * @code: format code (MEDIA_BUS_FMT_ definitions)
86  * @min_width: minimum frame width, in pixels
87  * @max_width: maximum frame width, in pixels
88  * @min_height: minimum frame height, in pixels
89  * @max_height: maximum frame height, in pixels
90  * @which: format type (from enum v4l2_subdev_format_whence)
91  * @reserved: drivers and applications must zero this array
92  */
93 struct v4l2_subdev_frame_size_enum {
94 	__u32 index;
95 	__u32 pad;
96 	__u32 code;
97 	__u32 min_width;
98 	__u32 max_width;
99 	__u32 min_height;
100 	__u32 max_height;
101 	__u32 which;
102 	__u32 reserved[8];
103 };
104 
105 /**
106  * struct v4l2_subdev_frame_interval - Pad-level frame rate
107  * @pad: pad number, as reported by the media API
108  * @interval: frame interval in seconds
109  * @reserved: drivers and applications must zero this array
110  */
111 struct v4l2_subdev_frame_interval {
112 	__u32 pad;
113 	struct v4l2_fract interval;
114 	__u32 reserved[9];
115 };
116 
117 /**
118  * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
119  * @pad: pad number, as reported by the media API
120  * @index: frame interval index during enumeration
121  * @code: format code (MEDIA_BUS_FMT_ definitions)
122  * @width: frame width in pixels
123  * @height: frame height in pixels
124  * @interval: frame interval in seconds
125  * @which: format type (from enum v4l2_subdev_format_whence)
126  * @reserved: drivers and applications must zero this array
127  */
128 struct v4l2_subdev_frame_interval_enum {
129 	__u32 index;
130 	__u32 pad;
131 	__u32 code;
132 	__u32 width;
133 	__u32 height;
134 	struct v4l2_fract interval;
135 	__u32 which;
136 	__u32 reserved[8];
137 };
138 
139 /**
140  * struct v4l2_subdev_selection - selection info
141  *
142  * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
143  * @pad: pad number, as reported by the media API
144  * @target: Selection target, used to choose one of possible rectangles,
145  *	    defined in v4l2-common.h; V4L2_SEL_TGT_* .
146  * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
147  * @r: coordinates of the selection window
148  * @reserved: for future use, set to zero for now
149  *
150  * Hardware may use multiple helper windows to process a video stream.
151  * The structure is used to exchange this selection areas between
152  * an application and a driver.
153  */
154 struct v4l2_subdev_selection {
155 	__u32 which;
156 	__u32 pad;
157 	__u32 target;
158 	__u32 flags;
159 	struct v4l2_rect r;
160 	__u32 reserved[8];
161 };
162 
163 /**
164  * struct v4l2_subdev_capability - subdev capabilities
165  * @version: the driver versioning number
166  * @capabilities: the subdev capabilities, see V4L2_SUBDEV_CAP_*
167  * @reserved: for future use, set to zero for now
168  */
169 struct v4l2_subdev_capability {
170 	__u32 version;
171 	__u32 capabilities;
172 	__u32 reserved[14];
173 };
174 
175 /* The v4l2 sub-device video device node is registered in read-only mode. */
176 #define V4L2_SUBDEV_CAP_RO_SUBDEV		0x00000001
177 
178 /* Backwards compatibility define --- to be removed */
179 #define v4l2_subdev_edid v4l2_edid
180 
181 #define VIDIOC_SUBDEV_QUERYCAP			_IOR('V',  0, struct v4l2_subdev_capability)
182 #define VIDIOC_SUBDEV_G_FMT			_IOWR('V',  4, struct v4l2_subdev_format)
183 #define VIDIOC_SUBDEV_S_FMT			_IOWR('V',  5, struct v4l2_subdev_format)
184 #define VIDIOC_SUBDEV_G_FRAME_INTERVAL		_IOWR('V', 21, struct v4l2_subdev_frame_interval)
185 #define VIDIOC_SUBDEV_S_FRAME_INTERVAL		_IOWR('V', 22, struct v4l2_subdev_frame_interval)
186 #define VIDIOC_SUBDEV_ENUM_MBUS_CODE		_IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
187 #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE		_IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
188 #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL	_IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
189 #define VIDIOC_SUBDEV_G_CROP			_IOWR('V', 59, struct v4l2_subdev_crop)
190 #define VIDIOC_SUBDEV_S_CROP			_IOWR('V', 60, struct v4l2_subdev_crop)
191 #define VIDIOC_SUBDEV_G_SELECTION		_IOWR('V', 61, struct v4l2_subdev_selection)
192 #define VIDIOC_SUBDEV_S_SELECTION		_IOWR('V', 62, struct v4l2_subdev_selection)
193 /* The following ioctls are identical to the ioctls in videodev2.h */
194 #define VIDIOC_SUBDEV_G_STD			_IOR('V', 23, v4l2_std_id)
195 #define VIDIOC_SUBDEV_S_STD			_IOW('V', 24, v4l2_std_id)
196 #define VIDIOC_SUBDEV_ENUMSTD			_IOWR('V', 25, struct v4l2_standard)
197 #define VIDIOC_SUBDEV_G_EDID			_IOWR('V', 40, struct v4l2_edid)
198 #define VIDIOC_SUBDEV_S_EDID			_IOWR('V', 41, struct v4l2_edid)
199 #define VIDIOC_SUBDEV_QUERYSTD			_IOR('V', 63, v4l2_std_id)
200 #define VIDIOC_SUBDEV_S_DV_TIMINGS		_IOWR('V', 87, struct v4l2_dv_timings)
201 #define VIDIOC_SUBDEV_G_DV_TIMINGS		_IOWR('V', 88, struct v4l2_dv_timings)
202 #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS		_IOWR('V', 98, struct v4l2_enum_dv_timings)
203 #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS		_IOR('V', 99, struct v4l2_dv_timings)
204 #define VIDIOC_SUBDEV_DV_TIMINGS_CAP		_IOWR('V', 100, struct v4l2_dv_timings_cap)
205 
206 #endif
207