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 u32 mtk_ovl_get_blend_modes(struct device *dev); 107 const u32 *mtk_ovl_get_formats(struct device *dev); 108 size_t mtk_ovl_get_num_formats(struct device *dev); 109 110 void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex *mutex); 111 void mtk_ovl_adaptor_remove_comp(struct device *dev, struct mtk_mutex *mutex); 112 void mtk_ovl_adaptor_connect(struct device *dev, struct device *mmsys_dev, 113 unsigned int next); 114 void mtk_ovl_adaptor_disconnect(struct device *dev, struct device *mmsys_dev, 115 unsigned int next); 116 int mtk_ovl_adaptor_power_on(struct device *dev); 117 void mtk_ovl_adaptor_power_off(struct device *dev); 118 int mtk_ovl_adaptor_clk_enable(struct device *dev); 119 void mtk_ovl_adaptor_clk_disable(struct device *dev); 120 void mtk_ovl_adaptor_config(struct device *dev, unsigned int w, 121 unsigned int h, unsigned int vrefresh, 122 unsigned int bpc, struct cmdq_pkt *cmdq_pkt); 123 void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx, 124 struct mtk_plane_state *state, 125 struct cmdq_pkt *cmdq_pkt); 126 void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(void *), 127 void *vblank_cb_data); 128 void mtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); 129 void mtk_ovl_adaptor_enable_vblank(struct device *dev); 130 void mtk_ovl_adaptor_disable_vblank(struct device *dev); 131 void mtk_ovl_adaptor_start(struct device *dev); 132 void mtk_ovl_adaptor_stop(struct device *dev); 133 unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev); 134 struct device *mtk_ovl_adaptor_dma_dev_get(struct device *dev); 135 u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev); 136 const u32 *mtk_ovl_adaptor_get_formats(struct device *dev); 137 size_t mtk_ovl_adaptor_get_num_formats(struct device *dev); 138 enum drm_mode_status mtk_ovl_adaptor_mode_valid(struct device *dev, 139 const struct drm_display_mode *mode); 140 141 void mtk_rdma_bypass_shadow(struct device *dev); 142 int mtk_rdma_clk_enable(struct device *dev); 143 void mtk_rdma_clk_disable(struct device *dev); 144 void mtk_rdma_config(struct device *dev, unsigned int width, 145 unsigned int height, unsigned int vrefresh, 146 unsigned int bpc, struct cmdq_pkt *cmdq_pkt); 147 unsigned int mtk_rdma_layer_nr(struct device *dev); 148 void mtk_rdma_layer_config(struct device *dev, unsigned int idx, 149 struct mtk_plane_state *state, 150 struct cmdq_pkt *cmdq_pkt); 151 void mtk_rdma_start(struct device *dev); 152 void mtk_rdma_stop(struct device *dev); 153 void mtk_rdma_register_vblank_cb(struct device *dev, 154 void (*vblank_cb)(void *), 155 void *vblank_cb_data); 156 void mtk_rdma_unregister_vblank_cb(struct device *dev); 157 void mtk_rdma_enable_vblank(struct device *dev); 158 void mtk_rdma_disable_vblank(struct device *dev); 159 const u32 *mtk_rdma_get_formats(struct device *dev); 160 size_t mtk_rdma_get_num_formats(struct device *dev); 161 162 int mtk_mdp_rdma_power_on(struct device *dev); 163 void mtk_mdp_rdma_power_off(struct device *dev); 164 int mtk_mdp_rdma_clk_enable(struct device *dev); 165 void mtk_mdp_rdma_clk_disable(struct device *dev); 166 void mtk_mdp_rdma_start(struct device *dev, struct cmdq_pkt *cmdq_pkt); 167 void mtk_mdp_rdma_stop(struct device *dev, struct cmdq_pkt *cmdq_pkt); 168 void mtk_mdp_rdma_config(struct device *dev, struct mtk_mdp_rdma_cfg *cfg, 169 struct cmdq_pkt *cmdq_pkt); 170 const u32 *mtk_mdp_rdma_get_formats(struct device *dev); 171 size_t mtk_mdp_rdma_get_num_formats(struct device *dev); 172 173 int mtk_padding_clk_enable(struct device *dev); 174 void mtk_padding_clk_disable(struct device *dev); 175 void mtk_padding_start(struct device *dev); 176 void mtk_padding_stop(struct device *dev); 177 #endif 178