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_ctc_table.host.h"
23 
24 struct ia_css_ctc_table       default_ctc_table;
25 
26 
27 static const uint16_t
28 default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = {
29 	0,  384,  837,  957, 1011, 1062, 1083, 1080,
30 	1078, 1077, 1053, 1039, 1012,  992,  969,  951,
31 	929,  906,  886,  866,  845,  823,  809,  790,
32 	772,  758,  741,  726,  711,  701,  688,  675,
33 	666,  656,  648,  639,  633,  626,  618,  612,
34 	603,  594,  582,  572,  557,  545,  529,  516,
35 	504,  491,  480,  467,  459,  447,  438,  429,
36 	419,  412,  404,  397,  389,  382,  376,  368,
37 	363,  357,  351,  345,  340,  336,  330,  326,
38 	321,  318,  312,  308,  304,  300,  297,  294,
39 	291,  286,  284,  281,  278,  275,  271,  268,
40 	261,  257,  251,  245,  240,  235,  232,  225,
41 	223,  218,  213,  209,  206,  204,  199,  197,
42 	193,  189,  186,  185,  183,  179,  177,  175,
43 	172,  170,  169,  167,  164,  164,  162,  160,
44 	158,  157,  156,  154,  154,  152,  151,  150,
45 	149,  148,  146,  147,  146,  144,  143,  143,
46 	142,  141,  140,  141,  139,  138,  138,  138,
47 	137,  136,  136,  135,  134,  134,  134,  133,
48 	132,  132,  131,  130,  131,  130,  129,  128,
49 	129,  127,  127,  127,  127,  125,  125,  125,
50 	123,  123,  122,  120,  118,  115,  114,  111,
51 	110,  108,  106,  105,  103,  102,  100,   99,
52 	97,   97,   96,   95,   94,   93,   93,   91,
53 	91,   91,   90,   90,   89,   89,   88,   88,
54 	89,   88,   88,   87,   87,   87,   87,   86,
55 	87,   87,   86,   87,   86,   86,   84,   84,
56 	82,   80,   78,   76,   74,   72,   70,   68,
57 	67,   65,   62,   60,   58,   56,   55,   54,
58 	53,   51,   49,   49,   47,   45,   45,   45,
59 	41,   40,   39,   39,   34,   33,   34,   32,
60 	25,   23,   24,   20,   13,    9,   12,    0,
61 	0
62 };
63 
64 
65 void
ia_css_config_ctc_table(void)66 ia_css_config_ctc_table(void)
67 {
68 	memcpy(default_ctc_table.data.vamem_2, default_ctc_table_data,
69 	       sizeof(default_ctc_table_data));
70 	default_ctc_table.vamem_type     = IA_CSS_VAMEM_TYPE_2;
71 }
72