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