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