1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #include "ia_css_types.h"
8 #include "sh_css_defs.h"
9 #include "ia_css_debug.h"
10 #include "assert_support.h"
11 
12 #include "ia_css_ctc.host.h"
13 
14 const struct ia_css_ctc_config default_ctc_config = {
15 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
16 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
17 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
18 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
19 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
20 	((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,		/* 0.5 */
21 	1,
22 	SH_CSS_BAYER_MAXVAL / 5,	/* To be implemented */
23 	SH_CSS_BAYER_MAXVAL * 2 / 5,	/* To be implemented */
24 	SH_CSS_BAYER_MAXVAL * 3 / 5,	/* To be implemented */
25 	SH_CSS_BAYER_MAXVAL * 4 / 5,	/* To be implemented */
26 };
27 
28 void
ia_css_ctc_vamem_encode(struct sh_css_isp_ctc_vamem_params * to,const struct ia_css_ctc_table * from,unsigned int size)29 ia_css_ctc_vamem_encode(
30     struct sh_css_isp_ctc_vamem_params *to,
31     const struct ia_css_ctc_table *from,
32     unsigned int size)
33 {
34 	(void)size;
35 	memcpy(&to->ctc,  &from->data, sizeof(to->ctc));
36 }
37 
38 void
ia_css_ctc_debug_dtrace(const struct ia_css_ctc_config * config,unsigned int level)39 ia_css_ctc_debug_dtrace(
40     const struct ia_css_ctc_config *config,
41     unsigned int level)
42 {
43 	ia_css_debug_dtrace(level,
44 			    "config.ce_gain_exp=%d, config.y0=%d, config.x1=%d, config.y1=%d, config.x2=%d, config.y2=%d, config.x3=%d, config.y3=%d, config.x4=%d, config.y4=%d\n",
45 			    config->ce_gain_exp, config->y0,
46 			    config->x1, config->y1,
47 			    config->x2, config->y2,
48 			    config->x3, config->y3,
49 			    config->x4, config->y4);
50 }
51