Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) 2006-2009 Texas Instruments Inc
0004  */
0005 #ifndef _DM644X_CCDC_H
0006 #define _DM644X_CCDC_H
0007 #include <media/davinci/ccdc_types.h>
0008 #include <media/davinci/vpfe_types.h>
0009 
0010 /* enum for No of pixel per line to be avg. in Black Clamping*/
0011 enum ccdc_sample_length {
0012     CCDC_SAMPLE_1PIXELS,
0013     CCDC_SAMPLE_2PIXELS,
0014     CCDC_SAMPLE_4PIXELS,
0015     CCDC_SAMPLE_8PIXELS,
0016     CCDC_SAMPLE_16PIXELS
0017 };
0018 
0019 /* enum for No of lines in Black Clamping */
0020 enum ccdc_sample_line {
0021     CCDC_SAMPLE_1LINES,
0022     CCDC_SAMPLE_2LINES,
0023     CCDC_SAMPLE_4LINES,
0024     CCDC_SAMPLE_8LINES,
0025     CCDC_SAMPLE_16LINES
0026 };
0027 
0028 /* enum for Alaw gamma width */
0029 enum ccdc_gamma_width {
0030     CCDC_GAMMA_BITS_15_6,   /* use bits 15-6 for gamma */
0031     CCDC_GAMMA_BITS_14_5,
0032     CCDC_GAMMA_BITS_13_4,
0033     CCDC_GAMMA_BITS_12_3,
0034     CCDC_GAMMA_BITS_11_2,
0035     CCDC_GAMMA_BITS_10_1,
0036     CCDC_GAMMA_BITS_09_0    /* use bits 9-0 for gamma */
0037 };
0038 
0039 /* returns the highest bit used for the gamma */
0040 static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
0041 {
0042     return 15 - width;
0043 }
0044 
0045 enum ccdc_data_size {
0046     CCDC_DATA_16BITS,
0047     CCDC_DATA_15BITS,
0048     CCDC_DATA_14BITS,
0049     CCDC_DATA_13BITS,
0050     CCDC_DATA_12BITS,
0051     CCDC_DATA_11BITS,
0052     CCDC_DATA_10BITS,
0053     CCDC_DATA_8BITS
0054 };
0055 
0056 /* returns the highest bit used for this data size */
0057 static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
0058 {
0059     return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
0060 }
0061 
0062 /* structure for ALaw */
0063 struct ccdc_a_law {
0064     /* Enable/disable A-Law */
0065     unsigned char enable;
0066     /* Gamma Width Input */
0067     enum ccdc_gamma_width gamma_wd;
0068 };
0069 
0070 /* structure for Black Clamping */
0071 struct ccdc_black_clamp {
0072     unsigned char enable;
0073     /* only if bClampEnable is TRUE */
0074     enum ccdc_sample_length sample_pixel;
0075     /* only if bClampEnable is TRUE */
0076     enum ccdc_sample_line sample_ln;
0077     /* only if bClampEnable is TRUE */
0078     unsigned short start_pixel;
0079     /* only if bClampEnable is TRUE */
0080     unsigned short sgain;
0081     /* only if bClampEnable is FALSE */
0082     unsigned short dc_sub;
0083 };
0084 
0085 /* structure for Black Level Compensation */
0086 struct ccdc_black_compensation {
0087     /* Constant value to subtract from Red component */
0088     char r;
0089     /* Constant value to subtract from Gr component */
0090     char gr;
0091     /* Constant value to subtract from Blue component */
0092     char b;
0093     /* Constant value to subtract from Gb component */
0094     char gb;
0095 };
0096 
0097 /* Structure for CCDC configuration parameters for raw capture mode passed
0098  * by application
0099  */
0100 struct ccdc_config_params_raw {
0101     /* data size value from 8 to 16 bits */
0102     enum ccdc_data_size data_sz;
0103     /* Structure for Optional A-Law */
0104     struct ccdc_a_law alaw;
0105     /* Structure for Optical Black Clamp */
0106     struct ccdc_black_clamp blk_clamp;
0107     /* Structure for Black Compensation */
0108     struct ccdc_black_compensation blk_comp;
0109 };
0110 
0111 
0112 #ifdef __KERNEL__
0113 #include <linux/io.h>
0114 /* Define to enable/disable video port */
0115 #define FP_NUM_BYTES        4
0116 /* Define for extra pixel/line and extra lines/frame */
0117 #define NUM_EXTRAPIXELS     8
0118 #define NUM_EXTRALINES      8
0119 
0120 /* settings for commonly used video formats */
0121 #define CCDC_WIN_PAL     {0, 0, 720, 576}
0122 /* ntsc square pixel */
0123 #define CCDC_WIN_VGA    {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
0124 
0125 /* Structure for CCDC configuration parameters for raw capture mode */
0126 struct ccdc_params_raw {
0127     /* pixel format */
0128     enum ccdc_pixfmt pix_fmt;
0129     /* progressive or interlaced frame */
0130     enum ccdc_frmfmt frm_fmt;
0131     /* video window */
0132     struct v4l2_rect win;
0133     /* field id polarity */
0134     enum vpfe_pin_pol fid_pol;
0135     /* vertical sync polarity */
0136     enum vpfe_pin_pol vd_pol;
0137     /* horizontal sync polarity */
0138     enum vpfe_pin_pol hd_pol;
0139     /* interleaved or separated fields */
0140     enum ccdc_buftype buf_type;
0141     /*
0142      * enable to store the image in inverse
0143      * order in memory(bottom to top)
0144      */
0145     unsigned char image_invert_enable;
0146     /* configurable parameters */
0147     struct ccdc_config_params_raw config_params;
0148 };
0149 
0150 struct ccdc_params_ycbcr {
0151     /* pixel format */
0152     enum ccdc_pixfmt pix_fmt;
0153     /* progressive or interlaced frame */
0154     enum ccdc_frmfmt frm_fmt;
0155     /* video window */
0156     struct v4l2_rect win;
0157     /* field id polarity */
0158     enum vpfe_pin_pol fid_pol;
0159     /* vertical sync polarity */
0160     enum vpfe_pin_pol vd_pol;
0161     /* horizontal sync polarity */
0162     enum vpfe_pin_pol hd_pol;
0163     /* enable BT.656 embedded sync mode */
0164     int bt656_enable;
0165     /* cb:y:cr:y or y:cb:y:cr in memory */
0166     enum ccdc_pixorder pix_order;
0167     /* interleaved or separated fields  */
0168     enum ccdc_buftype buf_type;
0169 };
0170 #endif
0171 #endif              /* _DM644X_CCDC_H */