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
9#include "cpufreq_governor.h"
10
11struct od_policy_dbs_info {
12 struct policy_dbs_info policy_dbs;
13 unsigned int freq_lo;
14 unsigned int freq_lo_delay_us;
15 unsigned int freq_hi_delay_us;
16 unsigned int sample_type:1;
17};
18
19static inline struct od_policy_dbs_info *to_dbs_info(struct policy_dbs_info *policy_dbs)
20{
21 return container_of(policy_dbs, struct od_policy_dbs_info, policy_dbs);
22}
23
24struct od_dbs_tuners {
25 unsigned int powersave_bias;
26};
27
28#ifdef CONFIG_X86
29#include <asm/cpu_device_id.h>
30
31/*
32 * Not all CPUs want IO time to be accounted as busy; this depends on
33 * how efficient idling at a higher frequency/voltage is.
34 *
35 * Pavel Machek says this is not so for various generations of AMD and
36 * old Intel systems. Mike Chan (android.com) claims this is also not
37 * true for ARM.
38 *
39 * Because of this, select a known series of Intel CPUs (Family 6 and
40 * later) by default, and leave all others up to the user.
41 */
42static inline bool od_should_io_be_busy(void)
43{
44 return (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
45 boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO);
46}
47#else
48static inline bool od_should_io_be_busy(void) { return false; }
49#endif
50