linux/drivers/cpufreq/cpufreq_ondemand.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  drivers/cpufreq/cpufreq_ondemand.c
 *
 *  Copyright (C)  2001 Russell King
 *            (C)  2003 Venkatesh Pallipadi <[email protected]>.
 *                      Jun Nakajima <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/cpu.h>
#include <linux/percpu-defs.h>
#include <linux/slab.h>
#include <linux/tick.h>
#include <linux/sched/cpufreq.h>

#include "cpufreq_ondemand.h"

/* On-demand governor macros */
#define DEF_FREQUENCY_UP_THRESHOLD
#define DEF_SAMPLING_DOWN_FACTOR
#define MAX_SAMPLING_DOWN_FACTOR
#define MICRO_FREQUENCY_UP_THRESHOLD
#define MIN_FREQUENCY_UP_THRESHOLD
#define MAX_FREQUENCY_UP_THRESHOLD

static struct od_ops od_ops;

static unsigned int default_powersave_bias;

/*
 * Not all CPUs want IO time to be accounted as busy; this depends on how
 * efficient idling at a higher frequency/voltage is.
 * Pavel Machek says this is not so for various generations of AMD and old
 * Intel systems.
 * Mike Chan (android.com) claims this is also not true for ARM.
 * Because of this, whitelist specific known (series) of CPUs by default, and
 * leave all others up to the user.
 */
static int should_io_be_busy(void)
{}

/*
 * Find right freq to be set now with powersave_bias on.
 * Returns the freq_hi to be used right now and will set freq_hi_delay_us,
 * freq_lo, and freq_lo_delay_us in percpu area for averaging freqs.
 */
static unsigned int generic_powersave_bias_target(struct cpufreq_policy *policy,
		unsigned int freq_next, unsigned int relation)
{}

static void ondemand_powersave_bias_init(struct cpufreq_policy *policy)
{}

static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
{}

/*
 * Every sampling_rate, we check, if current idle time is less than 20%
 * (default), then we try to increase frequency. Else, we adjust the frequency
 * proportional to load.
 */
static void od_update(struct cpufreq_policy *policy)
{}

static unsigned int od_dbs_update(struct cpufreq_policy *policy)
{}

/************************** sysfs interface ************************/
static struct dbs_governor od_dbs_gov;

static ssize_t io_is_busy_store(struct gov_attr_set *attr_set, const char *buf,
				size_t count)
{}

static ssize_t up_threshold_store(struct gov_attr_set *attr_set,
				  const char *buf, size_t count)
{}

static ssize_t sampling_down_factor_store(struct gov_attr_set *attr_set,
					  const char *buf, size_t count)
{}

static ssize_t ignore_nice_load_store(struct gov_attr_set *attr_set,
				      const char *buf, size_t count)
{}

static ssize_t powersave_bias_store(struct gov_attr_set *attr_set,
				    const char *buf, size_t count)
{}

gov_show_one_common(sampling_rate);
gov_show_one_common(up_threshold);
gov_show_one_common(sampling_down_factor);
gov_show_one_common(ignore_nice_load);
gov_show_one_common(io_is_busy);
gov_show_one(od, powersave_bias);

gov_attr_rw();
gov_attr_rw();
gov_attr_rw();
gov_attr_rw();
gov_attr_rw();
gov_attr_rw();

static struct attribute *od_attrs[] =;
ATTRIBUTE_GROUPS();

/************************** sysfs end ************************/

static struct policy_dbs_info *od_alloc(void)
{}

static void od_free(struct policy_dbs_info *policy_dbs)
{}

static int od_init(struct dbs_data *dbs_data)
{}

static void od_exit(struct dbs_data *dbs_data)
{}

static void od_start(struct cpufreq_policy *policy)
{}

static struct od_ops od_ops =;

static struct dbs_governor od_dbs_gov =;

#define CPU_FREQ_GOV_ONDEMAND

static void od_set_powersave_bias(unsigned int powersave_bias)
{}

void od_register_powersave_bias_handler(unsigned int (*f)
		(struct cpufreq_policy *, unsigned int, unsigned int),
		unsigned int powersave_bias)
{}
EXPORT_SYMBOL_GPL();

void od_unregister_powersave_bias_handler(void)
{}
EXPORT_SYMBOL_GPL();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
struct cpufreq_governor *cpufreq_default_governor(void)
{
	return &CPU_FREQ_GOV_ONDEMAND;
}
#endif

cpufreq_governor_init(CPU_FREQ_GOV_ONDEMAND);
cpufreq_governor_exit(CPU_FREQ_GOV_ONDEMAND);