xref: /linux/drivers/gpu/drm/mediatek/mtk_disp_drv.h (revision 8e07e0e3964ca4e23ce7b68e2096fe660a888942)
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 <linux/soc/mediatek/mtk-mmsys.h>
11 #include <linux/soc/mediatek/mtk-mutex.h>
12 #include "mtk_drm_plane.h"
13 #include "mtk_mdp_rdma.h"
14 
15 int mtk_aal_clk_enable(struct device *dev);
16 void mtk_aal_clk_disable(struct device *dev);
17 void mtk_aal_config(struct device *dev, unsigned int w,
18 		    unsigned int h, unsigned int vrefresh,
19 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
20 unsigned int mtk_aal_gamma_get_lut_size(struct device *dev);
21 void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state);
22 void mtk_aal_start(struct device *dev);
23 void mtk_aal_stop(struct device *dev);
24 
25 void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state);
26 int mtk_ccorr_clk_enable(struct device *dev);
27 void mtk_ccorr_clk_disable(struct device *dev);
28 void mtk_ccorr_config(struct device *dev, unsigned int w,
29 		      unsigned int h, unsigned int vrefresh,
30 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
31 void mtk_ccorr_start(struct device *dev);
32 void mtk_ccorr_stop(struct device *dev);
33 
34 void mtk_color_bypass_shadow(struct device *dev);
35 int mtk_color_clk_enable(struct device *dev);
36 void mtk_color_clk_disable(struct device *dev);
37 void mtk_color_config(struct device *dev, unsigned int w,
38 		      unsigned int h, unsigned int vrefresh,
39 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
40 void mtk_color_start(struct device *dev);
41 
42 void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg,
43 			   unsigned int bpc, unsigned int cfg,
44 			   unsigned int dither_en, struct cmdq_pkt *cmdq_pkt);
45 
46 void mtk_dpi_start(struct device *dev);
47 void mtk_dpi_stop(struct device *dev);
48 unsigned int mtk_dpi_encoder_index(struct device *dev);
49 
50 void mtk_dsi_ddp_start(struct device *dev);
51 void mtk_dsi_ddp_stop(struct device *dev);
52 unsigned int mtk_dsi_encoder_index(struct device *dev);
53 
54 int mtk_gamma_clk_enable(struct device *dev);
55 void mtk_gamma_clk_disable(struct device *dev);
56 void mtk_gamma_config(struct device *dev, unsigned int w,
57 		      unsigned int h, unsigned int vrefresh,
58 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
59 unsigned int mtk_gamma_get_lut_size(struct device *dev);
60 void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state);
61 void mtk_gamma_start(struct device *dev);
62 void mtk_gamma_stop(struct device *dev);
63 
64 int mtk_merge_clk_enable(struct device *dev);
65 void mtk_merge_clk_disable(struct device *dev);
66 void mtk_merge_config(struct device *dev, unsigned int width,
67 		      unsigned int height, unsigned int vrefresh,
68 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
69 void mtk_merge_start(struct device *dev);
70 void mtk_merge_stop(struct device *dev);
71 void mtk_merge_advance_config(struct device *dev, unsigned int l_w, unsigned int r_w,
72 			      unsigned int h, unsigned int vrefresh, unsigned int bpc,
73 			      struct cmdq_pkt *cmdq_pkt);
74 void mtk_merge_start_cmdq(struct device *dev, struct cmdq_pkt *cmdq_pkt);
75 void mtk_merge_stop_cmdq(struct device *dev, struct cmdq_pkt *cmdq_pkt);
76 
77 void mtk_ovl_bgclr_in_on(struct device *dev);
78 void mtk_ovl_bgclr_in_off(struct device *dev);
79 void mtk_ovl_bypass_shadow(struct device *dev);
80 int mtk_ovl_clk_enable(struct device *dev);
81 void mtk_ovl_clk_disable(struct device *dev);
82 void mtk_ovl_config(struct device *dev, unsigned int w,
83 		    unsigned int h, unsigned int vrefresh,
84 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
85 int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
86 			struct mtk_plane_state *mtk_state);
87 void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
88 			  struct mtk_plane_state *state,
89 			  struct cmdq_pkt *cmdq_pkt);
90 unsigned int mtk_ovl_layer_nr(struct device *dev);
91 void mtk_ovl_layer_on(struct device *dev, unsigned int idx,
92 		      struct cmdq_pkt *cmdq_pkt);
93 void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
94 		       struct cmdq_pkt *cmdq_pkt);
95 void mtk_ovl_start(struct device *dev);
96 void mtk_ovl_stop(struct device *dev);
97 unsigned int mtk_ovl_supported_rotations(struct device *dev);
98 void mtk_ovl_register_vblank_cb(struct device *dev,
99 				void (*vblank_cb)(void *),
100 				void *vblank_cb_data);
101 void mtk_ovl_unregister_vblank_cb(struct device *dev);
102 void mtk_ovl_enable_vblank(struct device *dev);
103 void mtk_ovl_disable_vblank(struct device *dev);
104 const u32 *mtk_ovl_get_formats(struct device *dev);
105 size_t mtk_ovl_get_num_formats(struct device *dev);
106 
107 void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex *mutex);
108 void mtk_ovl_adaptor_remove_comp(struct device *dev, struct mtk_mutex *mutex);
109 void mtk_ovl_adaptor_connect(struct device *dev, struct device *mmsys_dev,
110 			     unsigned int next);
111 void mtk_ovl_adaptor_disconnect(struct device *dev, struct device *mmsys_dev,
112 				unsigned int next);
113 int mtk_ovl_adaptor_clk_enable(struct device *dev);
114 void mtk_ovl_adaptor_clk_disable(struct device *dev);
115 void mtk_ovl_adaptor_config(struct device *dev, unsigned int w,
116 			    unsigned int h, unsigned int vrefresh,
117 			    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
118 void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx,
119 				  struct mtk_plane_state *state,
120 				  struct cmdq_pkt *cmdq_pkt);
121 void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(void *),
122 					void *vblank_cb_data);
123 void mtk_ovl_adaptor_unregister_vblank_cb(struct device *dev);
124 void mtk_ovl_adaptor_enable_vblank(struct device *dev);
125 void mtk_ovl_adaptor_disable_vblank(struct device *dev);
126 void mtk_ovl_adaptor_start(struct device *dev);
127 void mtk_ovl_adaptor_stop(struct device *dev);
128 unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev);
129 struct device *mtk_ovl_adaptor_dma_dev_get(struct device *dev);
130 const u32 *mtk_ovl_adaptor_get_formats(struct device *dev);
131 size_t mtk_ovl_adaptor_get_num_formats(struct device *dev);
132 
133 void mtk_rdma_bypass_shadow(struct device *dev);
134 int mtk_rdma_clk_enable(struct device *dev);
135 void mtk_rdma_clk_disable(struct device *dev);
136 void mtk_rdma_config(struct device *dev, unsigned int width,
137 		     unsigned int height, unsigned int vrefresh,
138 		     unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
139 unsigned int mtk_rdma_layer_nr(struct device *dev);
140 void mtk_rdma_layer_config(struct device *dev, unsigned int idx,
141 			   struct mtk_plane_state *state,
142 			   struct cmdq_pkt *cmdq_pkt);
143 void mtk_rdma_start(struct device *dev);
144 void mtk_rdma_stop(struct device *dev);
145 void mtk_rdma_register_vblank_cb(struct device *dev,
146 				 void (*vblank_cb)(void *),
147 				 void *vblank_cb_data);
148 void mtk_rdma_unregister_vblank_cb(struct device *dev);
149 void mtk_rdma_enable_vblank(struct device *dev);
150 void mtk_rdma_disable_vblank(struct device *dev);
151 const u32 *mtk_rdma_get_formats(struct device *dev);
152 size_t mtk_rdma_get_num_formats(struct device *dev);
153 
154 int mtk_mdp_rdma_clk_enable(struct device *dev);
155 void mtk_mdp_rdma_clk_disable(struct device *dev);
156 void mtk_mdp_rdma_start(struct device *dev, struct cmdq_pkt *cmdq_pkt);
157 void mtk_mdp_rdma_stop(struct device *dev, struct cmdq_pkt *cmdq_pkt);
158 void mtk_mdp_rdma_config(struct device *dev, struct mtk_mdp_rdma_cfg *cfg,
159 			 struct cmdq_pkt *cmdq_pkt);
160 const u32 *mtk_mdp_rdma_get_formats(struct device *dev);
161 size_t mtk_mdp_rdma_get_num_formats(struct device *dev);
162 
163 #endif
164