]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_param.h
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / sc / sc_1.0 / ia_css_sc_param.h
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_SC_PARAM_H
16 #define __IA_CSS_SC_PARAM_H
17
18 #include "type_support.h"
19
20 #ifdef ISP2401
21 /* To position the shading center grid point on the center of output image,
22 * one more grid cell is needed as margin. */
23 #define SH_CSS_SCTBL_CENTERING_MARGIN 1
24
25 /* The shading table width and height are the number of grids, not cells. The last grid should be counted. */
26 #define SH_CSS_SCTBL_LAST_GRID_COUNT 1
27
28 /* Number of horizontal grids per color in the shading table. */
29 #define _ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
30 (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + \
31 SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
32
33 /* Number of vertical grids per color in the shading table. */
34 #define _ISP_SCTBL_HEIGHT(input_height, deci_factor_log2) \
35 (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + \
36 SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
37
38 /* Legacy API: Number of horizontal grids per color in the shading table. */
39 #define _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
40 (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
41
42 /* Legacy API: Number of vertical grids per color in the shading table. */
43 #define _ISP_SCTBL_LEGACY_HEIGHT(input_height, deci_factor_log2) \
44 (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
45
46 #endif
47 /* SC (Shading Corrction) */
48 struct sh_css_isp_sc_params {
49 int32_t gain_shift;
50 };
51
52 #ifdef ISP2401
53 /* Number of horizontal slice times for interpolated gain:
54 *
55 * The start position of the internal frame does not match the start position of the shading table.
56 * To get a vector of shading gains (interpolated horizontally and vertically)
57 * which matches a vector on the internal frame,
58 * vec_slice is used for 2 adjacent vectors of shading gains.
59 * The number of shift times by vec_slice is 8.
60 * Max grid cell bqs to support the shading table centerting: N = 32
61 * CEIL_DIV(N-1, ISP_SLICE_NELEMS) = CEIL_DIV(31, 4) = 8
62 */
63 #define SH_CSS_SC_INTERPED_GAIN_HOR_SLICE_TIMES 8
64
65 struct sh_css_isp_sc_isp_config {
66 uint32_t interped_gain_hor_slice_bqs[SH_CSS_SC_INTERPED_GAIN_HOR_SLICE_TIMES];
67 uint32_t internal_frame_origin_y_bqs_on_sctbl;
68 };
69
70 #endif
71 #endif /* __IA_CSS_SC_PARAM_H */