mtk_drm_ddp.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef MTK_DRM_DDP_H
  14. #define MTK_DRM_DDP_H
  15. #include "mtk_drm_ddp_comp.h"
  16. #include "mtk_drm_crtc.h"
  17. #include <linux/soc/mediatek/mtk-cmdq.h>
  18. #define DISP_MUTEX_TOTAL (16)
  19. #define DISP_MUTEX_DDP_FIRST (0)
  20. #define DISP_MUTEX_DDP_LAST (5)
  21. #define DISP_MUTEX_DDP_COUNT (DISP_MUTEX_DDP_LAST - DISP_MUTEX_DDP_FIRST + 1)
  22. #define __DISP_MUTEX_INT_MSK ((1 << (DISP_MUTEX_DDP_COUNT)) - 1)
  23. #define DISP_MUTEX_INT_MSK \
  24. ((__DISP_MUTEX_INT_MSK << DISP_MUTEX_TOTAL) | __DISP_MUTEX_INT_MSK)
  25. struct regmap;
  26. struct device;
  27. struct mtk_disp_mutex;
  28. struct mtk_mmsys_reg_data;
  29. enum mtk_mmsys_id {
  30. MMSYS_MT2701,
  31. MMSYS_MT2712,
  32. MMSYS_MT8173,
  33. MMSYS_MT6779,
  34. MMSYS_MT6885,
  35. MMSYS_MT6873,
  36. MMSYS_MT6853,
  37. MMSYS_MT6833,
  38. MMSYS_MAX,
  39. };
  40. const struct mtk_mmsys_reg_data *
  41. mtk_ddp_get_mmsys_reg_data(enum mtk_mmsys_id mmsys_id);
  42. void mtk_disp_ultra_offset(void __iomem *config_regs,
  43. enum mtk_ddp_comp_id comp, bool is_dc);
  44. void mtk_ddp_add_comp_to_path(struct mtk_drm_crtc *mtk_crtc,
  45. struct mtk_ddp_comp *comp,
  46. enum mtk_ddp_comp_id prev,
  47. enum mtk_ddp_comp_id next);
  48. void mtk_ddp_add_comp_to_path_with_cmdq(struct mtk_drm_crtc *mtk_crtc,
  49. enum mtk_ddp_comp_id cur,
  50. enum mtk_ddp_comp_id next,
  51. struct cmdq_pkt *handle);
  52. void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
  53. const struct mtk_mmsys_reg_data *reg_data,
  54. enum mtk_ddp_comp_id cur,
  55. enum mtk_ddp_comp_id next);
  56. void mtk_ddp_remove_comp_from_path_with_cmdq(struct mtk_drm_crtc *mtk_crtc,
  57. enum mtk_ddp_comp_id cur,
  58. enum mtk_ddp_comp_id next,
  59. struct cmdq_pkt *handle);
  60. struct mtk_disp_mutex *mtk_disp_mutex_get(struct device *dev, unsigned int id);
  61. int mtk_disp_mutex_prepare(struct mtk_disp_mutex *mutex);
  62. void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
  63. enum mtk_ddp_comp_id id);
  64. void mtk_disp_mutex_add_comp_with_cmdq(struct mtk_drm_crtc *mtk_crtc,
  65. enum mtk_ddp_comp_id id, bool is_cmd_mod,
  66. struct cmdq_pkt *handle,
  67. unsigned int mutex_id);
  68. void mtk_disp_mutex_enable(struct mtk_disp_mutex *mutex);
  69. void mtk_disp_mutex_disable(struct mtk_disp_mutex *mutex);
  70. void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex,
  71. enum mtk_ddp_comp_id id);
  72. void mtk_disp_mutex_remove_comp_with_cmdq(struct mtk_drm_crtc *mtk_crtc,
  73. enum mtk_ddp_comp_id id,
  74. struct cmdq_pkt *handle,
  75. unsigned int mutex_id);
  76. void mtk_disp_mutex_unprepare(struct mtk_disp_mutex *mutex);
  77. void mtk_disp_mutex_put(struct mtk_disp_mutex *mutex);
  78. void mtk_disp_mutex_acquire(struct mtk_disp_mutex *mutex);
  79. void mtk_disp_mutex_release(struct mtk_disp_mutex *mutex);
  80. void mtk_disp_mutex_trigger(struct mtk_disp_mutex *mutex, void *handle);
  81. void mutex_dump_reg(struct mtk_disp_mutex *mutex);
  82. void mutex_dump_analysis(struct mtk_disp_mutex *mutex);
  83. void mmsys_config_dump_reg(void __iomem *config_regs);
  84. void mmsys_config_dump_analysis(void __iomem *config_regs);
  85. void mtk_disp_mutex_enable_cmdq(struct mtk_disp_mutex *mutex,
  86. struct cmdq_pkt *cmdq_handle,
  87. struct cmdq_base *cmdq_base);
  88. void mtk_disp_mutex_src_set(struct mtk_drm_crtc *mtk_crtc, bool is_cmd_mode);
  89. void mtk_disp_mutex_inten_enable_cmdq(struct mtk_disp_mutex *mutex,
  90. void *handle);
  91. void mtk_disp_mutex_inten_disable_cmdq(struct mtk_disp_mutex *mutex,
  92. void *handle);
  93. void mutex_dump_reg_mt6885(struct mtk_disp_mutex *mutex);
  94. void mutex_dump_analysis_mt6885(struct mtk_disp_mutex *mutex);
  95. void mmsys_config_dump_reg_mt6885(void __iomem *config_regs);
  96. void mmsys_config_dump_analysis_mt6885(void __iomem *config_regs);
  97. void mtk_ddp_insert_dsc_prim_MT6885(struct mtk_drm_crtc *mtk_crtc,
  98. struct cmdq_pkt *handle);
  99. void mtk_ddp_remove_dsc_prim_MT6885(struct mtk_drm_crtc *mtk_crtc,
  100. struct cmdq_pkt *handle);
  101. void mtk_ddp_connect_dual_pipe_path(struct mtk_drm_crtc *mtk_crtc,
  102. struct mtk_disp_mutex *mutex);
  103. void mtk_disp_mutex_submit_sof(struct mtk_disp_mutex *mutex);
  104. void mtk_ddp_dual_pipe_dump(struct mtk_drm_crtc *mtk_crtc);
  105. void mutex_dump_reg_mt6873(struct mtk_disp_mutex *mutex);
  106. void mutex_dump_analysis_mt6873(struct mtk_disp_mutex *mutex);
  107. void mmsys_config_dump_reg_mt6873(void __iomem *config_regs);
  108. void mmsys_config_dump_analysis_mt6873(void __iomem *config_regs);
  109. void mtk_ddp_insert_dsc_prim_MT6873(struct mtk_drm_crtc *mtk_crtc,
  110. struct cmdq_pkt *handle);
  111. void mtk_ddp_remove_dsc_prim_MT6873(struct mtk_drm_crtc *mtk_crtc,
  112. struct cmdq_pkt *handle);
  113. void mmsys_config_dump_analysis_mt6853(void __iomem *config_regs);
  114. void mutex_dump_analysis_mt6853(struct mtk_disp_mutex *mutex);
  115. void mtk_ddp_insert_dsc_prim_MT6853(struct mtk_drm_crtc *mtk_crtc,
  116. struct cmdq_pkt *handle);
  117. void mtk_ddp_remove_dsc_prim_MT6853(struct mtk_drm_crtc *mtk_crtc,
  118. struct cmdq_pkt *handle);
  119. void mmsys_config_dump_analysis_mt6833(void __iomem *config_regs);
  120. void mutex_dump_analysis_mt6833(struct mtk_disp_mutex *mutex);
  121. #endif /* MTK_DRM_DDP_H */