cpufreq: cpufreq-cpu0: Use generic cpufreq routines
Most of the CPUFreq drivers do similar things in .exit() and .verify() routines and .attr. So its better if we have generic routines for them which can be used by cpufreq drivers then. This patch uses these generic routines in the cpufreq-cpu0 driver. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
00ff424caa
commit
f793d79f08
|
@ -30,11 +30,6 @@ static struct clk *cpu_clk;
|
||||||
static struct regulator *cpu_reg;
|
static struct regulator *cpu_reg;
|
||||||
static struct cpufreq_frequency_table *freq_table;
|
static struct cpufreq_frequency_table *freq_table;
|
||||||
|
|
||||||
static int cpu0_verify_speed(struct cpufreq_policy *policy)
|
|
||||||
{
|
|
||||||
return cpufreq_frequency_table_verify(policy, freq_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int cpu0_get_speed(unsigned int cpu)
|
static unsigned int cpu0_get_speed(unsigned int cpu)
|
||||||
{
|
{
|
||||||
return clk_get_rate(cpu_clk) / 1000;
|
return clk_get_rate(cpu_clk) / 1000;
|
||||||
|
@ -148,27 +143,15 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpu0_cpufreq_exit(struct cpufreq_policy *policy)
|
|
||||||
{
|
|
||||||
cpufreq_frequency_table_put_attr(policy->cpu);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct freq_attr *cpu0_cpufreq_attr[] = {
|
|
||||||
&cpufreq_freq_attr_scaling_available_freqs,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct cpufreq_driver cpu0_cpufreq_driver = {
|
static struct cpufreq_driver cpu0_cpufreq_driver = {
|
||||||
.flags = CPUFREQ_STICKY,
|
.flags = CPUFREQ_STICKY,
|
||||||
.verify = cpu0_verify_speed,
|
.verify = cpufreq_generic_frequency_table_verify,
|
||||||
.target = cpu0_set_target,
|
.target = cpu0_set_target,
|
||||||
.get = cpu0_get_speed,
|
.get = cpu0_get_speed,
|
||||||
.init = cpu0_cpufreq_init,
|
.init = cpu0_cpufreq_init,
|
||||||
.exit = cpu0_cpufreq_exit,
|
.exit = cpufreq_generic_exit,
|
||||||
.name = "generic_cpu0",
|
.name = "generic_cpu0",
|
||||||
.attr = cpu0_cpufreq_attr,
|
.attr = cpufreq_generic_attr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cpu0_cpufreq_probe(struct platform_device *pdev)
|
static int cpu0_cpufreq_probe(struct platform_device *pdev)
|
||||||
|
|
Loading…
Reference in New Issue