1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2020 MediaTek Inc.
4  */
5 
6 #ifndef _MTK_DISP_DRV_H_
7 #define _MTK_DISP_DRV_H_
8 
9 #include <linux/soc/mediatek/mtk-cmdq.h>
10 #include "mtk_drm_plane.h"
11 #include "mtk_mdp_rdma.h"
12 
13 int mtk_aal_clk_enable(struct device *dev);
14 void mtk_aal_clk_disable(struct device *dev);
15 void mtk_aal_config(struct device *dev, unsigned int w,
16 		    unsigned int h, unsigned int vrefresh,
17 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
18 void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state);
19 void mtk_aal_start(struct device *dev);
20 void mtk_aal_stop(struct device *dev);
21 
22 void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state);
23 int mtk_ccorr_clk_enable(struct device *dev);
24 void mtk_ccorr_clk_disable(struct device *dev);
25 void mtk_ccorr_config(struct device *dev, unsigned int w,
26 		      unsigned int h, unsigned int vrefresh,
27 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
28 void mtk_ccorr_start(struct device *dev);
29 void mtk_ccorr_stop(struct device *dev);
30 
31 void mtk_color_bypass_shadow(struct device *dev);
32 int mtk_color_clk_enable(struct device *dev);
33 void mtk_color_clk_disable(struct device *dev);
34 void mtk_color_config(struct device *dev, unsigned int w,
35 		      unsigned int h, unsigned int vrefresh,
36 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
37 void mtk_color_start(struct device *dev);
38 
39 void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg,
40 			   unsigned int bpc, unsigned int cfg,
41 			   unsigned int dither_en, struct cmdq_pkt *cmdq_pkt);
42 
43 void mtk_dpi_start(struct device *dev);
44 void mtk_dpi_stop(struct device *dev);
45 
46 void mtk_dsi_ddp_start(struct device *dev);
47 void mtk_dsi_ddp_stop(struct device *dev);
48 
49 int mtk_gamma_clk_enable(struct device *dev);
50 void mtk_gamma_clk_disable(struct device *dev);
51 void mtk_gamma_config(struct device *dev, unsigned int w,
52 		      unsigned int h, unsigned int vrefresh,
53 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
54 void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state);
55 void mtk_gamma_set_common(void __iomem *regs, struct drm_crtc_state *state, bool lut_diff);
56 void mtk_gamma_start(struct device *dev);
57 void mtk_gamma_stop(struct device *dev);
58 
59 int mtk_merge_clk_enable(struct device *dev);
60 void mtk_merge_clk_disable(struct device *dev);
61 void mtk_merge_config(struct device *dev, unsigned int width,
62 		      unsigned int height, unsigned int vrefresh,
63 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
64 void mtk_merge_start(struct device *dev);
65 void mtk_merge_stop(struct device *dev);
66 void mtk_merge_advance_config(struct device *dev, unsigned int l_w, unsigned int r_w,
67 			      unsigned int h, unsigned int vrefresh, unsigned int bpc,
68 			      struct cmdq_pkt *cmdq_pkt);
69 void mtk_merge_start_cmdq(struct device *dev, struct cmdq_pkt *cmdq_pkt);
70 void mtk_merge_stop_cmdq(struct device *dev, struct cmdq_pkt *cmdq_pkt);
71 
72 void mtk_ovl_bgclr_in_on(struct device *dev);
73 void mtk_ovl_bgclr_in_off(struct device *dev);
74 void mtk_ovl_bypass_shadow(struct device *dev);
75 int mtk_ovl_clk_enable(struct device *dev);
76 void mtk_ovl_clk_disable(struct device *dev);
77 void mtk_ovl_config(struct device *dev, unsigned int w,
78 		    unsigned int h, unsigned int vrefresh,
79 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
80 int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
81 			struct mtk_plane_state *mtk_state);
82 void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
83 			  struct mtk_plane_state *state,
84 			  struct cmdq_pkt *cmdq_pkt);
85 unsigned int mtk_ovl_layer_nr(struct device *dev);
86 void mtk_ovl_layer_on(struct device *dev, unsigned int idx,
87 		      struct cmdq_pkt *cmdq_pkt);
88 void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
89 		       struct cmdq_pkt *cmdq_pkt);
90 void mtk_ovl_start(struct device *dev);
91 void mtk_ovl_stop(struct device *dev);
92 unsigned int mtk_ovl_supported_rotations(struct device *dev);
93 void mtk_ovl_register_vblank_cb(struct device *dev,
94 				void (*vblank_cb)(void *),
95 				void *vblank_cb_data);
96 void mtk_ovl_unregister_vblank_cb(struct device *dev);
97 void mtk_ovl_enable_vblank(struct device *dev);
98 void mtk_ovl_disable_vblank(struct device *dev);
99 
100 void mtk_rdma_bypass_shadow(struct device *dev);
101 int mtk_rdma_clk_enable(struct device *dev);
102 void mtk_rdma_clk_disable(struct device *dev);
103 void mtk_rdma_config(struct device *dev, unsigned int width,
104 		     unsigned int height, unsigned int vrefresh,
105 		     unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
106 unsigned int mtk_rdma_layer_nr(struct device *dev);
107 void mtk_rdma_layer_config(struct device *dev, unsigned int idx,
108 			   struct mtk_plane_state *state,
109 			   struct cmdq_pkt *cmdq_pkt);
110 void mtk_rdma_start(struct device *dev);
111 void mtk_rdma_stop(struct device *dev);
112 void mtk_rdma_register_vblank_cb(struct device *dev,
113 				 void (*vblank_cb)(void *),
114 				 void *vblank_cb_data);
115 void mtk_rdma_unregister_vblank_cb(struct device *dev);
116 void mtk_rdma_enable_vblank(struct device *dev);
117 void mtk_rdma_disable_vblank(struct device *dev);
118 
119 int mtk_mdp_rdma_clk_enable(struct device *dev);
120 void mtk_mdp_rdma_clk_disable(struct device *dev);
121 void mtk_mdp_rdma_start(struct device *dev, struct cmdq_pkt *cmdq_pkt);
122 void mtk_mdp_rdma_stop(struct device *dev, struct cmdq_pkt *cmdq_pkt);
123 void mtk_mdp_rdma_config(struct device *dev, struct mtk_mdp_rdma_cfg *cfg,
124 			 struct cmdq_pkt *cmdq_pkt);
125 #endif
126