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