Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * V4L2 subdev userspace API
0004  *
0005  * Copyright (C) 2010 Nokia Corporation
0006  *
0007  * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
0008  *       Sakari Ailus <sakari.ailus@iki.fi>
0009  *
0010  * This program is free software; you can redistribute it and/or modify
0011  * it under the terms of the GNU General Public License version 2 as
0012  * published by the Free Software Foundation.
0013  *
0014  * This program is distributed in the hope that it will be useful,
0015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  * GNU General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU General Public License
0020  * along with this program; if not, write to the Free Software
0021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0022  */
0023 
0024 #ifndef __LINUX_V4L2_SUBDEV_H
0025 #define __LINUX_V4L2_SUBDEV_H
0026 
0027 #include <linux/ioctl.h>
0028 #include <linux/types.h>
0029 #include <linux/v4l2-common.h>
0030 #include <linux/v4l2-mediabus.h>
0031 
0032 /**
0033  * enum v4l2_subdev_format_whence - Media bus format type
0034  * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
0035  * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
0036  */
0037 enum v4l2_subdev_format_whence {
0038     V4L2_SUBDEV_FORMAT_TRY = 0,
0039     V4L2_SUBDEV_FORMAT_ACTIVE = 1,
0040 };
0041 
0042 /**
0043  * struct v4l2_subdev_format - Pad-level media bus format
0044  * @which: format type (from enum v4l2_subdev_format_whence)
0045  * @pad: pad number, as reported by the media API
0046  * @format: media bus format (format code and frame size)
0047  * @reserved: drivers and applications must zero this array
0048  */
0049 struct v4l2_subdev_format {
0050     __u32 which;
0051     __u32 pad;
0052     struct v4l2_mbus_framefmt format;
0053     __u32 reserved[8];
0054 };
0055 
0056 /**
0057  * struct v4l2_subdev_crop - Pad-level crop settings
0058  * @which: format type (from enum v4l2_subdev_format_whence)
0059  * @pad: pad number, as reported by the media API
0060  * @rect: pad crop rectangle boundaries
0061  * @reserved: drivers and applications must zero this array
0062  */
0063 struct v4l2_subdev_crop {
0064     __u32 which;
0065     __u32 pad;
0066     struct v4l2_rect rect;
0067     __u32 reserved[8];
0068 };
0069 
0070 #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE    0x00000001
0071 #define V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC 0x00000002
0072 #define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC 0x00000004
0073 #define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC   V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
0074 #define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION  0x00000008
0075 
0076 /**
0077  * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
0078  * @pad: pad number, as reported by the media API
0079  * @index: format index during enumeration
0080  * @code: format code (MEDIA_BUS_FMT_ definitions)
0081  * @which: format type (from enum v4l2_subdev_format_whence)
0082  * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*)
0083  * @reserved: drivers and applications must zero this array
0084  */
0085 struct v4l2_subdev_mbus_code_enum {
0086     __u32 pad;
0087     __u32 index;
0088     __u32 code;
0089     __u32 which;
0090     __u32 flags;
0091     __u32 reserved[7];
0092 };
0093 
0094 /**
0095  * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
0096  * @index: format index during enumeration
0097  * @pad: pad number, as reported by the media API
0098  * @code: format code (MEDIA_BUS_FMT_ definitions)
0099  * @min_width: minimum frame width, in pixels
0100  * @max_width: maximum frame width, in pixels
0101  * @min_height: minimum frame height, in pixels
0102  * @max_height: maximum frame height, in pixels
0103  * @which: format type (from enum v4l2_subdev_format_whence)
0104  * @reserved: drivers and applications must zero this array
0105  */
0106 struct v4l2_subdev_frame_size_enum {
0107     __u32 index;
0108     __u32 pad;
0109     __u32 code;
0110     __u32 min_width;
0111     __u32 max_width;
0112     __u32 min_height;
0113     __u32 max_height;
0114     __u32 which;
0115     __u32 reserved[8];
0116 };
0117 
0118 /**
0119  * struct v4l2_subdev_frame_interval - Pad-level frame rate
0120  * @pad: pad number, as reported by the media API
0121  * @interval: frame interval in seconds
0122  * @reserved: drivers and applications must zero this array
0123  */
0124 struct v4l2_subdev_frame_interval {
0125     __u32 pad;
0126     struct v4l2_fract interval;
0127     __u32 reserved[9];
0128 };
0129 
0130 /**
0131  * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
0132  * @pad: pad number, as reported by the media API
0133  * @index: frame interval index during enumeration
0134  * @code: format code (MEDIA_BUS_FMT_ definitions)
0135  * @width: frame width in pixels
0136  * @height: frame height in pixels
0137  * @interval: frame interval in seconds
0138  * @which: format type (from enum v4l2_subdev_format_whence)
0139  * @reserved: drivers and applications must zero this array
0140  */
0141 struct v4l2_subdev_frame_interval_enum {
0142     __u32 index;
0143     __u32 pad;
0144     __u32 code;
0145     __u32 width;
0146     __u32 height;
0147     struct v4l2_fract interval;
0148     __u32 which;
0149     __u32 reserved[8];
0150 };
0151 
0152 /**
0153  * struct v4l2_subdev_selection - selection info
0154  *
0155  * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
0156  * @pad: pad number, as reported by the media API
0157  * @target: Selection target, used to choose one of possible rectangles,
0158  *      defined in v4l2-common.h; V4L2_SEL_TGT_* .
0159  * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
0160  * @r: coordinates of the selection window
0161  * @reserved: for future use, set to zero for now
0162  *
0163  * Hardware may use multiple helper windows to process a video stream.
0164  * The structure is used to exchange this selection areas between
0165  * an application and a driver.
0166  */
0167 struct v4l2_subdev_selection {
0168     __u32 which;
0169     __u32 pad;
0170     __u32 target;
0171     __u32 flags;
0172     struct v4l2_rect r;
0173     __u32 reserved[8];
0174 };
0175 
0176 /**
0177  * struct v4l2_subdev_capability - subdev capabilities
0178  * @version: the driver versioning number
0179  * @capabilities: the subdev capabilities, see V4L2_SUBDEV_CAP_*
0180  * @reserved: for future use, set to zero for now
0181  */
0182 struct v4l2_subdev_capability {
0183     __u32 version;
0184     __u32 capabilities;
0185     __u32 reserved[14];
0186 };
0187 
0188 /* The v4l2 sub-device video device node is registered in read-only mode. */
0189 #define V4L2_SUBDEV_CAP_RO_SUBDEV       0x00000001
0190 
0191 /* Backwards compatibility define --- to be removed */
0192 #define v4l2_subdev_edid v4l2_edid
0193 
0194 #define VIDIOC_SUBDEV_QUERYCAP          _IOR('V',  0, struct v4l2_subdev_capability)
0195 #define VIDIOC_SUBDEV_G_FMT         _IOWR('V',  4, struct v4l2_subdev_format)
0196 #define VIDIOC_SUBDEV_S_FMT         _IOWR('V',  5, struct v4l2_subdev_format)
0197 #define VIDIOC_SUBDEV_G_FRAME_INTERVAL      _IOWR('V', 21, struct v4l2_subdev_frame_interval)
0198 #define VIDIOC_SUBDEV_S_FRAME_INTERVAL      _IOWR('V', 22, struct v4l2_subdev_frame_interval)
0199 #define VIDIOC_SUBDEV_ENUM_MBUS_CODE        _IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
0200 #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE       _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
0201 #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL   _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
0202 #define VIDIOC_SUBDEV_G_CROP            _IOWR('V', 59, struct v4l2_subdev_crop)
0203 #define VIDIOC_SUBDEV_S_CROP            _IOWR('V', 60, struct v4l2_subdev_crop)
0204 #define VIDIOC_SUBDEV_G_SELECTION       _IOWR('V', 61, struct v4l2_subdev_selection)
0205 #define VIDIOC_SUBDEV_S_SELECTION       _IOWR('V', 62, struct v4l2_subdev_selection)
0206 /* The following ioctls are identical to the ioctls in videodev2.h */
0207 #define VIDIOC_SUBDEV_G_STD         _IOR('V', 23, v4l2_std_id)
0208 #define VIDIOC_SUBDEV_S_STD         _IOW('V', 24, v4l2_std_id)
0209 #define VIDIOC_SUBDEV_ENUMSTD           _IOWR('V', 25, struct v4l2_standard)
0210 #define VIDIOC_SUBDEV_G_EDID            _IOWR('V', 40, struct v4l2_edid)
0211 #define VIDIOC_SUBDEV_S_EDID            _IOWR('V', 41, struct v4l2_edid)
0212 #define VIDIOC_SUBDEV_QUERYSTD          _IOR('V', 63, v4l2_std_id)
0213 #define VIDIOC_SUBDEV_S_DV_TIMINGS      _IOWR('V', 87, struct v4l2_dv_timings)
0214 #define VIDIOC_SUBDEV_G_DV_TIMINGS      _IOWR('V', 88, struct v4l2_dv_timings)
0215 #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS       _IOWR('V', 98, struct v4l2_enum_dv_timings)
0216 #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS      _IOR('V', 99, struct v4l2_dv_timings)
0217 #define VIDIOC_SUBDEV_DV_TIMINGS_CAP        _IOWR('V', 100, struct v4l2_dv_timings_cap)
0218 
0219 #endif