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 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 #ifndef _DM644X_CCDC_H 19 #define _DM644X_CCDC_H 20 #include <media/davinci/ccdc_types.h> 21 #include <media/davinci/vpfe_types.h> 22 23 /* enum for No of pixel per line to be avg. in Black Clamping*/ 24 enum ccdc_sample_length { 25 CCDC_SAMPLE_1PIXELS, 26 CCDC_SAMPLE_2PIXELS, 27 CCDC_SAMPLE_4PIXELS, 28 CCDC_SAMPLE_8PIXELS, 29 CCDC_SAMPLE_16PIXELS 30 }; 31 32 /* enum for No of lines in Black Clamping */ 33 enum ccdc_sample_line { 34 CCDC_SAMPLE_1LINES, 35 CCDC_SAMPLE_2LINES, 36 CCDC_SAMPLE_4LINES, 37 CCDC_SAMPLE_8LINES, 38 CCDC_SAMPLE_16LINES 39 }; 40 41 /* enum for Alaw gama width */ 42 enum ccdc_gama_width { 43 CCDC_GAMMA_BITS_15_6, 44 CCDC_GAMMA_BITS_14_5, 45 CCDC_GAMMA_BITS_13_4, 46 CCDC_GAMMA_BITS_12_3, 47 CCDC_GAMMA_BITS_11_2, 48 CCDC_GAMMA_BITS_10_1, 49 CCDC_GAMMA_BITS_09_0 50 }; 51 52 enum ccdc_data_size { 53 CCDC_DATA_16BITS, 54 CCDC_DATA_15BITS, 55 CCDC_DATA_14BITS, 56 CCDC_DATA_13BITS, 57 CCDC_DATA_12BITS, 58 CCDC_DATA_11BITS, 59 CCDC_DATA_10BITS, 60 CCDC_DATA_8BITS 61 }; 62 63 /* structure for ALaw */ 64 struct ccdc_a_law { 65 /* Enable/disable A-Law */ 66 unsigned char enable; 67 /* Gama Width Input */ 68 enum ccdc_gama_width gama_wd; 69 }; 70 71 /* structure for Black Clamping */ 72 struct ccdc_black_clamp { 73 unsigned char enable; 74 /* only if bClampEnable is TRUE */ 75 enum ccdc_sample_length sample_pixel; 76 /* only if bClampEnable is TRUE */ 77 enum ccdc_sample_line sample_ln; 78 /* only if bClampEnable is TRUE */ 79 unsigned short start_pixel; 80 /* only if bClampEnable is TRUE */ 81 unsigned short sgain; 82 /* only if bClampEnable is FALSE */ 83 unsigned short dc_sub; 84 }; 85 86 /* structure for Black Level Compensation */ 87 struct ccdc_black_compensation { 88 /* Constant value to subtract from Red component */ 89 char r; 90 /* Constant value to subtract from Gr component */ 91 char gr; 92 /* Constant value to subtract from Blue component */ 93 char b; 94 /* Constant value to subtract from Gb component */ 95 char gb; 96 }; 97 98 /* structure for fault pixel correction */ 99 struct ccdc_fault_pixel { 100 /* Enable or Disable fault pixel correction */ 101 unsigned char enable; 102 /* Number of fault pixel */ 103 unsigned short fp_num; 104 /* Address of fault pixel table */ 105 unsigned int fpc_table_addr; 106 }; 107 108 /* Structure for CCDC configuration parameters for raw capture mode passed 109 * by application 110 */ 111 struct ccdc_config_params_raw { 112 /* data size value from 8 to 16 bits */ 113 enum ccdc_data_size data_sz; 114 /* Structure for Optional A-Law */ 115 struct ccdc_a_law alaw; 116 /* Structure for Optical Black Clamp */ 117 struct ccdc_black_clamp blk_clamp; 118 /* Structure for Black Compensation */ 119 struct ccdc_black_compensation blk_comp; 120 /* Structure for Fault Pixel Module Configuration */ 121 struct ccdc_fault_pixel fault_pxl; 122 }; 123 124 125 #ifdef __KERNEL__ 126 #include <linux/io.h> 127 /* Define to enable/disable video port */ 128 #define FP_NUM_BYTES 4 129 /* Define for extra pixel/line and extra lines/frame */ 130 #define NUM_EXTRAPIXELS 8 131 #define NUM_EXTRALINES 8 132 133 /* settings for commonly used video formats */ 134 #define CCDC_WIN_PAL {0, 0, 720, 576} 135 /* ntsc square pixel */ 136 #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)} 137 138 /* Structure for CCDC configuration parameters for raw capture mode */ 139 struct ccdc_params_raw { 140 /* pixel format */ 141 enum ccdc_pixfmt pix_fmt; 142 /* progressive or interlaced frame */ 143 enum ccdc_frmfmt frm_fmt; 144 /* video window */ 145 struct v4l2_rect win; 146 /* field id polarity */ 147 enum vpfe_pin_pol fid_pol; 148 /* vertical sync polarity */ 149 enum vpfe_pin_pol vd_pol; 150 /* horizontal sync polarity */ 151 enum vpfe_pin_pol hd_pol; 152 /* interleaved or separated fields */ 153 enum ccdc_buftype buf_type; 154 /* 155 * enable to store the image in inverse 156 * order in memory(bottom to top) 157 */ 158 unsigned char image_invert_enable; 159 /* configurable paramaters */ 160 struct ccdc_config_params_raw config_params; 161 }; 162 163 struct ccdc_params_ycbcr { 164 /* pixel format */ 165 enum ccdc_pixfmt pix_fmt; 166 /* progressive or interlaced frame */ 167 enum ccdc_frmfmt frm_fmt; 168 /* video window */ 169 struct v4l2_rect win; 170 /* field id polarity */ 171 enum vpfe_pin_pol fid_pol; 172 /* vertical sync polarity */ 173 enum vpfe_pin_pol vd_pol; 174 /* horizontal sync polarity */ 175 enum vpfe_pin_pol hd_pol; 176 /* enable BT.656 embedded sync mode */ 177 int bt656_enable; 178 /* cb:y:cr:y or y:cb:y:cr in memory */ 179 enum ccdc_pixorder pix_order; 180 /* interleaved or separated fields */ 181 enum ccdc_buftype buf_type; 182 }; 183 #endif 184 #endif /* _DM644X_CCDC_H */ 185