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