4 * Driver header file for CCDC module in TI's OMAP3 Camera ISP
6 * Copyright (C) 2009 Texas Instruments, Inc.
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 */
48 /* Enumeration constants for the sync interface parameters */
61 /* Enumeration constants for location of Y component in 8-bit YUV data */
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.
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
{
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
{
142 * struct isp_ccdc_device - Structure for the CCDC module to store its own
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
{
185 struct mutex mutexlock
; /* For checking/modifying ccdc_inuse */
187 u8
*lsc_gain_table_tmp
;
188 unsigned long lsc_ispmmu_addr
;
190 struct ispccdc_lsc_config lsc_config
;
191 unsigned long fpc_table_add_m
;
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
,
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 */