381e5730d405cf26069ea6aced8b01cbea3eb5eb
[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 /* DVS statistics grid
45 *
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.
50 */
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
55 statistics.)
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
60 in table, which means
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
65 statistics.)
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
70 in table, which means
71 the allocated height.) */
72 };
73
74 /* TODO: use ia_css_dvs_grid_res in here.
75 * However, that implies driver I/F changes
76 */
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
83 statistics.)
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
88 in table, which means
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
93 statistics.)
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
98 in table, which means
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,
104 currently. */
105 uint32_t num_hor_coefs; /** Number of horizontal coefficients. */
106 uint32_t num_ver_coefs; /** Number of vertical coefficients. */
107 };
108
109 /* Number of DVS statistics levels
110 */
111 #define IA_CSS_DVS_STAT_NUM_OF_LEVELS 3
112
113 /* DVS statistics generated by accelerator global configuration
114 */
115 struct dvs_stat_public_dvs_global_cfg {
116 unsigned char kappa;
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 */
122 };
123
124 /* DVS statistics generated by accelerator level grid
125 * configuration
126 */
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 */
136 };
137
138 /* DVS statistics generated by accelerator level grid start
139 * configuration
140 */
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 */
148 };
149
150 /* DVS statistics generated by accelerator level grid end
151 * configuration
152 */
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 */
158 };
159
160 /* DVS statistics generated by accelerator Feature Extraction
161 * Region Of Interest (FE-ROI) configuration
162 */
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 */
168 unsigned char x_end;
169 /** DVS statistics fe-roi level x end */
170 unsigned char y_end;
171 /** DVS statistics fe-roi level y end */
172 };
173
174 /* DVS statistics generated by accelerator public configuration
175 */
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 */
183 };
184
185 /* DVS statistics grid generated by accelerator
186 */
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 */
194 };
195
196 /* DVS statistics generated by accelerator default grid info
197 */
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) { \
201 .fe_roi_cfg = { \
202 [1] = (struct dvs_stat_public_dvs_level_fe_roi_cfg) { \
203 .x_start = 4 \
204 } \
205 } \
206 } \
207 }
208
209 /* Union that holds all types of DVS statistics grid info in
210 * CSS format
211 * */
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 */
217 };
218
219 #endif /* __IA_CSS_SDIS_COMMON_TYPES_H */