Full support for Ginger Console
[linux-ginger.git] / drivers / media / video / isp / ispccdc.h
blob07ba00dc4165129529a674a4f6c101670d3353be
1 /*
2 * ispccdc.h
4 * Driver header file for CCDC module in TI's OMAP3 Camera ISP
6 * Copyright (C) 2009 Texas Instruments, Inc.
8 * Contributors:
9 * Senthilvadivu Guruswamy <svadivu@ti.com>
10 * Pallavi Kulkarni <p-kulkarni@ti.com>
11 * Sergio Aguirre <saaguirre@ti.com>
13 * This package is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
17 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 #ifndef OMAP_ISP_CCDC_H
23 #define OMAP_ISP_CCDC_H
25 #include <plat/isp_user.h>
27 #define is_isplsc_activated() 1
29 /* Enumeration constants for CCDC input output format */
30 enum ccdc_input {
31 CCDC_RAW_GRBG,
32 CCDC_RAW_RGGB,
33 CCDC_RAW_BGGR,
34 CCDC_RAW_GBRG,
35 CCDC_YUV_SYNC,
36 CCDC_YUV_BT,
37 CCDC_OTHERS
40 enum ccdc_output {
41 CCDC_YUV_RSZ,
42 CCDC_YUV_MEM_RSZ,
43 CCDC_OTHERS_VP,
44 CCDC_OTHERS_MEM,
45 CCDC_OTHERS_VP_MEM
48 /* Enumeration constants for the sync interface parameters */
49 enum inpmode {
50 RAW,
51 YUV16,
52 YUV8
54 enum datasize {
55 DAT8,
56 DAT10,
57 DAT11,
58 DAT12
61 /* Enumeration constants for location of Y component in 8-bit YUV data */
62 enum y8pos_mode {
63 Y8POS_EVEN = 0,
64 Y8POS_ODD = 1
67 /**
68 * struct ispccdc_syncif - Structure for Sync Interface between sensor and CCDC
69 * @ccdc_mastermode: Master mode. 1 - Master, 0 - Slave.
70 * @fldstat: Field state. 0 - Odd Field, 1 - Even Field.
71 * @ipmod: Input mode.
72 * @datsz: Data size.
73 * @fldmode: 0 - Progressive, 1 - Interlaced.
74 * @datapol: 0 - Positive, 1 - Negative.
75 * @fldpol: 0 - Positive, 1 - Negative.
76 * @hdpol: 0 - Positive, 1 - Negative.
77 * @vdpol: 0 - Positive, 1 - Negative.
78 * @fldout: 0 - Input, 1 - Output.
79 * @hs_width: Width of the Horizontal Sync pulse, used for HS/VS Output.
80 * @vs_width: Width of the Vertical Sync pulse, used for HS/VS Output.
81 * @ppln: Number of pixels per line, used for HS/VS Output.
82 * @hlprf: Number of half lines per frame, used for HS/VS Output.
83 * @bt_r656_en: 1 - Enable ITU-R BT656 mode, 0 - Sync mode.
85 struct ispccdc_syncif {
86 u8 ccdc_mastermode;
87 u8 fldstat;
88 enum inpmode ipmod;
89 enum datasize datsz;
90 u8 fldmode;
91 u8 datapol;
92 u8 fldpol;
93 u8 hdpol;
94 u8 vdpol;
95 u8 fldout;
96 u8 hs_width;
97 u8 vs_width;
98 u8 ppln;
99 u8 hlprf;
100 u8 bt_r656_en;
104 * ispccdc_refmt - Structure for Reformatter parameters
105 * @lnalt: Line alternating mode enable. 0 - Enable, 1 - Disable.
106 * @lnum: Number of output lines from 1 input line. 1 to 4 lines.
107 * @plen_even: Number of program entries in even line minus 1.
108 * @plen_odd: Number of program entries in odd line minus 1.
109 * @prgeven0: Program entries 0-7 for even lines register
110 * @prgeven1: Program entries 8-15 for even lines register
111 * @prgodd0: Program entries 0-7 for odd lines register
112 * @prgodd1: Program entries 8-15 for odd lines register
113 * @fmtaddr0: Output line in which the original pixel is to be placed
114 * @fmtaddr1: Output line in which the original pixel is to be placed
115 * @fmtaddr2: Output line in which the original pixel is to be placed
116 * @fmtaddr3: Output line in which the original pixel is to be placed
117 * @fmtaddr4: Output line in which the original pixel is to be placed
118 * @fmtaddr5: Output line in which the original pixel is to be placed
119 * @fmtaddr6: Output line in which the original pixel is to be placed
120 * @fmtaddr7: Output line in which the original pixel is to be placed
122 struct ispccdc_refmt {
123 u8 lnalt;
124 u8 lnum;
125 u8 plen_even;
126 u8 plen_odd;
127 u32 prgeven0;
128 u32 prgeven1;
129 u32 prgodd0;
130 u32 prgodd1;
131 u32 fmtaddr0;
132 u32 fmtaddr1;
133 u32 fmtaddr2;
134 u32 fmtaddr3;
135 u32 fmtaddr4;
136 u32 fmtaddr5;
137 u32 fmtaddr6;
138 u32 fmtaddr7;
142 * struct isp_ccdc_device - Structure for the CCDC module to store its own
143 * information
144 * @ccdc_inuse: Flag to determine if CCDC has been reserved or not (0 or 1).
145 * @ccdcin_woffset: CCDC input horizontal offset.
146 * @ccdcin_hoffset: CCDC input vertical offset.
147 * @crop_w: Crop width.
148 * @crop_h: Crop weight.
149 * @vpout_en: Video port output enable.
150 * @wen: Data write enable.
151 * @exwen: External data write enable.
152 * @refmt_en: Reformatter enable.
153 * @ccdcslave: CCDC slave mode enable.
154 * @syncif_ipmod: Image
155 * @obclamp_en: Data input format.
156 * @lsc_enable: Pending enable of the LSC.
157 * @lsc_initialized: Is LSC initialized?
158 * @lsc_state: Enable state of the LSC.
159 * @mutexlock: Mutex used to get access to the CCDC.
160 * @wenlog: Write Enable logic to use against valid data signal.
161 * @lsc_gain_table_tmp: Pointer to Virtual address of temporary LSC table.
162 * @lsc_ispmmu_addr: ISP MMU mapped address of the current used LSC table.
163 * @lsc_gain_table: Virtual address of the current used LSC table.
164 * @lsc_config: Pointer to LSC configuration structure.
165 * @fpc_table_add_m: ISP MMU mapped address of the current used FPC table.
166 * @fpc_table_add: Virtual address of the current used FPC table.
167 * @dev: Device pointer specific to the OMAP3 ISP.
169 struct isp_ccdc_device {
170 u8 ccdc_inuse;
171 u32 ccdcin_woffset;
172 u32 ccdcin_hoffset;
173 u32 crop_w;
174 u32 crop_h;
175 u8 vpout_en;
176 u8 wen;
177 u8 exwen;
178 u8 refmt_en;
179 u8 ccdcslave;
180 u8 syncif_ipmod;
181 u8 obclamp_en;
182 u8 lsc_enable;
183 u8 lsc_initialized;
184 int lsc_state;
185 struct mutex mutexlock; /* For checking/modifying ccdc_inuse */
186 u32 wenlog;
187 u8 *lsc_gain_table_tmp;
188 unsigned long lsc_ispmmu_addr;
189 u8 *lsc_gain_table;
190 struct ispccdc_lsc_config lsc_config;
191 unsigned long fpc_table_add_m;
192 u32 *fpc_table_add;
193 struct device *dev;
196 int ispccdc_request(struct isp_ccdc_device *isp_ccdc);
198 int ispccdc_free(struct isp_ccdc_device *isp_ccdc);
200 void ispccdc_config_crop(struct isp_ccdc_device *isp_ccdc, u32 left, u32 top,
201 u32 height, u32 width);
203 void ispccdc_config_sync_if(struct isp_ccdc_device *isp_ccdc,
204 struct ispccdc_syncif syncif);
206 int ispccdc_config_black_clamp(struct isp_ccdc_device *isp_ccdc,
207 struct ispccdc_bclamp bclamp);
209 void ispccdc_enable_black_clamp(struct isp_ccdc_device *isp_ccdc, u8 enable);
211 int ispccdc_config_fpc(struct isp_ccdc_device *isp_ccdc,
212 struct ispccdc_fpc fpc);
214 void ispccdc_enable_fpc(struct isp_ccdc_device *isp_ccdc, u8 enable);
216 void ispccdc_config_black_comp(struct isp_ccdc_device *isp_ccdc,
217 struct ispccdc_blcomp blcomp);
219 void ispccdc_config_vp(struct isp_ccdc_device *isp_ccdc, struct ispccdc_vp vp);
221 void ispccdc_enable_vp(struct isp_ccdc_device *isp_ccdc, u8 enable);
223 void ispccdc_config_reformatter(struct isp_ccdc_device *isp_ccdc,
224 struct ispccdc_refmt refmt);
226 void ispccdc_enable_reformatter(struct isp_ccdc_device *isp_ccdc, u8 enable);
228 void ispccdc_config_culling(struct isp_ccdc_device *isp_ccdc,
229 struct ispccdc_culling culling);
231 void ispccdc_enable_lpf(struct isp_ccdc_device *isp_ccdc, u8 enable);
233 void ispccdc_config_alaw(struct isp_ccdc_device *isp_ccdc,
234 enum alaw_ipwidth ipwidth);
236 void ispccdc_enable_alaw(struct isp_ccdc_device *isp_ccdc, u8 enable);
238 int ispccdc_load_lsc(struct isp_ccdc_device *isp_ccdc, u8 *table_addr,
239 u32 table_size);
241 void ispccdc_config_lsc(struct isp_ccdc_device *isp_ccdc,
242 struct ispccdc_lsc_config *lsc_cfg);
244 void ispccdc_enable_lsc(struct isp_ccdc_device *isp_ccdc, u8 enable);
246 void ispccdc_lsc_error_handler(struct isp_ccdc_device *isp_ccdc);
248 void ispccdc_config_imgattr(struct isp_ccdc_device *isp_ccdc, u32 colptn);
250 void ispccdc_config_shadow_registers(struct isp_ccdc_device *isp_ccdc);
252 int ispccdc_try_pipeline(struct isp_ccdc_device *isp_ccdc,
253 struct isp_pipeline *pipe);
255 int ispccdc_s_pipeline(struct isp_ccdc_device *isp_ccdc,
256 struct isp_pipeline *pipe);
258 int ispccdc_config_outlineoffset(struct isp_ccdc_device *isp_ccdc, u32 offset,
259 u8 oddeven, u8 numlines);
261 int ispccdc_set_outaddr(struct isp_ccdc_device *isp_ccdc, u32 addr);
263 void ispccdc_enable(struct isp_ccdc_device *isp_ccdc, u8 enable);
265 int ispccdc_sbl_busy(void *_isp_ccdc);
267 int ispccdc_busy(struct isp_ccdc_device *isp_ccdc);
269 void ispccdc_save_context(struct device *dev);
271 void ispccdc_restore_context(struct device *dev);
273 void ispccdc_print_status(struct isp_ccdc_device *isp_ccdc,
274 struct isp_pipeline *pipe);
276 int omap34xx_isp_ccdc_config(struct isp_ccdc_device *isp_ccdc,
277 void *userspace_add);
279 void ispccdc_set_wenlog(struct isp_ccdc_device *isp_ccdc, u32 wenlog);
281 void ispccdc_config_y8pos(struct isp_ccdc_device *isp_ccdc,
282 enum y8pos_mode mode);
284 void ispccdc_config_byteswap(struct isp_ccdc_device *isp_ccdc, int swap);
286 #endif /* OMAP_ISP_CCDC_H */