cpufreq_ondemand.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Header file for CPUFreq ondemand governor and related code.
  4. *
  5. * Copyright (C) 2016, Intel Corporation
  6. * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  7. */
  8. #include "cpufreq_governor.h"
  9. struct od_policy_dbs_info {
  10. struct policy_dbs_info policy_dbs;
  11. unsigned int freq_lo;
  12. unsigned int freq_lo_delay_us;
  13. unsigned int freq_hi_delay_us;
  14. unsigned int sample_type:1;
  15. };
  16. static inline struct od_policy_dbs_info *to_dbs_info(struct policy_dbs_info *policy_dbs)
  17. {
  18. return container_of(policy_dbs, struct od_policy_dbs_info, policy_dbs);
  19. }
  20. struct od_dbs_tuners {
  21. unsigned int powersave_bias;
  22. };
  23. #ifdef CONFIG_X86
  24. #include <asm/cpu_device_id.h>
  25. /*
  26. * Not all CPUs want IO time to be accounted as busy; this depends on
  27. * how efficient idling at a higher frequency/voltage is.
  28. *
  29. * Pavel Machek says this is not so for various generations of AMD and
  30. * old Intel systems. Mike Chan (android.com) claims this is also not
  31. * true for ARM.
  32. *
  33. * Because of this, select a known series of Intel CPUs (Family 6 and
  34. * later) by default, and leave all others up to the user.
  35. */
  36. static inline bool od_should_io_be_busy(void)
  37. {
  38. return (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
  39. boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO);
  40. }
  41. #else
  42. static inline bool od_should_io_be_busy(void) { return false; }
  43. #endif