1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __IA_CSS_GC2_TYPES_H
17 #define __IA_CSS_GC2_TYPES_H
18 
19 #include "isp/kernels/ctc/ctc_1.0/ia_css_ctc_types.h"  /* FIXME: needed for ia_css_vamem_type */
20 
21 /* @file
22 * CSS-API header file for Gamma Correction parameters.
23 */
24 
25 /* sRGB Gamma table, used for sRGB Gamma Correction.
26  *
27  *  ISP block: GC2 (sRGB Gamma Correction)
28  * (ISP1: GC1(YUV Gamma Correction) is used.)
29  *  ISP2: GC2 is used.
30  */
31 
32 /* Number of elements in the sRGB gamma table. */
33 #define IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE_LOG2 8
34 #define IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE      BIT(IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE_LOG2)
35 
36 /* Number of elements in the sRGB gamma table. */
37 #define IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE_LOG2    8
38 #define IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE     ((1U << IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE_LOG2) + 1)
39 
40 /** IA_CSS_VAMEM_TYPE_1(ISP2300) or
41      IA_CSS_VAMEM_TYPE_2(ISP2400) */
42 union ia_css_rgb_gamma_data {
43 	u16 vamem_1[IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE];
44 	/** RGB Gamma table on vamem type1. This table is not used,
45 		because sRGB Gamma Correction is not implemented for ISP2300. */
46 	u16 vamem_2[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE];
47 	/** RGB Gamma table on vamem type2. u0.12, [0,4095] */
48 };
49 
50 struct ia_css_rgb_gamma_table {
51 	enum ia_css_vamem_type vamem_type;
52 	union ia_css_rgb_gamma_data data;
53 };
54 
55 #endif /* __IA_CSS_GC2_TYPES_H */
56