GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / ob / ob2 / ia_css_ob2.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 "sh_css_frac.h"
18 #ifndef IA_CSS_NO_DEBUG
19 #include "ia_css_debug.h"
20 #endif
21 #include "isp.h"
22 #include "ia_css_ob2.host.h"
23
24 const struct ia_css_ob2_config default_ob2_config = {
25         0,
26         0,
27         0,
28         0
29 };
30
31 void
32 ia_css_ob2_encode(
33         struct sh_css_isp_ob2_params *to,
34         const struct ia_css_ob2_config *from,
35         unsigned size)
36 {
37         (void)size;
38
39         /* Blacklevels types are u0_16 */
40         to->blacklevel_gr = uDIGIT_FITTING(from->level_gr, 16, SH_CSS_BAYER_BITS);
41         to->blacklevel_r  = uDIGIT_FITTING(from->level_r,  16, SH_CSS_BAYER_BITS);
42         to->blacklevel_b  = uDIGIT_FITTING(from->level_b,  16, SH_CSS_BAYER_BITS);
43         to->blacklevel_gb = uDIGIT_FITTING(from->level_gb, 16, SH_CSS_BAYER_BITS);
44 }
45
46 #ifndef IA_CSS_NO_DEBUG
47 void
48 ia_css_ob2_dump(
49         const struct sh_css_isp_ob2_params *ob2,
50         unsigned level)
51 {
52         if (!ob2)
53                 return;
54
55         ia_css_debug_dtrace(level, "Optical Black 2:\n");
56         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
57                 "ob2_blacklevel_gr", ob2->blacklevel_gr);
58         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
59                 "ob2_blacklevel_r", ob2->blacklevel_r);
60         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
61                 "ob2_blacklevel_b", ob2->blacklevel_b);
62         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
63                 "ob2_blacklevel_gb", ob2->blacklevel_gb);
64
65 }
66
67
68 void
69 ia_css_ob2_debug_dtrace(
70         const struct ia_css_ob2_config *config,
71         unsigned level)
72 {
73         ia_css_debug_dtrace(level,
74                 "config.level_gr=%d, config.level_r=%d, "
75                 "config.level_b=%d,  config.level_gb=%d, ",
76                 config->level_gr, config->level_r,
77                 config->level_b, config->level_gb);
78 }
79 #endif