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 
12 int mtk_aal_clk_enable(struct device *dev);
13 void mtk_aal_clk_disable(struct device *dev);
14 void mtk_aal_config(struct device *dev, unsigned int w,
15 		    unsigned int h, unsigned int vrefresh,
16 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
17 void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state);
18 void mtk_aal_start(struct device *dev);
19 void mtk_aal_stop(struct device *dev);
20 
21 void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state);
22 int mtk_ccorr_clk_enable(struct device *dev);
23 void mtk_ccorr_clk_disable(struct device *dev);
24 void mtk_ccorr_config(struct device *dev, unsigned int w,
25 		      unsigned int h, unsigned int vrefresh,
26 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
27 void mtk_ccorr_start(struct device *dev);
28 void mtk_ccorr_stop(struct device *dev);
29 
30 void mtk_color_bypass_shadow(struct device *dev);
31 int mtk_color_clk_enable(struct device *dev);
32 void mtk_color_clk_disable(struct device *dev);
33 void mtk_color_config(struct device *dev, unsigned int w,
34 		      unsigned int h, unsigned int vrefresh,
35 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
36 void mtk_color_start(struct device *dev);
37 
38 void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg,
39 			   unsigned int bpc, unsigned int cfg,
40 			   unsigned int dither_en, struct cmdq_pkt *cmdq_pkt);
41 
42 void mtk_dpi_start(struct device *dev);
43 void mtk_dpi_stop(struct device *dev);
44 
45 void mtk_dsi_ddp_start(struct device *dev);
46 void mtk_dsi_ddp_stop(struct device *dev);
47 
48 int mtk_gamma_clk_enable(struct device *dev);
49 void mtk_gamma_clk_disable(struct device *dev);
50 void mtk_gamma_config(struct device *dev, unsigned int w,
51 		      unsigned int h, unsigned int vrefresh,
52 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
53 void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state);
54 void mtk_gamma_set_common(void __iomem *regs, struct drm_crtc_state *state);
55 void mtk_gamma_start(struct device *dev);
56 void mtk_gamma_stop(struct device *dev);
57 
58 void mtk_ovl_bgclr_in_on(struct device *dev);
59 void mtk_ovl_bgclr_in_off(struct device *dev);
60 void mtk_ovl_bypass_shadow(struct device *dev);
61 int mtk_ovl_clk_enable(struct device *dev);
62 void mtk_ovl_clk_disable(struct device *dev);
63 void mtk_ovl_config(struct device *dev, unsigned int w,
64 		    unsigned int h, unsigned int vrefresh,
65 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
66 int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
67 			struct mtk_plane_state *mtk_state);
68 void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
69 			  struct mtk_plane_state *state,
70 			  struct cmdq_pkt *cmdq_pkt);
71 unsigned int mtk_ovl_layer_nr(struct device *dev);
72 void mtk_ovl_layer_on(struct device *dev, unsigned int idx,
73 		      struct cmdq_pkt *cmdq_pkt);
74 void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
75 		       struct cmdq_pkt *cmdq_pkt);
76 void mtk_ovl_start(struct device *dev);
77 void mtk_ovl_stop(struct device *dev);
78 unsigned int mtk_ovl_supported_rotations(struct device *dev);
79 void mtk_ovl_enable_vblank(struct device *dev,
80 			   void (*vblank_cb)(void *),
81 			   void *vblank_cb_data);
82 void mtk_ovl_disable_vblank(struct device *dev);
83 
84 void mtk_rdma_bypass_shadow(struct device *dev);
85 int mtk_rdma_clk_enable(struct device *dev);
86 void mtk_rdma_clk_disable(struct device *dev);
87 void mtk_rdma_config(struct device *dev, unsigned int width,
88 		     unsigned int height, unsigned int vrefresh,
89 		     unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
90 unsigned int mtk_rdma_layer_nr(struct device *dev);
91 void mtk_rdma_layer_config(struct device *dev, unsigned int idx,
92 			   struct mtk_plane_state *state,
93 			   struct cmdq_pkt *cmdq_pkt);
94 void mtk_rdma_start(struct device *dev);
95 void mtk_rdma_stop(struct device *dev);
96 void mtk_rdma_enable_vblank(struct device *dev,
97 			    void (*vblank_cb)(void *),
98 			    void *vblank_cb_data);
99 void mtk_rdma_disable_vblank(struct device *dev);
100 
101 #endif
102