GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / ctc / ctc_1.0 / ia_css_ctc.host.c
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 #include "ia_css_types.h"
16 #include "sh_css_defs.h"
17 #include "ia_css_debug.h"
18 #include "assert_support.h"
19
20 #include "ia_css_ctc.host.h"
21
22 const struct ia_css_ctc_config default_ctc_config = {
23         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
24         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
25         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
26         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
27         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
28         ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2,         /* 0.5 */
29         1,
30         SH_CSS_BAYER_MAXVAL / 5,        /* To be implemented */
31         SH_CSS_BAYER_MAXVAL * 2 / 5,    /* To be implemented */
32         SH_CSS_BAYER_MAXVAL * 3 / 5,    /* To be implemented */
33         SH_CSS_BAYER_MAXVAL * 4 / 5,    /* To be implemented */
34 };
35
36 void
37 ia_css_ctc_vamem_encode(
38         struct sh_css_isp_ctc_vamem_params *to,
39         const struct ia_css_ctc_table *from,
40         unsigned size)
41 {
42         (void)size;
43         memcpy (&to->ctc,  &from->data, sizeof(to->ctc));
44 }
45
46 void
47 ia_css_ctc_debug_dtrace(
48         const struct ia_css_ctc_config *config,
49         unsigned level)
50 {
51         ia_css_debug_dtrace(level,
52                 "config.ce_gain_exp=%d, config.y0=%d, "
53                 "config.x1=%d, config.y1=%d, "
54                 "config.x2=%d, config.y2=%d, "
55                 "config.x3=%d, config.y3=%d, "
56                 "config.x4=%d, config.y4=%d\n",
57                 config->ce_gain_exp, config->y0,
58                 config->x1, config->y1,
59                 config->x2, config->y2,
60                 config->x3, config->y3,
61                 config->x4, config->y4);
62 }
63