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 #include "ia_css_types.h"
17 #include "sh_css_defs.h"
18 #include "ia_css_debug.h"
19 
20 #include "ia_css_cnr2.host.h"
21 
22 const struct ia_css_cnr_config default_cnr_config = {
23 	0,
24 	0,
25 	100,
26 	100,
27 	100,
28 	50,
29 	50,
30 	50
31 };
32 
33 void
34 ia_css_cnr_encode(
35     struct sh_css_isp_cnr_params *to,
36     const struct ia_css_cnr_config *from,
37     unsigned int size)
38 {
39 	(void)size;
40 	to->coring_u = from->coring_u;
41 	to->coring_v = from->coring_v;
42 	to->sense_gain_vy = from->sense_gain_vy;
43 	to->sense_gain_vu = from->sense_gain_vu;
44 	to->sense_gain_vv = from->sense_gain_vv;
45 	to->sense_gain_hy = from->sense_gain_hy;
46 	to->sense_gain_hu = from->sense_gain_hu;
47 	to->sense_gain_hv = from->sense_gain_hv;
48 }
49 
50 void
51 ia_css_cnr_dump(
52     const struct sh_css_isp_cnr_params *cnr,
53     unsigned int level);
54 
55 void
56 ia_css_cnr_debug_dtrace(
57     const struct ia_css_cnr_config *config,
58     unsigned int level)
59 {
60 	ia_css_debug_dtrace(level,
61 			    "config.coring_u=%d, config.coring_v=%d, config.sense_gain_vy=%d, config.sense_gain_hy=%d, config.sense_gain_vu=%d, config.sense_gain_hu=%d, config.sense_gain_vv=%d, config.sense_gain_hv=%d\n",
62 			    config->coring_u, config->coring_v,
63 			    config->sense_gain_vy, config->sense_gain_hy,
64 			    config->sense_gain_vu, config->sense_gain_hu,
65 			    config->sense_gain_vv, config->sense_gain_hv);
66 }
67 
68 void
69 ia_css_init_cnr2_state(
70     void/*struct sh_css_isp_cnr_vmem_state*/ * state,
71     size_t size)
72 {
73 	memset(state, 0, size);
74 }
75