1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * V4L2 subdev userspace API
5 * Copyright (C) 2010 Nokia Corporation
11 #ifndef __LINUX_V4L2_SUBDEV_H
12 #define __LINUX_V4L2_SUBDEV_H
14 #include <linux/ioctl.h>
15 #include <linux/types.h>
16 #include <linux/v4l2-common.h>
17 #include <linux/v4l2-mediabus.h>
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
24 enum v4l2_subdev_format_whence {
25 V4L2_SUBDEV_FORMAT_TRY = 0,
26 V4L2_SUBDEV_FORMAT_ACTIVE = 1,
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
36 struct v4l2_subdev_format {
39 struct v4l2_mbus_framefmt format;
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
50 struct v4l2_subdev_crop {
53 struct v4l2_rect rect;
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
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
72 struct v4l2_subdev_mbus_code_enum {
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
93 struct v4l2_subdev_frame_size_enum {
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
111 struct v4l2_subdev_frame_interval {
113 struct v4l2_fract interval;
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
128 struct v4l2_subdev_frame_interval_enum {
134 struct v4l2_fract interval;
140 * struct v4l2_subdev_selection - selection info
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
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.
154 struct v4l2_subdev_selection {
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
169 struct v4l2_subdev_capability {
175 /* The v4l2 sub-device video device node is registered in read-only mode. */
176 #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001
178 /* Backwards compatibility define --- to be removed */
179 #define v4l2_subdev_edid v4l2_edid
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)