xref: /linux/drivers/gpu/drm/mediatek/mtk_disp_drv.h (revision 001821b0e79716c4e17c71d8e053a23599a7a508)
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_mdp_rdma.h"
13 #include "mtk_plane.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 enum drm_mode_status mtk_merge_mode_valid(struct device *dev,
77 					  const struct drm_display_mode *mode);
78 
79 void mtk_ovl_bgclr_in_on(struct device *dev);
80 void mtk_ovl_bgclr_in_off(struct device *dev);
81 void mtk_ovl_bypass_shadow(struct device *dev);
82 int mtk_ovl_clk_enable(struct device *dev);
83 void mtk_ovl_clk_disable(struct device *dev);
84 void mtk_ovl_config(struct device *dev, unsigned int w,
85 		    unsigned int h, unsigned int vrefresh,
86 		    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
87 int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
88 			struct mtk_plane_state *mtk_state);
89 void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
90 			  struct mtk_plane_state *state,
91 			  struct cmdq_pkt *cmdq_pkt);
92 unsigned int mtk_ovl_layer_nr(struct device *dev);
93 void mtk_ovl_layer_on(struct device *dev, unsigned int idx,
94 		      struct cmdq_pkt *cmdq_pkt);
95 void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
96 		       struct cmdq_pkt *cmdq_pkt);
97 void mtk_ovl_start(struct device *dev);
98 void mtk_ovl_stop(struct device *dev);
99 unsigned int mtk_ovl_supported_rotations(struct device *dev);
100 void mtk_ovl_register_vblank_cb(struct device *dev,
101 				void (*vblank_cb)(void *),
102 				void *vblank_cb_data);
103 void mtk_ovl_unregister_vblank_cb(struct device *dev);
104 void mtk_ovl_enable_vblank(struct device *dev);
105 void mtk_ovl_disable_vblank(struct device *dev);
106 const u32 *mtk_ovl_get_formats(struct device *dev);
107 size_t mtk_ovl_get_num_formats(struct device *dev);
108 
109 void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex *mutex);
110 void mtk_ovl_adaptor_remove_comp(struct device *dev, struct mtk_mutex *mutex);
111 void mtk_ovl_adaptor_connect(struct device *dev, struct device *mmsys_dev,
112 			     unsigned int next);
113 void mtk_ovl_adaptor_disconnect(struct device *dev, struct device *mmsys_dev,
114 				unsigned int next);
115 int mtk_ovl_adaptor_power_on(struct device *dev);
116 void mtk_ovl_adaptor_power_off(struct device *dev);
117 int mtk_ovl_adaptor_clk_enable(struct device *dev);
118 void mtk_ovl_adaptor_clk_disable(struct device *dev);
119 void mtk_ovl_adaptor_config(struct device *dev, unsigned int w,
120 			    unsigned int h, unsigned int vrefresh,
121 			    unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
122 void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx,
123 				  struct mtk_plane_state *state,
124 				  struct cmdq_pkt *cmdq_pkt);
125 void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(void *),
126 					void *vblank_cb_data);
127 void mtk_ovl_adaptor_unregister_vblank_cb(struct device *dev);
128 void mtk_ovl_adaptor_enable_vblank(struct device *dev);
129 void mtk_ovl_adaptor_disable_vblank(struct device *dev);
130 void mtk_ovl_adaptor_start(struct device *dev);
131 void mtk_ovl_adaptor_stop(struct device *dev);
132 unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev);
133 struct device *mtk_ovl_adaptor_dma_dev_get(struct device *dev);
134 const u32 *mtk_ovl_adaptor_get_formats(struct device *dev);
135 size_t mtk_ovl_adaptor_get_num_formats(struct device *dev);
136 enum drm_mode_status mtk_ovl_adaptor_mode_valid(struct device *dev,
137 						const struct drm_display_mode *mode);
138 
139 void mtk_rdma_bypass_shadow(struct device *dev);
140 int mtk_rdma_clk_enable(struct device *dev);
141 void mtk_rdma_clk_disable(struct device *dev);
142 void mtk_rdma_config(struct device *dev, unsigned int width,
143 		     unsigned int height, unsigned int vrefresh,
144 		     unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
145 unsigned int mtk_rdma_layer_nr(struct device *dev);
146 void mtk_rdma_layer_config(struct device *dev, unsigned int idx,
147 			   struct mtk_plane_state *state,
148 			   struct cmdq_pkt *cmdq_pkt);
149 void mtk_rdma_start(struct device *dev);
150 void mtk_rdma_stop(struct device *dev);
151 void mtk_rdma_register_vblank_cb(struct device *dev,
152 				 void (*vblank_cb)(void *),
153 				 void *vblank_cb_data);
154 void mtk_rdma_unregister_vblank_cb(struct device *dev);
155 void mtk_rdma_enable_vblank(struct device *dev);
156 void mtk_rdma_disable_vblank(struct device *dev);
157 const u32 *mtk_rdma_get_formats(struct device *dev);
158 size_t mtk_rdma_get_num_formats(struct device *dev);
159 
160 int mtk_mdp_rdma_power_on(struct device *dev);
161 void mtk_mdp_rdma_power_off(struct device *dev);
162 int mtk_mdp_rdma_clk_enable(struct device *dev);
163 void mtk_mdp_rdma_clk_disable(struct device *dev);
164 void mtk_mdp_rdma_start(struct device *dev, struct cmdq_pkt *cmdq_pkt);
165 void mtk_mdp_rdma_stop(struct device *dev, struct cmdq_pkt *cmdq_pkt);
166 void mtk_mdp_rdma_config(struct device *dev, struct mtk_mdp_rdma_cfg *cfg,
167 			 struct cmdq_pkt *cmdq_pkt);
168 const u32 *mtk_mdp_rdma_get_formats(struct device *dev);
169 size_t mtk_mdp_rdma_get_num_formats(struct device *dev);
170 
171 int mtk_padding_clk_enable(struct device *dev);
172 void mtk_padding_clk_disable(struct device *dev);
173 void mtk_padding_start(struct device *dev);
174 void mtk_padding_stop(struct device *dev);
175 #endif
176