diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cpufreq-dt.h | 22 | ||||
| -rw-r--r-- | include/linux/cpufreq.h | 54 | ||||
| -rw-r--r-- | include/linux/sched.h | 5 | 
3 files changed, 58 insertions, 23 deletions
| diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h deleted file mode 100644 index 0414009e2c30..000000000000 --- a/include/linux/cpufreq-dt.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 Marvell - * Thomas Petazzoni <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __CPUFREQ_DT_H__ -#define __CPUFREQ_DT_H__ - -struct cpufreq_dt_platform_data { -	/* -	 * True when each CPU has its own clock to control its -	 * frequency, false when all CPUs are controlled by a single -	 * clock. -	 */ -	bool independent_clocks; -}; - -#endif /* __CPUFREQ_DT_H__ */ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 718e8725de8a..4e81e08db752 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -102,6 +102,17 @@ struct cpufreq_policy {  	 */  	struct rw_semaphore	rwsem; +	/* +	 * Fast switch flags: +	 * - fast_switch_possible should be set by the driver if it can +	 *   guarantee that frequency can be changed on any CPU sharing the +	 *   policy and that the change will affect all of the policy CPUs then. +	 * - fast_switch_enabled is to be set by governors that support fast +	 *   freqnency switching with the help of cpufreq_enable_fast_switch(). +	 */ +	bool			fast_switch_possible; +	bool			fast_switch_enabled; +  	/* Synchronization for frequency transitions */  	bool			transition_ongoing; /* Tracks transition status */  	spinlock_t		transition_lock; @@ -156,6 +167,8 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);  int cpufreq_update_policy(unsigned int cpu);  bool have_governor_per_policy(void);  struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); +void cpufreq_enable_fast_switch(struct cpufreq_policy *policy); +void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);  #else  static inline unsigned int cpufreq_get(unsigned int cpu)  { @@ -236,6 +249,8 @@ struct cpufreq_driver {  				  unsigned int relation);	/* Deprecated */  	int		(*target_index)(struct cpufreq_policy *policy,  					unsigned int index); +	unsigned int	(*fast_switch)(struct cpufreq_policy *policy, +				       unsigned int target_freq);  	/*  	 * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION  	 * unset. @@ -426,6 +441,20 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div,  #define CPUFREQ_POLICY_POWERSAVE	(1)  #define CPUFREQ_POLICY_PERFORMANCE	(2) +/* + * The polling frequency depends on the capability of the processor. Default + * polling frequency is 1000 times the transition latency of the processor. The + * ondemand governor will work on any processor with transition latency <= 10ms, + * using appropriate sampling rate. + * + * For CPUs with transition latency > 10ms (mostly drivers with CPUFREQ_ETERNAL) + * the ondemand governor will not work. All times here are in us (microseconds). + */ +#define MIN_SAMPLING_RATE_RATIO		(2) +#define LATENCY_MULTIPLIER		(1000) +#define MIN_LATENCY_MULTIPLIER		(20) +#define TRANSITION_LATENCY_LIMIT	(10 * 1000 * 1000) +  /* Governor Events */  #define CPUFREQ_GOV_START	1  #define CPUFREQ_GOV_STOP	2 @@ -450,6 +479,8 @@ struct cpufreq_governor {  };  /* Pass a target to the cpufreq driver */ +unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, +					unsigned int target_freq);  int cpufreq_driver_target(struct cpufreq_policy *policy,  				 unsigned int target_freq,  				 unsigned int relation); @@ -462,6 +493,29 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor);  struct cpufreq_governor *cpufreq_default_governor(void);  struct cpufreq_governor *cpufreq_fallback_governor(void); +/* Governor attribute set */ +struct gov_attr_set { +	struct kobject kobj; +	struct list_head policy_list; +	struct mutex update_lock; +	int usage_count; +}; + +/* sysfs ops for cpufreq governors */ +extern const struct sysfs_ops governor_sysfs_ops; + +void gov_attr_set_init(struct gov_attr_set *attr_set, struct list_head *list_node); +void gov_attr_set_get(struct gov_attr_set *attr_set, struct list_head *list_node); +unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *list_node); + +/* Governor sysfs attribute */ +struct governor_attr { +	struct attribute attr; +	ssize_t (*show)(struct gov_attr_set *attr_set, char *buf); +	ssize_t (*store)(struct gov_attr_set *attr_set, const char *buf, +			 size_t count); +}; +  /*********************************************************************   *                     FREQUENCY TABLE HELPERS                       *   *********************************************************************/ diff --git a/include/linux/sched.h b/include/linux/sched.h index 52c4847b05e2..8344e1947eec 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -3240,7 +3240,10 @@ struct update_util_data {  		     u64 time, unsigned long util, unsigned long max);  }; -void cpufreq_set_update_util_data(int cpu, struct update_util_data *data); +void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, +			void (*func)(struct update_util_data *data, u64 time, +				     unsigned long util, unsigned long max)); +void cpufreq_remove_update_util_hook(int cpu);  #endif /* CONFIG_CPU_FREQ */  #endif |