031983c357e4732865fe1f07a2012eba116682a4
[openwrt/staging/blogic.git] /
1 /*
2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
4 *
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.
8 *
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
12 * more details.
13 */
14
15 #ifndef __IA_CSS_SDIS_COMMON_TYPES_H
16 #define __IA_CSS_SDIS_COMMON_TYPES_H
17
18 /* @file
19 * CSS-API header file for DVS statistics parameters.
20 */
21
22 #include <type_support.h>
23
24 /* DVS statistics grid dimensions in number of cells.
25 */
26
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 */
30 };
31
32 /* DVS statistics dimensions in number of cells for
33 * grid, coeffieicient and projection.
34 */
35
36 struct ia_css_sdis_info {
37 struct {
38 struct ia_css_dvs_grid_dim dim; /* Dimensions */
39 struct ia_css_dvs_grid_dim pad; /* Padded dimensions */
40 } grid, coef, proj;
41 uint32_t deci_factor_log2;
42 };
43
44 #define IA_CSS_DEFAULT_SDIS_INFO \
45 { \
46 { { 0, 0 }, /* dim */ \
47 { 0, 0 }, /* pad */ \
48 }, /* grid */ \
49 { { 0, 0 }, /* dim */ \
50 { 0, 0 }, /* pad */ \
51 }, /* coef */ \
52 { { 0, 0 }, /* dim */ \
53 { 0, 0 }, /* pad */ \
54 }, /* proj */ \
55 0, /* dis_deci_factor_log2 */ \
56 }
57
58 /* DVS statistics grid
59 *
60 * ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes))
61 * SDVS2 (DVS Support for DVS ver.2 (6-axes))
62 * ISP1: SDVS1 is used.
63 * ISP2: SDVS2 is used.
64 */
65 struct ia_css_dvs_grid_res {
66 uint32_t width; /** Width of DVS grid table.
67 (= Horizontal number of grid cells
68 in table, which cells have effective
69 statistics.)
70 For DVS1, this is equal to
71 the number of vertical statistics. */
72 uint32_t aligned_width; /** Stride of each grid line.
73 (= Horizontal number of grid cells
74 in table, which means
75 the allocated width.) */
76 uint32_t height; /** Height of DVS grid table.
77 (= Vertical number of grid cells
78 in table, which cells have effective
79 statistics.)
80 For DVS1, This is equal to
81 the number of horizontal statistics. */
82 uint32_t aligned_height;/** Stride of each grid column.
83 (= Vertical number of grid cells
84 in table, which means
85 the allocated height.) */
86 };
87
88 /* TODO: use ia_css_dvs_grid_res in here.
89 * However, that implies driver I/F changes
90 */
91 struct ia_css_dvs_grid_info {
92 uint32_t enable; /** DVS statistics enabled.
93 0:disabled, 1:enabled */
94 uint32_t width; /** Width of DVS grid table.
95 (= Horizontal number of grid cells
96 in table, which cells have effective
97 statistics.)
98 For DVS1, this is equal to
99 the number of vertical statistics. */
100 uint32_t aligned_width; /** Stride of each grid line.
101 (= Horizontal number of grid cells
102 in table, which means
103 the allocated width.) */
104 uint32_t height; /** Height of DVS grid table.
105 (= Vertical number of grid cells
106 in table, which cells have effective
107 statistics.)
108 For DVS1, This is equal to
109 the number of horizontal statistics. */
110 uint32_t aligned_height;/** Stride of each grid column.
111 (= Vertical number of grid cells
112 in table, which means
113 the allocated height.) */
114 uint32_t bqs_per_grid_cell; /** Grid cell size in BQ(Bayer Quad) unit.
115 (1BQ means {Gr,R,B,Gb}(2x2 pixels).)
116 For DVS1, valid value is 64.
117 For DVS2, valid value is only 64,
118 currently. */
119 uint32_t num_hor_coefs; /** Number of horizontal coefficients. */
120 uint32_t num_ver_coefs; /** Number of vertical coefficients. */
121 };
122
123 /* Number of DVS statistics levels
124 */
125 #define IA_CSS_DVS_STAT_NUM_OF_LEVELS 3
126
127 /* DVS statistics generated by accelerator global configuration
128 */
129 struct dvs_stat_public_dvs_global_cfg {
130 unsigned char kappa;
131 /** DVS statistics global configuration - kappa */
132 unsigned char match_shift;
133 /** DVS statistics global configuration - match_shift */
134 unsigned char ybin_mode;
135 /** DVS statistics global configuration - y binning mode */
136 };
137
138 /* DVS statistics generated by accelerator level grid
139 * configuration
140 */
141 struct dvs_stat_public_dvs_level_grid_cfg {
142 unsigned char grid_width;
143 /** DVS statistics grid width */
144 unsigned char grid_height;
145 /** DVS statistics grid height */
146 unsigned char block_width;
147 /** DVS statistics block width */
148 unsigned char block_height;
149 /** DVS statistics block height */
150 };
151
152 /* DVS statistics generated by accelerator level grid start
153 * configuration
154 */
155 struct dvs_stat_public_dvs_level_grid_start {
156 unsigned short x_start;
157 /** DVS statistics level x start */
158 unsigned short y_start;
159 /** DVS statistics level y start */
160 unsigned char enable;
161 /** DVS statistics level enable */
162 };
163
164 /* DVS statistics generated by accelerator level grid end
165 * configuration
166 */
167 struct dvs_stat_public_dvs_level_grid_end {
168 unsigned short x_end;
169 /** DVS statistics level x end */
170 unsigned short y_end;
171 /** DVS statistics level y end */
172 };
173
174 /* DVS statistics generated by accelerator Feature Extraction
175 * Region Of Interest (FE-ROI) configuration
176 */
177 struct dvs_stat_public_dvs_level_fe_roi_cfg {
178 unsigned char x_start;
179 /** DVS statistics fe-roi level x start */
180 unsigned char y_start;
181 /** DVS statistics fe-roi level y start */
182 unsigned char x_end;
183 /** DVS statistics fe-roi level x end */
184 unsigned char y_end;
185 /** DVS statistics fe-roi level y end */
186 };
187
188 /* DVS statistics generated by accelerator public configuration
189 */
190 struct dvs_stat_public_dvs_grd_cfg {
191 struct dvs_stat_public_dvs_level_grid_cfg grd_cfg;
192 /** DVS statistics level grid configuration */
193 struct dvs_stat_public_dvs_level_grid_start grd_start;
194 /** DVS statistics level grid start configuration */
195 struct dvs_stat_public_dvs_level_grid_end grd_end;
196 /** DVS statistics level grid end configuration */
197 };
198
199 /* DVS statistics grid generated by accelerator
200 */
201 struct ia_css_dvs_stat_grid_info {
202 struct dvs_stat_public_dvs_global_cfg dvs_gbl_cfg;
203 /** DVS statistics global configuration (kappa, match, binning) */
204 struct dvs_stat_public_dvs_grd_cfg grd_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
205 /** DVS statistics grid configuration (blocks and grids) */
206 struct dvs_stat_public_dvs_level_fe_roi_cfg fe_roi_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
207 /** DVS statistics FE ROI (region of interest) configuration */
208 };
209
210 /* DVS statistics generated by accelerator default grid info
211 */
212 #define DEFAULT_DVS_GRID_INFO { \
213 { \
214 { 0, 0, 0}, /* GBL CFG reg: kappa, match_shifrt, binning mode*/ \
215 {{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
216 {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
217 {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} } }, \
218 {{0, 0, 0, 0}, {4, 0, 0, 0}, {0, 0, 0, 0} } } \
219 }
220
221
222 /* Union that holds all types of DVS statistics grid info in
223 * CSS format
224 * */
225 union ia_css_dvs_grid_u {
226 struct ia_css_dvs_stat_grid_info dvs_stat_grid_info;
227 /** DVS statistics produced by accelerator grid info */
228 struct ia_css_dvs_grid_info dvs_grid_info;
229 /** DVS (DVS1/DVS2) grid info */
230 };
231
232 #endif /* __IA_CSS_SDIS_COMMON_TYPES_H */