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_GC_PARAM_H
17 #define __IA_CSS_GC_PARAM_H
18 
19 #include "type_support.h"
20 #ifndef PIPE_GENERATION
21 #ifdef __ISP
22 #define __INLINE_VAMEM__
23 #endif
24 #include "vamem.h"
25 #include "ia_css_gc_types.h"
26 
27 #if defined(IS_VAMEM_VERSION_1)
28 #define SH_CSS_ISP_GAMMA_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE_LOG2
29 #define SH_CSS_ISP_GC_TABLE_SIZE	 IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE
30 #elif defined(IS_VAMEM_VERSION_2)
31 #define SH_CSS_ISP_GAMMA_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE_LOG2
32 #define SH_CSS_ISP_GC_TABLE_SIZE	 IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE
33 #else
34 #error "Undefined vamem version"
35 #endif
36 
37 #else
38 /* For pipe generation, the size is not relevant */
39 #define SH_CSS_ISP_GC_TABLE_SIZE 0
40 #endif
41 
42 #define GAMMA_OUTPUT_BITS		8
43 #define GAMMA_OUTPUT_MAX_VAL		((1 << GAMMA_OUTPUT_BITS) - 1)
44 
45 /* GC (Gamma Correction) */
46 struct sh_css_isp_gc_params {
47 	s32 gain_k1;
48 	s32 gain_k2;
49 };
50 
51 /* CE (Chroma Enhancement) */
52 struct sh_css_isp_ce_params {
53 	s32 uv_level_min;
54 	s32 uv_level_max;
55 };
56 
57 /* This should be vamem_data_t, but that breaks the pipe generator */
58 struct sh_css_isp_gc_vamem_params {
59 	u16 gc[SH_CSS_ISP_GC_TABLE_SIZE];
60 };
61 
62 #endif /* __IA_CSS_GC_PARAM_H */
63