]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/media/davinci/dm644x_ccdc.h
Merge tag 'linux-kselftest-4.13-rc6-fixes' of git://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-artful-kernel.git] / include / media / davinci / dm644x_ccdc.h
1 /*
2 * Copyright (C) 2006-2009 Texas Instruments Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14 #ifndef _DM644X_CCDC_H
15 #define _DM644X_CCDC_H
16 #include <media/davinci/ccdc_types.h>
17 #include <media/davinci/vpfe_types.h>
18
19 /* enum for No of pixel per line to be avg. in Black Clamping*/
20 enum ccdc_sample_length {
21 CCDC_SAMPLE_1PIXELS,
22 CCDC_SAMPLE_2PIXELS,
23 CCDC_SAMPLE_4PIXELS,
24 CCDC_SAMPLE_8PIXELS,
25 CCDC_SAMPLE_16PIXELS
26 };
27
28 /* enum for No of lines in Black Clamping */
29 enum ccdc_sample_line {
30 CCDC_SAMPLE_1LINES,
31 CCDC_SAMPLE_2LINES,
32 CCDC_SAMPLE_4LINES,
33 CCDC_SAMPLE_8LINES,
34 CCDC_SAMPLE_16LINES
35 };
36
37 /* enum for Alaw gamma width */
38 enum ccdc_gamma_width {
39 CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
40 CCDC_GAMMA_BITS_14_5,
41 CCDC_GAMMA_BITS_13_4,
42 CCDC_GAMMA_BITS_12_3,
43 CCDC_GAMMA_BITS_11_2,
44 CCDC_GAMMA_BITS_10_1,
45 CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
46 };
47
48 /* returns the highest bit used for the gamma */
49 static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
50 {
51 return 15 - width;
52 }
53
54 enum ccdc_data_size {
55 CCDC_DATA_16BITS,
56 CCDC_DATA_15BITS,
57 CCDC_DATA_14BITS,
58 CCDC_DATA_13BITS,
59 CCDC_DATA_12BITS,
60 CCDC_DATA_11BITS,
61 CCDC_DATA_10BITS,
62 CCDC_DATA_8BITS
63 };
64
65 /* returns the highest bit used for this data size */
66 static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
67 {
68 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
69 }
70
71 /* structure for ALaw */
72 struct ccdc_a_law {
73 /* Enable/disable A-Law */
74 unsigned char enable;
75 /* Gamma Width Input */
76 enum ccdc_gamma_width gamma_wd;
77 };
78
79 /* structure for Black Clamping */
80 struct ccdc_black_clamp {
81 unsigned char enable;
82 /* only if bClampEnable is TRUE */
83 enum ccdc_sample_length sample_pixel;
84 /* only if bClampEnable is TRUE */
85 enum ccdc_sample_line sample_ln;
86 /* only if bClampEnable is TRUE */
87 unsigned short start_pixel;
88 /* only if bClampEnable is TRUE */
89 unsigned short sgain;
90 /* only if bClampEnable is FALSE */
91 unsigned short dc_sub;
92 };
93
94 /* structure for Black Level Compensation */
95 struct ccdc_black_compensation {
96 /* Constant value to subtract from Red component */
97 char r;
98 /* Constant value to subtract from Gr component */
99 char gr;
100 /* Constant value to subtract from Blue component */
101 char b;
102 /* Constant value to subtract from Gb component */
103 char gb;
104 };
105
106 /* Structure for CCDC configuration parameters for raw capture mode passed
107 * by application
108 */
109 struct ccdc_config_params_raw {
110 /* data size value from 8 to 16 bits */
111 enum ccdc_data_size data_sz;
112 /* Structure for Optional A-Law */
113 struct ccdc_a_law alaw;
114 /* Structure for Optical Black Clamp */
115 struct ccdc_black_clamp blk_clamp;
116 /* Structure for Black Compensation */
117 struct ccdc_black_compensation blk_comp;
118 };
119
120
121 #ifdef __KERNEL__
122 #include <linux/io.h>
123 /* Define to enable/disable video port */
124 #define FP_NUM_BYTES 4
125 /* Define for extra pixel/line and extra lines/frame */
126 #define NUM_EXTRAPIXELS 8
127 #define NUM_EXTRALINES 8
128
129 /* settings for commonly used video formats */
130 #define CCDC_WIN_PAL {0, 0, 720, 576}
131 /* ntsc square pixel */
132 #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
133
134 /* Structure for CCDC configuration parameters for raw capture mode */
135 struct ccdc_params_raw {
136 /* pixel format */
137 enum ccdc_pixfmt pix_fmt;
138 /* progressive or interlaced frame */
139 enum ccdc_frmfmt frm_fmt;
140 /* video window */
141 struct v4l2_rect win;
142 /* field id polarity */
143 enum vpfe_pin_pol fid_pol;
144 /* vertical sync polarity */
145 enum vpfe_pin_pol vd_pol;
146 /* horizontal sync polarity */
147 enum vpfe_pin_pol hd_pol;
148 /* interleaved or separated fields */
149 enum ccdc_buftype buf_type;
150 /*
151 * enable to store the image in inverse
152 * order in memory(bottom to top)
153 */
154 unsigned char image_invert_enable;
155 /* configurable paramaters */
156 struct ccdc_config_params_raw config_params;
157 };
158
159 struct ccdc_params_ycbcr {
160 /* pixel format */
161 enum ccdc_pixfmt pix_fmt;
162 /* progressive or interlaced frame */
163 enum ccdc_frmfmt frm_fmt;
164 /* video window */
165 struct v4l2_rect win;
166 /* field id polarity */
167 enum vpfe_pin_pol fid_pol;
168 /* vertical sync polarity */
169 enum vpfe_pin_pol vd_pol;
170 /* horizontal sync polarity */
171 enum vpfe_pin_pol hd_pol;
172 /* enable BT.656 embedded sync mode */
173 int bt656_enable;
174 /* cb:y:cr:y or y:cb:y:cr in memory */
175 enum ccdc_pixorder pix_order;
176 /* interleaved or separated fields */
177 enum ccdc_buftype buf_type;
178 };
179 #endif
180 #endif /* _DM644X_CCDC_H */