• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_gc2_table.host.h"
23 
24 struct ia_css_rgb_gamma_table default_r_gamma_table;
25 struct ia_css_rgb_gamma_table default_g_gamma_table;
26 struct ia_css_rgb_gamma_table default_b_gamma_table;
27 
28 /* Identical default gamma table for R, G, and B. */
29 
30 
31 static const uint16_t
32 default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = {
33 	0,   72,  144,  216,  288,  360,  426,  486,
34 	541,  592,  641,  687,  730,  772,  812,  850,
35 	887,  923,  958,  991, 1024, 1055, 1086, 1117,
36 	1146, 1175, 1203, 1230, 1257, 1284, 1310, 1335,
37 	1360, 1385, 1409, 1433, 1457, 1480, 1502, 1525,
38 	1547, 1569, 1590, 1612, 1632, 1653, 1674, 1694,
39 	1714, 1734, 1753, 1772, 1792, 1811, 1829, 1848,
40 	1866, 1884, 1902, 1920, 1938, 1955, 1973, 1990,
41 	2007, 2024, 2040, 2057, 2074, 2090, 2106, 2122,
42 	2138, 2154, 2170, 2185, 2201, 2216, 2231, 2247,
43 	2262, 2277, 2291, 2306, 2321, 2335, 2350, 2364,
44 	2378, 2393, 2407, 2421, 2435, 2449, 2462, 2476,
45 	2490, 2503, 2517, 2530, 2543, 2557, 2570, 2583,
46 	2596, 2609, 2622, 2634, 2647, 2660, 2673, 2685,
47 	2698, 2710, 2722, 2735, 2747, 2759, 2771, 2783,
48 	2795, 2807, 2819, 2831, 2843, 2855, 2867, 2878,
49 	2890, 2901, 2913, 2924, 2936, 2947, 2958, 2970,
50 	2981, 2992, 3003, 3014, 3025, 3036, 3047, 3058,
51 	3069, 3080, 3091, 3102, 3112, 3123, 3134, 3144,
52 	3155, 3165, 3176, 3186, 3197, 3207, 3217, 3228,
53 	3238, 3248, 3258, 3268, 3279, 3289, 3299, 3309,
54 	3319, 3329, 3339, 3349, 3358, 3368, 3378, 3388,
55 	3398, 3407, 3417, 3427, 3436, 3446, 3455, 3465,
56 	3474, 3484, 3493, 3503, 3512, 3521, 3531, 3540,
57 	3549, 3559, 3568, 3577, 3586, 3595, 3605, 3614,
58 	3623, 3632, 3641, 3650, 3659, 3668, 3677, 3686,
59 	3694, 3703, 3712, 3721, 3730, 3739, 3747, 3756,
60 	3765, 3773, 3782, 3791, 3799, 3808, 3816, 3825,
61 	3833, 3842, 3850, 3859, 3867, 3876, 3884, 3893,
62 	3901, 3909, 3918, 3926, 3934, 3942, 3951, 3959,
63 	3967, 3975, 3984, 3992, 4000, 4008, 4016, 4024,
64 	4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088,
65 	4095
66 };
67 
68 void
ia_css_config_rgb_gamma_tables(void)69 ia_css_config_rgb_gamma_tables(void)
70 {
71 	default_r_gamma_table.vamem_type   = IA_CSS_VAMEM_TYPE_2;
72 	default_g_gamma_table.vamem_type   = IA_CSS_VAMEM_TYPE_2;
73 	default_b_gamma_table.vamem_type   = IA_CSS_VAMEM_TYPE_2;
74 	memcpy(default_r_gamma_table.data.vamem_2, default_gamma_table_data,
75 	       sizeof(default_gamma_table_data));
76 	memcpy(default_g_gamma_table.data.vamem_2, default_gamma_table_data,
77 	       sizeof(default_gamma_table_data));
78 	memcpy(default_b_gamma_table.data.vamem_2, default_gamma_table_data,
79 	       sizeof(default_gamma_table_data));
80 }
81