xref: /linux/include/uapi/linux/am437x-vpfe.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2417d2e50SBenoit Parrot /*
3417d2e50SBenoit Parrot  * Copyright (C) 2013 - 2014 Texas Instruments, Inc.
4417d2e50SBenoit Parrot  *
5417d2e50SBenoit Parrot  * Benoit Parrot <bparrot@ti.com>
6417d2e50SBenoit Parrot  * Lad, Prabhakar <prabhakar.csengg@gmail.com>
7417d2e50SBenoit Parrot  *
8417d2e50SBenoit Parrot  * This program is free software; you may redistribute it and/or modify
9417d2e50SBenoit Parrot  * it under the terms of the GNU General Public License as published by
10417d2e50SBenoit Parrot  * the Free Software Foundation; version 2 of the License.
11417d2e50SBenoit Parrot  *
12417d2e50SBenoit Parrot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13417d2e50SBenoit Parrot  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14417d2e50SBenoit Parrot  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15417d2e50SBenoit Parrot  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
16417d2e50SBenoit Parrot  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
17417d2e50SBenoit Parrot  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18417d2e50SBenoit Parrot  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19417d2e50SBenoit Parrot  * SOFTWARE.
20417d2e50SBenoit Parrot  */
21417d2e50SBenoit Parrot 
22417d2e50SBenoit Parrot #ifndef AM437X_VPFE_USER_H
23417d2e50SBenoit Parrot #define AM437X_VPFE_USER_H
24417d2e50SBenoit Parrot 
2564bf8049SMasatake YAMATO #include <linux/videodev2.h>
2664bf8049SMasatake YAMATO 
27417d2e50SBenoit Parrot enum vpfe_ccdc_data_size {
28417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_16BITS = 0,
29417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_15BITS,
30417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_14BITS,
31417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_13BITS,
32417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_12BITS,
33417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_11BITS,
34417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_10BITS,
35417d2e50SBenoit Parrot 	VPFE_CCDC_DATA_8BITS,
36417d2e50SBenoit Parrot };
37417d2e50SBenoit Parrot 
38417d2e50SBenoit Parrot /* enum for No of pixel per line to be avg. in Black Clamping*/
39417d2e50SBenoit Parrot enum vpfe_ccdc_sample_length {
40417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_1PIXELS = 0,
41417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_2PIXELS,
42417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_4PIXELS,
43417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_8PIXELS,
44417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_16PIXELS,
45417d2e50SBenoit Parrot };
46417d2e50SBenoit Parrot 
47417d2e50SBenoit Parrot /* enum for No of lines in Black Clamping */
48417d2e50SBenoit Parrot enum vpfe_ccdc_sample_line {
49417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_1LINES = 0,
50417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_2LINES,
51417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_4LINES,
52417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_8LINES,
53417d2e50SBenoit Parrot 	VPFE_CCDC_SAMPLE_16LINES,
54417d2e50SBenoit Parrot };
55417d2e50SBenoit Parrot 
56417d2e50SBenoit Parrot /* enum for Alaw gamma width */
57417d2e50SBenoit Parrot enum vpfe_ccdc_gamma_width {
58417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_15_6 = 0,	/* use bits 15-6 for gamma */
59417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_14_5,
60417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_13_4,
61417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_12_3,
62417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_11_2,
63417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_10_1,
64417d2e50SBenoit Parrot 	VPFE_CCDC_GAMMA_BITS_09_0,	/* use bits 9-0 for gamma */
65417d2e50SBenoit Parrot };
66417d2e50SBenoit Parrot 
67417d2e50SBenoit Parrot /* structure for ALaw */
68417d2e50SBenoit Parrot struct vpfe_ccdc_a_law {
69417d2e50SBenoit Parrot 	/* Enable/disable A-Law */
70417d2e50SBenoit Parrot 	unsigned char enable;
71417d2e50SBenoit Parrot 	/* Gamma Width Input */
72417d2e50SBenoit Parrot 	enum vpfe_ccdc_gamma_width gamma_wd;
73417d2e50SBenoit Parrot };
74417d2e50SBenoit Parrot 
75417d2e50SBenoit Parrot /* structure for Black Clamping */
76417d2e50SBenoit Parrot struct vpfe_ccdc_black_clamp {
77417d2e50SBenoit Parrot 	unsigned char enable;
78417d2e50SBenoit Parrot 	/* only if bClampEnable is TRUE */
79417d2e50SBenoit Parrot 	enum vpfe_ccdc_sample_length sample_pixel;
80417d2e50SBenoit Parrot 	/* only if bClampEnable is TRUE */
81417d2e50SBenoit Parrot 	enum vpfe_ccdc_sample_line sample_ln;
82417d2e50SBenoit Parrot 	/* only if bClampEnable is TRUE */
83417d2e50SBenoit Parrot 	unsigned short start_pixel;
84417d2e50SBenoit Parrot 	/* only if bClampEnable is TRUE */
85417d2e50SBenoit Parrot 	unsigned short sgain;
86417d2e50SBenoit Parrot 	/* only if bClampEnable is FALSE */
87417d2e50SBenoit Parrot 	unsigned short dc_sub;
88417d2e50SBenoit Parrot };
89417d2e50SBenoit Parrot 
90417d2e50SBenoit Parrot /* structure for Black Level Compensation */
91417d2e50SBenoit Parrot struct vpfe_ccdc_black_compensation {
92417d2e50SBenoit Parrot 	/* Constant value to subtract from Red component */
93417d2e50SBenoit Parrot 	char r;
94417d2e50SBenoit Parrot 	/* Constant value to subtract from Gr component */
95417d2e50SBenoit Parrot 	char gr;
96417d2e50SBenoit Parrot 	/* Constant value to subtract from Blue component */
97417d2e50SBenoit Parrot 	char b;
98417d2e50SBenoit Parrot 	/* Constant value to subtract from Gb component */
99417d2e50SBenoit Parrot 	char gb;
100417d2e50SBenoit Parrot };
101417d2e50SBenoit Parrot 
102417d2e50SBenoit Parrot /* Structure for CCDC configuration parameters for raw capture mode passed
103417d2e50SBenoit Parrot  * by application
104417d2e50SBenoit Parrot  */
105417d2e50SBenoit Parrot struct vpfe_ccdc_config_params_raw {
106417d2e50SBenoit Parrot 	/* data size value from 8 to 16 bits */
107417d2e50SBenoit Parrot 	enum vpfe_ccdc_data_size data_sz;
108417d2e50SBenoit Parrot 	/* Structure for Optional A-Law */
109417d2e50SBenoit Parrot 	struct vpfe_ccdc_a_law alaw;
110417d2e50SBenoit Parrot 	/* Structure for Optical Black Clamp */
111417d2e50SBenoit Parrot 	struct vpfe_ccdc_black_clamp blk_clamp;
112417d2e50SBenoit Parrot 	/* Structure for Black Compensation */
113417d2e50SBenoit Parrot 	struct vpfe_ccdc_black_compensation blk_comp;
114417d2e50SBenoit Parrot };
115417d2e50SBenoit Parrot 
116417d2e50SBenoit Parrot /*
117417d2e50SBenoit Parrot  *  Private IOCTL
118417d2e50SBenoit Parrot  * VIDIOC_AM437X_CCDC_CFG - Set CCDC configuration for raw capture
119417d2e50SBenoit Parrot  * This is an experimental ioctl that will change in future kernels. So use
120417d2e50SBenoit Parrot  * this ioctl with care !
121417d2e50SBenoit Parrot  **/
122417d2e50SBenoit Parrot #define VIDIOC_AM437X_CCDC_CFG \
123417d2e50SBenoit Parrot 	_IOW('V', BASE_VIDIOC_PRIVATE + 1, void *)
124417d2e50SBenoit Parrot 
125417d2e50SBenoit Parrot #endif		/* AM437X_VPFE_USER_H */
126