diff options
Diffstat (limited to 'drivers/cpufreq/maple-cpufreq.c')
| -rw-r--r-- | drivers/cpufreq/maple-cpufreq.c | 62 | 
1 files changed, 9 insertions, 53 deletions
diff --git a/drivers/cpufreq/maple-cpufreq.c b/drivers/cpufreq/maple-cpufreq.c index 6168d77b296..cc3408fc073 100644 --- a/drivers/cpufreq/maple-cpufreq.c +++ b/drivers/cpufreq/maple-cpufreq.c @@ -59,14 +59,9 @@  #define CPUFREQ_LOW                   1  static struct cpufreq_frequency_table maple_cpu_freqs[] = { -	{CPUFREQ_HIGH,		0}, -	{CPUFREQ_LOW,		0}, -	{0,			CPUFREQ_TABLE_END}, -}; - -static struct freq_attr *maple_cpu_freqs_attr[] = { -	&cpufreq_freq_attr_scaling_available_freqs, -	NULL, +	{0, CPUFREQ_HIGH,		0}, +	{0, CPUFREQ_LOW,		0}, +	{0, 0,				CPUFREQ_TABLE_END},  };  /* Power mode data is an array of the 32 bits PCR values to use for @@ -74,8 +69,6 @@ static struct freq_attr *maple_cpu_freqs_attr[] = {   */  static int maple_pmode_cur; -static DEFINE_MUTEX(maple_switch_mutex); -  static const u32 *maple_pmode_data;  static int maple_pmode_max; @@ -135,37 +128,10 @@ static int maple_scom_query_freq(void)   * Common interface to the cpufreq core   */ -static int maple_cpufreq_verify(struct cpufreq_policy *policy) -{ -	return cpufreq_frequency_table_verify(policy, maple_cpu_freqs); -} -  static int maple_cpufreq_target(struct cpufreq_policy *policy, -	unsigned int target_freq, unsigned int relation) +	unsigned int index)  { -	unsigned int newstate = 0; -	struct cpufreq_freqs freqs; -	int rc; - -	if (cpufreq_frequency_table_target(policy, maple_cpu_freqs, -			target_freq, relation, &newstate)) -		return -EINVAL; - -	if (maple_pmode_cur == newstate) -		return 0; - -	mutex_lock(&maple_switch_mutex); - -	freqs.old = maple_cpu_freqs[maple_pmode_cur].frequency; -	freqs.new = maple_cpu_freqs[newstate].frequency; - -	cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); -	rc = maple_scom_switch_freq(newstate); -	cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - -	mutex_unlock(&maple_switch_mutex); - -	return rc; +	return maple_scom_switch_freq(index);  }  static unsigned int maple_cpufreq_get_speed(unsigned int cpu) @@ -175,27 +141,17 @@ static unsigned int maple_cpufreq_get_speed(unsigned int cpu)  static int maple_cpufreq_cpu_init(struct cpufreq_policy *policy)  { -	policy->cpuinfo.transition_latency = 12000; -	policy->cur = maple_cpu_freqs[maple_scom_query_freq()].frequency; -	/* secondary CPUs are tied to the primary one by the -	 * cpufreq core if in the secondary policy we tell it that -	 * it actually must be one policy together with all others. */ -	cpumask_setall(policy->cpus); -	cpufreq_frequency_table_get_attr(maple_cpu_freqs, policy->cpu); - -	return cpufreq_frequency_table_cpuinfo(policy, -		maple_cpu_freqs); +	return cpufreq_generic_init(policy, maple_cpu_freqs, 12000);  } -  static struct cpufreq_driver maple_cpufreq_driver = {  	.name		= "maple",  	.flags		= CPUFREQ_CONST_LOOPS,  	.init		= maple_cpufreq_cpu_init, -	.verify		= maple_cpufreq_verify, -	.target		= maple_cpufreq_target, +	.verify		= cpufreq_generic_frequency_table_verify, +	.target_index	= maple_cpufreq_target,  	.get		= maple_cpufreq_get_speed, -	.attr		= maple_cpu_freqs_attr, +	.attr		= cpufreq_generic_attr,  };  static int __init maple_cpufreq_init(void)  | 
