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 <linux/string.h> /* for memcpy() */
17 
18 #include <type_support.h>
19 #include "system_global.h"
20 #include "vamem.h"
21 #include "ia_css_types.h"
22 #include "ia_css_xnr_table.host.h"
23 
24 struct ia_css_xnr_table default_xnr_table;
25 
26 
27 static const uint16_t
28 default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = {
29 	/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
30 	8191 >> 1, 4096 >> 1, 2730 >> 1, 2048 >> 1, 1638 >> 1, 1365 >> 1, 1170 >> 1, 1024 >> 1, 910 >> 1, 819 >> 1, 744 >> 1, 682 >> 1, 630 >> 1, 585 >> 1,
31 	     546 >> 1, 512 >> 1,
32 
33 	     /* 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 */
34 	     481 >> 1, 455 >> 1, 431 >> 1, 409 >> 1, 390 >> 1, 372 >> 1, 356 >> 1, 341 >> 1, 327 >> 1, 315 >> 1, 303 >> 1, 292 >> 1, 282 >> 1, 273 >> 1, 264 >> 1,
35 	     256 >> 1,
36 
37 	     /* 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 */
38 	     248 >> 1, 240 >> 1, 234 >> 1, 227 >> 1, 221 >> 1, 215 >> 1, 210 >> 1, 204 >> 1, 199 >> 1, 195 >> 1, 190 >> 1, 186 >> 1, 182 >> 1, 178 >> 1, 174 >> 1,
39 	     170 >> 1,
40 
41 	     /* 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 */
42 	     167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1
43 };
44 
45 
46 void
ia_css_config_xnr_table(void)47 ia_css_config_xnr_table(void)
48 {
49 	memcpy(default_xnr_table.data.vamem_2, default_xnr_table_data,
50 	       sizeof(default_xnr_table_data));
51 	default_xnr_table.vamem_type     = IA_CSS_VAMEM_TYPE_2;
52 }
53