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 "sh_css_frac.h"
19 
20 #include "ia_css_xnr.host.h"
21 
22 const struct ia_css_xnr_config default_xnr_config = {
23 	/* default threshold 6400 translates to 25 on ISP. */
24 	6400
25 };
26 
27 void
28 ia_css_xnr_table_vamem_encode(
29     struct sh_css_isp_xnr_vamem_params *to,
30     const struct ia_css_xnr_table *from,
31     unsigned int size)
32 {
33 	(void)size;
34 	memcpy(&to->xnr,  &from->data, sizeof(to->xnr));
35 }
36 
37 void
38 ia_css_xnr_encode(
39     struct sh_css_isp_xnr_params *to,
40     const struct ia_css_xnr_config *from,
41     unsigned int size)
42 {
43 	(void)size;
44 
45 	to->threshold =
46 	    (uint16_t)uDIGIT_FITTING(from->threshold, 16, SH_CSS_ISP_YUV_BITS);
47 }
48 
49 void
50 ia_css_xnr_table_debug_dtrace(
51     const struct ia_css_xnr_table *config,
52     unsigned int level)
53 {
54 	(void)config;
55 	(void)level;
56 }
57 
58 void
59 ia_css_xnr_debug_dtrace(
60     const struct ia_css_xnr_config *config,
61     unsigned int level)
62 {
63 	ia_css_debug_dtrace(level,
64 			    "config.threshold=%d\n", config->threshold);
65 }
66