2  * Support for Intel Camera Imaging ISP subsystem.
 
   3  * Copyright (c) 2015, Intel Corporation.
 
   5  * This program is free software; you can redistribute it and/or modify it
 
   6  * under the terms and conditions of the GNU General Public License,
 
   7  * version 2, as published by the Free Software Foundation.
 
   9  * This program is distributed in the hope it will be useful, but WITHOUT
 
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
  15 #ifndef __IA_CSS_SDIS_COMMON_TYPES_H
 
  16 #define __IA_CSS_SDIS_COMMON_TYPES_H
 
  19 * CSS-API header file for DVS statistics parameters.
 
  22 #include <type_support.h>
 
  24 /* DVS statistics grid dimensions in number of cells.
 
  27 struct ia_css_dvs_grid_dim {
 
  28         uint32_t width;         /** Width of DVS grid table in cells */
 
  29         uint32_t height;        /** Height of DVS grid table in cells */
 
  32 /* DVS statistics dimensions in number of cells for
 
  33  * grid, coeffieicient and projection.
 
  36 struct ia_css_sdis_info {
 
  38                 struct ia_css_dvs_grid_dim dim; /* Dimensions */
 
  39                 struct ia_css_dvs_grid_dim pad; /* Padded dimensions */
 
  41         uint32_t deci_factor_log2;
 
  44 /* DVS statistics grid
 
  46  *  ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes))
 
  47  *             SDVS2 (DVS Support for DVS ver.2 (6-axes))
 
  48  *  ISP1: SDVS1 is used.
 
  49  *  ISP2: SDVS2 is used.
 
  51 struct ia_css_dvs_grid_res {
 
  52         uint32_t width;         /** Width of DVS grid table.
 
  53                                         (= Horizontal number of grid cells
 
  54                                         in table, which cells have effective
 
  56                                         For DVS1, this is equal to
 
  57                                          the number of vertical statistics. */
 
  58         uint32_t aligned_width; /** Stride of each grid line.
 
  59                                         (= Horizontal number of grid cells
 
  61                                         the allocated width.) */
 
  62         uint32_t height;        /** Height of DVS grid table.
 
  63                                         (= Vertical number of grid cells
 
  64                                         in table, which cells have effective
 
  66                                         For DVS1, This is equal to
 
  67                                         the number of horizontal statistics. */
 
  68         uint32_t aligned_height;/** Stride of each grid column.
 
  69                                         (= Vertical number of grid cells
 
  71                                         the allocated height.) */
 
  74 /* TODO: use ia_css_dvs_grid_res in here.
 
  75  * However, that implies driver I/F changes
 
  77 struct ia_css_dvs_grid_info {
 
  78         uint32_t enable;        /** DVS statistics enabled.
 
  79                                         0:disabled, 1:enabled */
 
  80         uint32_t width;         /** Width of DVS grid table.
 
  81                                         (= Horizontal number of grid cells
 
  82                                         in table, which cells have effective
 
  84                                         For DVS1, this is equal to
 
  85                                          the number of vertical statistics. */
 
  86         uint32_t aligned_width; /** Stride of each grid line.
 
  87                                         (= Horizontal number of grid cells
 
  89                                         the allocated width.) */
 
  90         uint32_t height;        /** Height of DVS grid table.
 
  91                                         (= Vertical number of grid cells
 
  92                                         in table, which cells have effective
 
  94                                         For DVS1, This is equal to
 
  95                                         the number of horizontal statistics. */
 
  96         uint32_t aligned_height;/** Stride of each grid column.
 
  97                                         (= Vertical number of grid cells
 
  99                                         the allocated height.) */
 
 100         uint32_t bqs_per_grid_cell; /** Grid cell size in BQ(Bayer Quad) unit.
 
 101                                         (1BQ means {Gr,R,B,Gb}(2x2 pixels).)
 
 102                                         For DVS1, valid value is 64.
 
 103                                         For DVS2, valid value is only 64,
 
 105         uint32_t num_hor_coefs; /** Number of horizontal coefficients. */
 
 106         uint32_t num_ver_coefs; /** Number of vertical coefficients. */
 
 109 /* Number of DVS statistics levels
 
 111 #define IA_CSS_DVS_STAT_NUM_OF_LEVELS   3
 
 113 /* DVS statistics generated by accelerator global configuration
 
 115 struct dvs_stat_public_dvs_global_cfg {
 
 117         /** DVS statistics global configuration - kappa */
 
 118         unsigned char match_shift;
 
 119         /** DVS statistics global configuration - match_shift */
 
 120         unsigned char ybin_mode;
 
 121         /** DVS statistics global configuration - y binning mode */
 
 124 /* DVS statistics generated by accelerator level grid
 
 127 struct dvs_stat_public_dvs_level_grid_cfg {
 
 128         unsigned char grid_width;
 
 129         /** DVS statistics grid width */
 
 130         unsigned char grid_height;
 
 131         /** DVS statistics grid height */
 
 132         unsigned char block_width;
 
 133         /** DVS statistics block width */
 
 134         unsigned char block_height;
 
 135         /** DVS statistics block  height */
 
 138 /* DVS statistics generated by accelerator level grid start
 
 141 struct dvs_stat_public_dvs_level_grid_start {
 
 142         unsigned short x_start;
 
 143         /** DVS statistics level x start */
 
 144         unsigned short y_start;
 
 145         /** DVS statistics level y start */
 
 146         unsigned char enable;
 
 147         /** DVS statistics level enable */
 
 150 /* DVS statistics generated by accelerator level grid end
 
 153 struct dvs_stat_public_dvs_level_grid_end {
 
 154         unsigned short x_end;
 
 155         /** DVS statistics level x end */
 
 156         unsigned short y_end;
 
 157         /** DVS statistics level y end */
 
 160 /* DVS statistics generated by accelerator Feature Extraction
 
 161  *  Region Of Interest (FE-ROI) configuration
 
 163 struct dvs_stat_public_dvs_level_fe_roi_cfg {
 
 164         unsigned char x_start;
 
 165         /** DVS statistics fe-roi level x start */
 
 166         unsigned char y_start;
 
 167         /** DVS statistics fe-roi level y start */
 
 169         /** DVS statistics fe-roi level x end */
 
 171         /** DVS statistics fe-roi level y end */
 
 174 /* DVS statistics generated by accelerator public configuration
 
 176 struct dvs_stat_public_dvs_grd_cfg {
 
 177         struct dvs_stat_public_dvs_level_grid_cfg    grd_cfg;
 
 178         /** DVS statistics level grid configuration */
 
 179         struct dvs_stat_public_dvs_level_grid_start  grd_start;
 
 180         /** DVS statistics level grid start configuration */
 
 181         struct dvs_stat_public_dvs_level_grid_end    grd_end;
 
 182         /** DVS statistics level grid end configuration */
 
 185 /* DVS statistics grid generated by accelerator
 
 187 struct ia_css_dvs_stat_grid_info {
 
 188         struct dvs_stat_public_dvs_global_cfg       dvs_gbl_cfg;
 
 189         /** DVS statistics global configuration (kappa, match, binning) */
 
 190         struct dvs_stat_public_dvs_grd_cfg       grd_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
 
 191         /** DVS statistics grid configuration (blocks and grids) */
 
 192         struct dvs_stat_public_dvs_level_fe_roi_cfg fe_roi_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
 
 193         /** DVS statistics FE ROI (region of interest) configuration */
 
 196 /* DVS statistics generated by accelerator default grid info
 
 198 #define DEFAULT_DVS_GRID_INFO \
 
 199 (union ia_css_dvs_grid_u) { \
 
 200         .dvs_stat_grid_info = (struct ia_css_dvs_stat_grid_info) { \
 
 202                         [1] = (struct dvs_stat_public_dvs_level_fe_roi_cfg) { \
 
 209 /* Union that holds all types of DVS statistics grid info in
 
 212 union ia_css_dvs_grid_u {
 
 213         struct ia_css_dvs_stat_grid_info dvs_stat_grid_info;
 
 214         /** DVS statistics produced by accelerator grid info */
 
 215         struct ia_css_dvs_grid_info dvs_grid_info;
 
 216         /** DVS (DVS1/DVS2) grid info */
 
 219 #endif /* __IA_CSS_SDIS_COMMON_TYPES_H */