panfrost_devfreq.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright 2019 Collabora ltd. */
  3. #ifndef __PANFROST_DEVFREQ_H__
  4. #define __PANFROST_DEVFREQ_H__
  5. #include <linux/devfreq.h>
  6. #include <linux/spinlock.h>
  7. #include <linux/ktime.h>
  8. struct devfreq;
  9. struct thermal_cooling_device;
  10. struct panfrost_device;
  11. struct panfrost_devfreq {
  12. struct devfreq *devfreq;
  13. struct thermal_cooling_device *cooling;
  14. struct devfreq_simple_ondemand_data gov_data;
  15. bool opp_of_table_added;
  16. ktime_t busy_time;
  17. ktime_t idle_time;
  18. ktime_t time_last_update;
  19. int busy_count;
  20. /*
  21. * Protect busy_time, idle_time, time_last_update and busy_count
  22. * because these can be updated concurrently between multiple jobs.
  23. */
  24. spinlock_t lock;
  25. };
  26. int panfrost_devfreq_init(struct panfrost_device *pfdev);
  27. void panfrost_devfreq_fini(struct panfrost_device *pfdev);
  28. void panfrost_devfreq_resume(struct panfrost_device *pfdev);
  29. void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
  30. void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq);
  31. void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq);
  32. #endif /* __PANFROST_DEVFREQ_H__ */