1 /*
2  * Copyright (c) 2019 Advanced Micro Devices, Inc. (unpublished)
3  *
4  * All rights reserved.  This notice is intended as a precaution against
5  * inadvertent publication and does not imply publication or any waiver
6  * of confidentiality.  The year included in the foregoing notice is the
7  * year of creation of the work.
8  */
9 
10 #include "color_table.h"
11 
12 static struct fixed31_32 pq_table[MAX_HW_POINTS + 2];
13 static struct fixed31_32 de_pq_table[MAX_HW_POINTS + 2];
14 static bool pq_initialized;
15 static bool de_pg_initialized;
16 
mod_color_is_table_init(enum table_type type)17 bool mod_color_is_table_init(enum table_type type)
18 {
19 	bool ret = false;
20 
21 	if (type == type_pq_table)
22 		ret = pq_initialized;
23 	if (type == type_de_pq_table)
24 		ret = de_pg_initialized;
25 
26 	return ret;
27 }
28 
mod_color_get_table(enum table_type type)29 struct fixed31_32 *mod_color_get_table(enum table_type type)
30 {
31 	struct fixed31_32 *table = NULL;
32 
33 	if (type == type_pq_table)
34 		table = pq_table;
35 	if (type == type_de_pq_table)
36 		table = de_pq_table;
37 
38 	return table;
39 }
40 
mod_color_set_table_init_state(enum table_type type,bool state)41 void mod_color_set_table_init_state(enum table_type type, bool state)
42 {
43 	if (type == type_pq_table)
44 		pq_initialized = state;
45 	if (type == type_de_pq_table)
46 		de_pg_initialized = state;
47 }
48 
49