xref: /openbmc/linux/include/uapi/linux/v4l2-common.h (revision 69fad28c)
1 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
2 /*
3  * include/linux/v4l2-common.h
4  *
5  * Common V4L2 and V4L2 subdev definitions.
6  *
7  * Users are advised to #include this file either through videodev2.h
8  * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer
9  * to this file directly.
10  *
11  * Copyright (C) 2012 Nokia Corporation
12  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
13  *
14  *  This program is free software; you can redistribute it and/or modify
15  *  it under the terms of the GNU General Public License as published by
16  *  the Free Software Foundation; either version 2 of the License, or
17  *  (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  Alternatively you can redistribute this file under the terms of the
25  *  BSD license as stated below:
26  *
27  *  Redistribution and use in source and binary forms, with or without
28  *  modification, are permitted provided that the following conditions
29  *  are met:
30  *  1. Redistributions of source code must retain the above copyright
31  *     notice, this list of conditions and the following disclaimer.
32  *  2. Redistributions in binary form must reproduce the above copyright
33  *     notice, this list of conditions and the following disclaimer in
34  *     the documentation and/or other materials provided with the
35  *     distribution.
36  *  3. The names of its contributors may not be used to endorse or promote
37  *     products derived from this software without specific prior written
38  *     permission.
39  *
40  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
46  *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47  *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51  *
52  */
53 
54 #ifndef __V4L2_COMMON__
55 #define __V4L2_COMMON__
56 
57 #include <linux/types.h>
58 
59 /*
60  *
61  * Selection interface definitions
62  *
63  */
64 
65 /* Current cropping area */
66 #define V4L2_SEL_TGT_CROP		0x0000
67 /* Default cropping area */
68 #define V4L2_SEL_TGT_CROP_DEFAULT	0x0001
69 /* Cropping bounds */
70 #define V4L2_SEL_TGT_CROP_BOUNDS	0x0002
71 /* Native frame size */
72 #define V4L2_SEL_TGT_NATIVE_SIZE	0x0003
73 /* Current composing area */
74 #define V4L2_SEL_TGT_COMPOSE		0x0100
75 /* Default composing area */
76 #define V4L2_SEL_TGT_COMPOSE_DEFAULT	0x0101
77 /* Composing bounds */
78 #define V4L2_SEL_TGT_COMPOSE_BOUNDS	0x0102
79 /* Current composing area plus all padding pixels */
80 #define V4L2_SEL_TGT_COMPOSE_PADDED	0x0103
81 
82 /* Selection flags */
83 #define V4L2_SEL_FLAG_GE		(1 << 0)
84 #define V4L2_SEL_FLAG_LE		(1 << 1)
85 #define V4L2_SEL_FLAG_KEEP_CONFIG	(1 << 2)
86 
87 struct v4l2_edid {
88 	__u32 pad;
89 	__u32 start_block;
90 	__u32 blocks;
91 	__u32 reserved[5];
92 	__u8  *edid;
93 };
94 
95 #ifndef __KERNEL__
96 /* Backward compatibility target definitions --- to be removed. */
97 #define V4L2_SEL_TGT_CROP_ACTIVE	V4L2_SEL_TGT_CROP
98 #define V4L2_SEL_TGT_COMPOSE_ACTIVE	V4L2_SEL_TGT_COMPOSE
99 #define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL	V4L2_SEL_TGT_CROP
100 #define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
101 #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS	V4L2_SEL_TGT_CROP_BOUNDS
102 #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
103 
104 /* Backward compatibility flag definitions --- to be removed. */
105 #define V4L2_SUBDEV_SEL_FLAG_SIZE_GE	V4L2_SEL_FLAG_GE
106 #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE	V4L2_SEL_FLAG_LE
107 #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
108 #endif
109 
110 #endif /* __V4L2_COMMON__ */
111