1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * rcar_cmm.h -- R-Car Display Unit Color Management Module
4  *
5  * Copyright (C) 2019 Jacopo Mondi <jacopo+renesas@jmondi.org>
6  */
7 
8 #ifndef __RCAR_CMM_H__
9 #define __RCAR_CMM_H__
10 
11 #define CM2_LUT_SIZE		256
12 
13 struct drm_color_lut;
14 struct platform_device;
15 
16 /**
17  * struct rcar_cmm_config - CMM configuration
18  *
19  * @lut:	1D-LUT configuration
20  * @lut.table:	1D-LUT table entries. Disable LUT operations when NULL
21  */
22 struct rcar_cmm_config {
23 	struct {
24 		struct drm_color_lut *table;
25 	} lut;
26 };
27 
28 #if IS_ENABLED(CONFIG_DRM_RCAR_CMM)
29 int rcar_cmm_init(struct platform_device *pdev);
30 
31 int rcar_cmm_enable(struct platform_device *pdev);
32 void rcar_cmm_disable(struct platform_device *pdev);
33 
34 int rcar_cmm_setup(struct platform_device *pdev,
35 		   const struct rcar_cmm_config *config);
36 #else
rcar_cmm_init(struct platform_device * pdev)37 static inline int rcar_cmm_init(struct platform_device *pdev)
38 {
39 	return -ENODEV;
40 }
41 
rcar_cmm_enable(struct platform_device * pdev)42 static inline int rcar_cmm_enable(struct platform_device *pdev)
43 {
44 	return 0;
45 }
46 
rcar_cmm_disable(struct platform_device * pdev)47 static inline void rcar_cmm_disable(struct platform_device *pdev)
48 {
49 }
50 
rcar_cmm_setup(struct platform_device * pdev,const struct rcar_cmm_config * config)51 static inline int rcar_cmm_setup(struct platform_device *pdev,
52 				 const struct rcar_cmm_config *config)
53 {
54 	return 0;
55 }
56 #endif /* IS_ENABLED(CONFIG_DRM_RCAR_CMM) */
57 
58 #endif /* __RCAR_CMM_H__ */
59