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