aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h
blob: 031983c357e4732865fe1f07a2012eba116682a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __IA_CSS_SDIS_COMMON_TYPES_H
#define __IA_CSS_SDIS_COMMON_TYPES_H

/* @file
* CSS-API header file for DVS statistics parameters.
*/

#include <type_support.h>

/* DVS statistics grid dimensions in number of cells.
 */

struct ia_css_dvs_grid_dim {
	uint32_t width;		/** Width of DVS grid table in cells */
	uint32_t height;	/** Height of DVS grid table in cells */
};

/* DVS statistics dimensions in number of cells for
 * grid, coeffieicient and projection.
 */

struct ia_css_sdis_info {
	struct {
		struct ia_css_dvs_grid_dim dim; /* Dimensions */
		struct ia_css_dvs_grid_dim pad; /* Padded dimensions */
	} grid, coef, proj;
	uint32_t deci_factor_log2;
};

#define IA_CSS_DEFAULT_SDIS_INFO \
	{	\
		{	{ 0, 0 },	/* dim */ \
			{ 0, 0 },	/* pad */ \
		},	/* grid */ \
		{	{ 0, 0 },	/* dim */ \
			{ 0, 0 },	/* pad */ \
		},	/* coef */ \
		{	{ 0, 0 },	/* dim */ \
			{ 0, 0 },	/* pad */ \
		},	/* proj */ \
		0,	/* dis_deci_factor_log2 */ \
	}

/* DVS statistics grid
 *
 *  ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes))
 *             SDVS2 (DVS Support for DVS ver.2 (6-axes))
 *  ISP1: SDVS1 is used.
 *  ISP2: SDVS2 is used.
 */
struct ia_css_dvs_grid_res {
	uint32_t width;	    	/** Width of DVS grid table.
					(= Horizontal number of grid cells
					in table, which cells have effective
					statistics.)
					For DVS1, this is equal to
					 the number of vertical statistics. */
	uint32_t aligned_width; /** Stride of each grid line.
					(= Horizontal number of grid cells
					in table, which means
					the allocated width.) */
	uint32_t height;	/** Height of DVS grid table.
					(= Vertical number of grid cells
					in table, which cells have effective
					statistics.)
					For DVS1, This is equal to
					the number of horizontal statistics. */
	uint32_t aligned_height;/** Stride of each grid column.
					(= Vertical number of grid cells
					in table, which means
					the allocated height.) */
};

/* TODO: use ia_css_dvs_grid_res in here.
 * However, that implies driver I/F changes
 */
struct ia_css_dvs_grid_info {
	uint32_t enable;        /** DVS statistics enabled.
					0:disabled, 1:enabled */
	uint32_t width;	    	/** Width of DVS grid table.
					(= Horizontal number of grid cells
					in table, which cells have effective
					statistics.)
					For DVS1, this is equal to
					 the number of vertical statistics. */
	uint32_t aligned_width; /** Stride of each grid line.
					(= Horizontal number of grid cells
					in table, which means
					the allocated width.) */
	uint32_t height;	/** Height of DVS grid table.
					(= Vertical number of grid cells
					in table, which cells have effective
					statistics.)
					For DVS1, This is equal to
					the number of horizontal statistics. */
	uint32_t aligned_height;/** Stride of each grid column.
					(= Vertical number of grid cells
					in table, which means
					the allocated height.) */
	uint32_t bqs_per_grid_cell; /** Grid cell size in BQ(Bayer Quad) unit.
					(1BQ means {Gr,R,B,Gb}(2x2 pixels).)
					For DVS1, valid value is 64.
					For DVS2, valid value is only 64,
					currently. */
	uint32_t num_hor_coefs;	/** Number of horizontal coefficients. */
	uint32_t num_ver_coefs;	/** Number of vertical coefficients. */
};

/* Number of DVS statistics levels
 */
#define IA_CSS_DVS_STAT_NUM_OF_LEVELS	3

/* DVS statistics generated by accelerator global configuration
 */
struct dvs_stat_public_dvs_global_cfg {
	unsigned char kappa;
	/** DVS statistics global configuration - kappa */
	unsigned char match_shift;
	/** DVS statistics global configuration - match_shift */
	unsigned char ybin_mode;
	/** DVS statistics global configuration - y binning mode */
};

/* DVS statistics generated by accelerator level grid
 *  configuration
 */
struct dvs_stat_public_dvs_level_grid_cfg {
	unsigned char grid_width;
	/** DVS statistics grid width */
	unsigned char grid_height;
	/** DVS statistics grid height */
	unsigned char block_width;
	/** DVS statistics block width */
	unsigned char block_height;
	/** DVS statistics block  height */
};

/* DVS statistics generated by accelerator level grid start
 *  configuration
 */
struct dvs_stat_public_dvs_level_grid_start {
	unsigned short x_start;
	/** DVS statistics level x start */
	unsigned short y_start;
	/** DVS statistics level y start */
	unsigned char enable;
	/** DVS statistics level enable */
};

/* DVS statistics generated by accelerator level grid end
 *  configuration
 */
struct dvs_stat_public_dvs_level_grid_end {
	unsigned short x_end;
	/** DVS statistics level x end */
	unsigned short y_end;
	/** DVS statistics level y end */
};

/* DVS statistics generated by accelerator Feature Extraction
 *  Region Of Interest (FE-ROI) configuration
 */
struct dvs_stat_public_dvs_level_fe_roi_cfg {
	unsigned char x_start;
	/** DVS statistics fe-roi level x start */
	unsigned char y_start;
	/** DVS statistics fe-roi level y start */
	unsigned char x_end;
	/** DVS statistics fe-roi level x end */
	unsigned char y_end;
	/** DVS statistics fe-roi level y end */
};

/* DVS statistics generated by accelerator public configuration
 */
struct dvs_stat_public_dvs_grd_cfg {
	struct dvs_stat_public_dvs_level_grid_cfg    grd_cfg;
	/** DVS statistics level grid configuration */
	struct dvs_stat_public_dvs_level_grid_start  grd_start;
	/** DVS statistics level grid start configuration */
	struct dvs_stat_public_dvs_level_grid_end    grd_end;
	/** DVS statistics level grid end configuration */
};

/* DVS statistics grid generated by accelerator
 */
struct ia_css_dvs_stat_grid_info {
	struct dvs_stat_public_dvs_global_cfg       dvs_gbl_cfg;
	/** DVS statistics global configuration (kappa, match, binning) */
	struct dvs_stat_public_dvs_grd_cfg       grd_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
	/** DVS statistics grid configuration (blocks and grids) */
	struct dvs_stat_public_dvs_level_fe_roi_cfg fe_roi_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
	/** DVS statistics FE ROI (region of interest) configuration */
};

/* DVS statistics generated by accelerator default grid info
 */
#define DEFAULT_DVS_GRID_INFO { \
{ \
	{ 0, 0, 0},	/* GBL CFG reg: kappa, match_shifrt, binning mode*/ \
	{{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
	{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
	{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} } }, \
	{{0, 0, 0, 0}, {4, 0, 0, 0}, {0, 0, 0, 0} } } \
}


/* Union that holds all types of DVS statistics grid info in
 *  CSS format
 * */
union ia_css_dvs_grid_u {
	struct ia_css_dvs_stat_grid_info dvs_stat_grid_info;
	/** DVS statistics produced by accelerator grid info */
	struct ia_css_dvs_grid_info dvs_grid_info;
	/** DVS (DVS1/DVS2) grid info */
};

#endif /* __IA_CSS_SDIS_COMMON_TYPES_H */