xref: /openbmc/linux/include/uapi/linux/am437x-vpfe.h (revision e2be04c7)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright (C) 2013 - 2014 Texas Instruments, Inc.
4  *
5  * Benoit Parrot <bparrot@ti.com>
6  * Lad, Prabhakar <prabhakar.csengg@gmail.com>
7  *
8  * This program is free software; you may redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
16  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
17  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19  * SOFTWARE.
20  */
21 
22 #ifndef AM437X_VPFE_USER_H
23 #define AM437X_VPFE_USER_H
24 
25 #include <linux/videodev2.h>
26 
27 enum vpfe_ccdc_data_size {
28 	VPFE_CCDC_DATA_16BITS = 0,
29 	VPFE_CCDC_DATA_15BITS,
30 	VPFE_CCDC_DATA_14BITS,
31 	VPFE_CCDC_DATA_13BITS,
32 	VPFE_CCDC_DATA_12BITS,
33 	VPFE_CCDC_DATA_11BITS,
34 	VPFE_CCDC_DATA_10BITS,
35 	VPFE_CCDC_DATA_8BITS,
36 };
37 
38 /* enum for No of pixel per line to be avg. in Black Clamping*/
39 enum vpfe_ccdc_sample_length {
40 	VPFE_CCDC_SAMPLE_1PIXELS = 0,
41 	VPFE_CCDC_SAMPLE_2PIXELS,
42 	VPFE_CCDC_SAMPLE_4PIXELS,
43 	VPFE_CCDC_SAMPLE_8PIXELS,
44 	VPFE_CCDC_SAMPLE_16PIXELS,
45 };
46 
47 /* enum for No of lines in Black Clamping */
48 enum vpfe_ccdc_sample_line {
49 	VPFE_CCDC_SAMPLE_1LINES = 0,
50 	VPFE_CCDC_SAMPLE_2LINES,
51 	VPFE_CCDC_SAMPLE_4LINES,
52 	VPFE_CCDC_SAMPLE_8LINES,
53 	VPFE_CCDC_SAMPLE_16LINES,
54 };
55 
56 /* enum for Alaw gamma width */
57 enum vpfe_ccdc_gamma_width {
58 	VPFE_CCDC_GAMMA_BITS_15_6 = 0,	/* use bits 15-6 for gamma */
59 	VPFE_CCDC_GAMMA_BITS_14_5,
60 	VPFE_CCDC_GAMMA_BITS_13_4,
61 	VPFE_CCDC_GAMMA_BITS_12_3,
62 	VPFE_CCDC_GAMMA_BITS_11_2,
63 	VPFE_CCDC_GAMMA_BITS_10_1,
64 	VPFE_CCDC_GAMMA_BITS_09_0,	/* use bits 9-0 for gamma */
65 };
66 
67 /* structure for ALaw */
68 struct vpfe_ccdc_a_law {
69 	/* Enable/disable A-Law */
70 	unsigned char enable;
71 	/* Gamma Width Input */
72 	enum vpfe_ccdc_gamma_width gamma_wd;
73 };
74 
75 /* structure for Black Clamping */
76 struct vpfe_ccdc_black_clamp {
77 	unsigned char enable;
78 	/* only if bClampEnable is TRUE */
79 	enum vpfe_ccdc_sample_length sample_pixel;
80 	/* only if bClampEnable is TRUE */
81 	enum vpfe_ccdc_sample_line sample_ln;
82 	/* only if bClampEnable is TRUE */
83 	unsigned short start_pixel;
84 	/* only if bClampEnable is TRUE */
85 	unsigned short sgain;
86 	/* only if bClampEnable is FALSE */
87 	unsigned short dc_sub;
88 };
89 
90 /* structure for Black Level Compensation */
91 struct vpfe_ccdc_black_compensation {
92 	/* Constant value to subtract from Red component */
93 	char r;
94 	/* Constant value to subtract from Gr component */
95 	char gr;
96 	/* Constant value to subtract from Blue component */
97 	char b;
98 	/* Constant value to subtract from Gb component */
99 	char gb;
100 };
101 
102 /* Structure for CCDC configuration parameters for raw capture mode passed
103  * by application
104  */
105 struct vpfe_ccdc_config_params_raw {
106 	/* data size value from 8 to 16 bits */
107 	enum vpfe_ccdc_data_size data_sz;
108 	/* Structure for Optional A-Law */
109 	struct vpfe_ccdc_a_law alaw;
110 	/* Structure for Optical Black Clamp */
111 	struct vpfe_ccdc_black_clamp blk_clamp;
112 	/* Structure for Black Compensation */
113 	struct vpfe_ccdc_black_compensation blk_comp;
114 };
115 
116 /*
117  *  Private IOCTL
118  * VIDIOC_AM437X_CCDC_CFG - Set CCDC configuration for raw capture
119  * This is an experimental ioctl that will change in future kernels. So use
120  * this ioctl with care !
121  **/
122 #define VIDIOC_AM437X_CCDC_CFG \
123 	_IOW('V', BASE_VIDIOC_PRIVATE + 1, void *)
124 
125 #endif		/* AM437X_VPFE_USER_H */
126