mtk_disp_pmqos.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2019 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_PMQOS_H_
  14. #define _MTK_DRM_PMQOS_H_
  15. #include "mmdvfs_pmqos.h"
  16. #if defined(CONFIG_MACH_MT6779)
  17. #include "helio-dvfsrc-opp-mt6779.h"
  18. #elif defined(CONFIG_MACH_MT6885) || defined(CONFIG_MACH_MT6893)
  19. #include "helio-dvfsrc-opp-mt6885.h"
  20. #include "dt-bindings/memory/mt6885-larb-port.h"
  21. #elif defined(CONFIG_MACH_MT6873)
  22. #include "helio-dvfsrc-opp-mt6873.h"
  23. #include "dt-bindings/memory/mt6873-larb-port.h"
  24. #elif defined(CONFIG_MACH_MT6853)
  25. #include "helio-dvfsrc-opp-mt6853.h"
  26. #include "dt-bindings/memory/mt6853-larb-port.h"
  27. #elif defined(CONFIG_MACH_MT6833)
  28. #include "helio-dvfsrc-opp-mt6833.h"
  29. #include "dt-bindings/memory/mt6833-larb-port.h"
  30. #endif
  31. #include <linux/pm_qos.h>
  32. enum DISP_QOS_BW_MODE {
  33. DISP_BW_NORMAL_MODE = 0,
  34. DISP_BW_FBDC_MODE,
  35. DISP_BW_HRT_MODE,
  36. };
  37. #define NO_PENDING_HRT (0xFFFFFFFF)
  38. #define OVL_REQ_HRT (0x1)
  39. #define RDMA_REQ_HRT (0x2)
  40. struct drm_crtc;
  41. struct mtk_drm_crtc;
  42. struct mtk_drm_qos_ctx {
  43. unsigned int last_hrt_req;
  44. atomic_t last_hrt_idx;
  45. atomic_t hrt_cond_sig;
  46. wait_queue_head_t hrt_cond_wq;
  47. };
  48. int __mtk_disp_set_module_bw(struct mm_qos_request *request, int comp_id,
  49. unsigned int bandwidth, unsigned int mode);
  50. void __mtk_disp_set_module_hrt(struct mm_qos_request *request,
  51. unsigned int bandwidth);
  52. int mtk_disp_set_hrt_bw(struct mtk_drm_crtc *mtk_crtc,
  53. unsigned int overlap_num);
  54. void mtk_drm_pan_disp_set_hrt_bw(struct drm_crtc *crtc, const char *caller);
  55. int __mtk_disp_pmqos_slot_look_up(int comp_id, int mode);
  56. int __mtk_disp_pmqos_port_look_up(int comp_id);
  57. int mtk_disp_hrt_cond_init(struct drm_crtc *crtc);
  58. void mtk_drm_mmdvfs_init(void);
  59. void mtk_drm_set_mmclk_by_pixclk(struct drm_crtc *crtc, unsigned int pixclk,
  60. const char *caller);
  61. #endif