blob: c95a53e6743cb04084727dd8cdfc1befa3686667 [file] [log] [blame]
Greg Kroah-Hartmane2be04c2017-11-01 15:09:13 +01001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Laurent Pinchart333c8b92010-03-15 20:26:04 -03002/*
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 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef __LINUX_V4L2_SUBDEV_H
25#define __LINUX_V4L2_SUBDEV_H
26
27#include <linux/ioctl.h>
28#include <linux/types.h>
Sakari Ailus5689b282012-05-18 09:31:18 -030029#include <linux/v4l2-common.h>
Laurent Pinchart333c8b92010-03-15 20:26:04 -030030#include <linux/v4l2-mediabus.h>
31
32/**
33 * enum v4l2_subdev_format_whence - Media bus format type
34 * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
35 * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
36 */
37enum v4l2_subdev_format_whence {
38 V4L2_SUBDEV_FORMAT_TRY = 0,
39 V4L2_SUBDEV_FORMAT_ACTIVE = 1,
40};
41
42/**
43 * struct v4l2_subdev_format - Pad-level media bus format
44 * @which: format type (from enum v4l2_subdev_format_whence)
45 * @pad: pad number, as reported by the media API
46 * @format: media bus format (format code and frame size)
47 */
48struct v4l2_subdev_format {
49 __u32 which;
50 __u32 pad;
51 struct v4l2_mbus_framefmt format;
52 __u32 reserved[8];
53};
54
55/**
Antti Koskipaaf6a5cb12010-06-23 05:03:42 -030056 * struct v4l2_subdev_crop - Pad-level crop settings
57 * @which: format type (from enum v4l2_subdev_format_whence)
58 * @pad: pad number, as reported by the media API
59 * @rect: pad crop rectangle boundaries
60 */
61struct v4l2_subdev_crop {
62 __u32 which;
63 __u32 pad;
64 struct v4l2_rect rect;
65 __u32 reserved[8];
66};
67
68/**
Laurent Pinchart333c8b92010-03-15 20:26:04 -030069 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
70 * @pad: pad number, as reported by the media API
71 * @index: format index during enumeration
Boris BREZILLON32b32ce2014-11-10 14:28:28 -030072 * @code: format code (MEDIA_BUS_FMT_ definitions)
Hans Verkuile1c47e72015-03-04 01:47:55 -080073 * @which: format type (from enum v4l2_subdev_format_whence)
Laurent Pinchart333c8b92010-03-15 20:26:04 -030074 */
75struct v4l2_subdev_mbus_code_enum {
76 __u32 pad;
77 __u32 index;
78 __u32 code;
Hans Verkuile1c47e72015-03-04 01:47:55 -080079 __u32 which;
80 __u32 reserved[8];
Laurent Pinchart333c8b92010-03-15 20:26:04 -030081};
82
83/**
84 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
85 * @pad: pad number, as reported by the media API
86 * @index: format index during enumeration
Boris BREZILLON32b32ce2014-11-10 14:28:28 -030087 * @code: format code (MEDIA_BUS_FMT_ definitions)
Hans Verkuile1c47e72015-03-04 01:47:55 -080088 * @which: format type (from enum v4l2_subdev_format_whence)
Laurent Pinchart333c8b92010-03-15 20:26:04 -030089 */
90struct v4l2_subdev_frame_size_enum {
91 __u32 index;
92 __u32 pad;
93 __u32 code;
94 __u32 min_width;
95 __u32 max_width;
96 __u32 min_height;
97 __u32 max_height;
Hans Verkuile1c47e72015-03-04 01:47:55 -080098 __u32 which;
99 __u32 reserved[8];
Laurent Pinchart333c8b92010-03-15 20:26:04 -0300100};
101
Laurent Pinchart35c30172010-05-05 11:38:35 -0300102/**
103 * struct v4l2_subdev_frame_interval - Pad-level frame rate
104 * @pad: pad number, as reported by the media API
105 * @interval: frame interval in seconds
106 */
107struct v4l2_subdev_frame_interval {
108 __u32 pad;
109 struct v4l2_fract interval;
110 __u32 reserved[9];
111};
112
113/**
114 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
115 * @pad: pad number, as reported by the media API
116 * @index: frame interval index during enumeration
Boris BREZILLON32b32ce2014-11-10 14:28:28 -0300117 * @code: format code (MEDIA_BUS_FMT_ definitions)
Laurent Pinchart35c30172010-05-05 11:38:35 -0300118 * @width: frame width in pixels
119 * @height: frame height in pixels
120 * @interval: frame interval in seconds
Hans Verkuile1c47e72015-03-04 01:47:55 -0800121 * @which: format type (from enum v4l2_subdev_format_whence)
Laurent Pinchart35c30172010-05-05 11:38:35 -0300122 */
123struct v4l2_subdev_frame_interval_enum {
124 __u32 index;
125 __u32 pad;
126 __u32 code;
127 __u32 width;
128 __u32 height;
129 struct v4l2_fract interval;
Hans Verkuile1c47e72015-03-04 01:47:55 -0800130 __u32 which;
131 __u32 reserved[8];
Laurent Pinchart35c30172010-05-05 11:38:35 -0300132};
133
Sakari Ailusae184cd2011-10-14 14:14:26 -0300134/**
135 * struct v4l2_subdev_selection - selection info
136 *
137 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
138 * @pad: pad number, as reported by the media API
Sakari Ailus5689b282012-05-18 09:31:18 -0300139 * @target: Selection target, used to choose one of possible rectangles,
140 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
Sakari Ailus563df3d2012-06-13 16:01:10 -0300141 * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
Sakari Ailusae184cd2011-10-14 14:14:26 -0300142 * @r: coordinates of the selection window
143 * @reserved: for future use, set to zero for now
144 *
145 * Hardware may use multiple helper windows to process a video stream.
146 * The structure is used to exchange this selection areas between
147 * an application and a driver.
148 */
149struct v4l2_subdev_selection {
150 __u32 which;
151 __u32 pad;
152 __u32 target;
153 __u32 flags;
154 struct v4l2_rect r;
155 __u32 reserved[8];
156};
157
Hans Verkuil254a4772014-03-04 07:46:47 -0300158/* Backwards compatibility define --- to be removed */
159#define v4l2_subdev_edid v4l2_edid
Hans Verkuil777f4f82012-07-05 10:58:06 -0300160
Laurent Pinchartc4fa1462014-01-29 10:06:13 -0300161#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
162#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
163#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
164#define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval)
165#define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
166#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
167#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
168#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
169#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
170#define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection)
171#define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection)
Laurent Pinchart9cfd65e2014-01-29 10:07:13 -0300172/* The following ioctls are identical to the ioctls in videodev2.h */
Laurent Pinchartc4fa1462014-01-29 10:06:13 -0300173#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
174#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
Laurent Pinchart9cfd65e2014-01-29 10:07:13 -0300175#define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
176#define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
177#define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
178#define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
179#define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
Laurent Pinchart333c8b92010-03-15 20:26:04 -0300180
181#endif