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 #ifndef __IA_CSS_XNR_TYPES_H
17 #define __IA_CSS_XNR_TYPES_H
18 
19 /* @file
20 * CSS-API header file for Extra Noise Reduction (XNR) parameters.
21 */
22 
23 /* XNR table.
24  *
25  *  NOTE: The driver does not need to set this table,
26  *        because the default values are set inside the css.
27  *
28  *  This table contains coefficients used for division in XNR.
29  *
30  *	u0.12, [0,4095],
31  *      {4095, 2048, 1365, .........., 65, 64}
32  *      ({1/1, 1/2, 1/3, ............., 1/63, 1/64})
33  *
34  *  ISP block: XNR1
35  *  ISP1: XNR1 is used.
36  *  ISP2: XNR1 is used.
37  *
38  */
39 
40 /* Number of elements in the xnr table. */
41 #define IA_CSS_VAMEM_1_XNR_TABLE_SIZE_LOG2      6
42 /* Number of elements in the xnr table. */
43 #define IA_CSS_VAMEM_1_XNR_TABLE_SIZE           BIT(IA_CSS_VAMEM_1_XNR_TABLE_SIZE_LOG2)
44 
45 /* Number of elements in the xnr table. */
46 #define IA_CSS_VAMEM_2_XNR_TABLE_SIZE_LOG2      6
47 /* Number of elements in the xnr table. */
48 #define IA_CSS_VAMEM_2_XNR_TABLE_SIZE		BIT(IA_CSS_VAMEM_2_XNR_TABLE_SIZE_LOG2)
49 
50 /** IA_CSS_VAMEM_TYPE_1(ISP2300) or
51      IA_CSS_VAMEM_TYPE_2(ISP2400) */
52 union ia_css_xnr_data {
53 	u16 vamem_1[IA_CSS_VAMEM_1_XNR_TABLE_SIZE];
54 	/** Coefficients table on vamem type1. u0.12, [0,4095] */
55 	u16 vamem_2[IA_CSS_VAMEM_2_XNR_TABLE_SIZE];
56 	/** Coefficients table on vamem type2. u0.12, [0,4095] */
57 };
58 
59 struct ia_css_xnr_table {
60 	enum ia_css_vamem_type vamem_type;
61 	union ia_css_xnr_data data;
62 };
63 
64 struct ia_css_xnr_config {
65 	/* XNR threshold.
66 	 * type:u0.16 valid range:[0,65535]
67 	 * default: 6400 */
68 	u16 threshold;
69 };
70 
71 #endif /* __IA_CSS_XNR_TYPES_H */
72