msm_adreno_devfreq.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef MSM_ADRENO_DEVFREQ_H
  7. #define MSM_ADRENO_DEVFREQ_H
  8. #include <linux/devfreq.h>
  9. #include <linux/notifier.h>
  10. /* Flags used to send bus modifier hint from busmon governer to driver */
  11. #define BUSMON_FLAG_FAST_HINT BIT(0)
  12. #define BUSMON_FLAG_SUPER_FAST_HINT BIT(1)
  13. #define BUSMON_FLAG_SLOW_HINT BIT(2)
  14. struct device;
  15. /* same as KGSL_MAX_PWRLEVELS */
  16. #define MSM_ADRENO_MAX_PWRLEVELS 32
  17. struct xstats {
  18. u64 ram_time;
  19. u64 ram_wait;
  20. int buslevel;
  21. unsigned long gpu_minfreq;
  22. };
  23. struct devfreq_msm_adreno_tz_data {
  24. struct notifier_block nb;
  25. struct {
  26. s64 total_time;
  27. s64 busy_time;
  28. u32 ctxt_aware_target_pwrlevel;
  29. u32 ctxt_aware_busy_penalty;
  30. } bin;
  31. struct {
  32. u64 total_time;
  33. u64 ram_time;
  34. u64 ram_wait;
  35. u64 gpu_time;
  36. u32 num;
  37. u32 max;
  38. u32 width;
  39. u32 *up;
  40. u32 *down;
  41. s32 *p_up;
  42. s32 *p_down;
  43. u32 *ib_kbps;
  44. bool floating;
  45. } bus;
  46. unsigned int device_id;
  47. bool is_64;
  48. bool disable_busy_time_burst;
  49. bool ctxt_aware_enable;
  50. /* Multiplier to change gpu busy status */
  51. u32 mod_percent;
  52. /* Increase IB vote on high ddr stall */
  53. bool fast_bus_hint;
  54. };
  55. struct msm_adreno_extended_profile {
  56. struct devfreq_msm_adreno_tz_data *private_data;
  57. struct devfreq_dev_profile profile;
  58. };
  59. struct msm_busmon_extended_profile {
  60. u32 flag;
  61. u32 sampling_ms;
  62. unsigned long percent_ab;
  63. unsigned long ab_mbytes;
  64. struct devfreq_msm_adreno_tz_data *private_data;
  65. struct devfreq_dev_profile profile;
  66. };
  67. typedef void(*getbw_func)(unsigned long *, unsigned long *, void *);
  68. int devfreq_vbif_update_bw(void);
  69. void devfreq_vbif_register_callback(getbw_func func, void *data);
  70. #endif