mtk_drm_lowpower.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_LOWPOWER_H_
  14. #define _MTK_DRM_LOWPOWER_H_
  15. #include <drm/drm_crtc.h>
  16. struct mtk_drm_idlemgr_context {
  17. unsigned long long idle_check_interval;
  18. unsigned long long idlemgr_last_kick_time;
  19. unsigned int enterulps;
  20. int session_mode_before_enter_idle;
  21. int is_idle;
  22. int cur_lp_cust_mode;
  23. };
  24. struct mtk_drm_idlemgr {
  25. struct task_struct *idlemgr_task;
  26. wait_queue_head_t idlemgr_wq;
  27. atomic_t idlemgr_task_active;
  28. struct mtk_drm_idlemgr_context *idlemgr_ctx;
  29. };
  30. void mtk_drm_idlemgr_kick(const char *source, struct drm_crtc *crtc,
  31. int need_lock);
  32. bool mtk_drm_is_idle(struct drm_crtc *crtc);
  33. int mtk_drm_idlemgr_init(struct drm_crtc *crtc, int index);
  34. unsigned int mtk_drm_set_idlemgr(struct drm_crtc *crtc, unsigned int flag,
  35. bool need_lock);
  36. unsigned long long
  37. mtk_drm_set_idle_check_interval(struct drm_crtc *crtc,
  38. unsigned long long new_interval);
  39. unsigned long long
  40. mtk_drm_get_idle_check_interval(struct drm_crtc *crtc);
  41. #endif