]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/media/davinci/dm644x_ccdc.h
Merge branch 'for-linus-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
[mirror_ubuntu-artful-kernel.git] / include / media / davinci / dm644x_ccdc.h
CommitLineData
5f15fbb6
MK
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.
5f15fbb6
MK
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*/
20enum 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 */
29enum 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
1de19519
HV
37/* enum for Alaw gamma width */
38enum ccdc_gamma_width {
39 CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
5f15fbb6
MK
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,
1de19519 45 CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
5f15fbb6
MK
46};
47
1de19519
HV
48/* returns the highest bit used for the gamma */
49static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
50{
51 return 15 - width;
52}
53
5f15fbb6
MK
54enum 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
1de19519
HV
65/* returns the highest bit used for this data size */
66static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
67{
68 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
69}
70
5f15fbb6
MK
71/* structure for ALaw */
72struct ccdc_a_law {
73 /* Enable/disable A-Law */
74 unsigned char enable;
1de19519
HV
75 /* Gamma Width Input */
76 enum ccdc_gamma_width gamma_wd;
5f15fbb6
MK
77};
78
79/* structure for Black Clamping */
80struct 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 */
95struct 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 fault pixel correction */
107struct ccdc_fault_pixel {
108 /* Enable or Disable fault pixel correction */
109 unsigned char enable;
110 /* Number of fault pixel */
111 unsigned short fp_num;
112 /* Address of fault pixel table */
8dece35d 113 unsigned long fpc_table_addr;
5f15fbb6
MK
114};
115
116/* Structure for CCDC configuration parameters for raw capture mode passed
117 * by application
118 */
119struct ccdc_config_params_raw {
120 /* data size value from 8 to 16 bits */
121 enum ccdc_data_size data_sz;
122 /* Structure for Optional A-Law */
123 struct ccdc_a_law alaw;
124 /* Structure for Optical Black Clamp */
125 struct ccdc_black_clamp blk_clamp;
126 /* Structure for Black Compensation */
127 struct ccdc_black_compensation blk_comp;
128 /* Structure for Fault Pixel Module Configuration */
129 struct ccdc_fault_pixel fault_pxl;
130};
131
132
133#ifdef __KERNEL__
134#include <linux/io.h>
135/* Define to enable/disable video port */
136#define FP_NUM_BYTES 4
137/* Define for extra pixel/line and extra lines/frame */
138#define NUM_EXTRAPIXELS 8
139#define NUM_EXTRALINES 8
140
141/* settings for commonly used video formats */
142#define CCDC_WIN_PAL {0, 0, 720, 576}
143/* ntsc square pixel */
144#define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
145
146/* Structure for CCDC configuration parameters for raw capture mode */
147struct ccdc_params_raw {
148 /* pixel format */
149 enum ccdc_pixfmt pix_fmt;
150 /* progressive or interlaced frame */
151 enum ccdc_frmfmt frm_fmt;
152 /* video window */
153 struct v4l2_rect win;
154 /* field id polarity */
155 enum vpfe_pin_pol fid_pol;
156 /* vertical sync polarity */
157 enum vpfe_pin_pol vd_pol;
158 /* horizontal sync polarity */
159 enum vpfe_pin_pol hd_pol;
160 /* interleaved or separated fields */
161 enum ccdc_buftype buf_type;
162 /*
163 * enable to store the image in inverse
164 * order in memory(bottom to top)
165 */
166 unsigned char image_invert_enable;
167 /* configurable paramaters */
168 struct ccdc_config_params_raw config_params;
169};
170
171struct ccdc_params_ycbcr {
172 /* pixel format */
173 enum ccdc_pixfmt pix_fmt;
174 /* progressive or interlaced frame */
175 enum ccdc_frmfmt frm_fmt;
176 /* video window */
177 struct v4l2_rect win;
178 /* field id polarity */
179 enum vpfe_pin_pol fid_pol;
180 /* vertical sync polarity */
181 enum vpfe_pin_pol vd_pol;
182 /* horizontal sync polarity */
183 enum vpfe_pin_pol hd_pol;
184 /* enable BT.656 embedded sync mode */
185 int bt656_enable;
186 /* cb:y:cr:y or y:cb:y:cr in memory */
187 enum ccdc_pixorder pix_order;
188 /* interleaved or separated fields */
189 enum ccdc_buftype buf_type;
190};
191#endif
192#endif /* _DM644X_CCDC_H */