Commit 99d428cf authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: tegra: use cpufreq_generic_init()

Use generic cpufreq_generic_init() routine instead of replicating the same code
here.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7a936bd0
...@@ -204,19 +204,23 @@ static struct notifier_block tegra_cpu_pm_notifier = { ...@@ -204,19 +204,23 @@ static struct notifier_block tegra_cpu_pm_notifier = {
static int tegra_cpu_init(struct cpufreq_policy *policy) static int tegra_cpu_init(struct cpufreq_policy *policy)
{ {
int ret;
if (policy->cpu >= NUM_CPUS) if (policy->cpu >= NUM_CPUS)
return -EINVAL; return -EINVAL;
clk_prepare_enable(emc_clk); clk_prepare_enable(emc_clk);
clk_prepare_enable(cpu_clk); clk_prepare_enable(cpu_clk);
cpufreq_table_validate_and_show(policy, freq_table);
target_cpu_speed[policy->cpu] = tegra_getspeed(policy->cpu); target_cpu_speed[policy->cpu] = tegra_getspeed(policy->cpu);
/* FIXME: what's the actual transition time? */ /* FIXME: what's the actual transition time? */
policy->cpuinfo.transition_latency = 300 * 1000; ret = cpufreq_generic_init(policy, freq_table, 300 * 1000);
if (ret) {
cpumask_copy(policy->cpus, cpu_possible_mask); clk_disable_unprepare(cpu_clk);
clk_disable_unprepare(emc_clk);
return ret;
}
if (policy->cpu == 0) if (policy->cpu == 0)
register_pm_notifier(&tegra_cpu_pm_notifier); register_pm_notifier(&tegra_cpu_pm_notifier);
...@@ -227,6 +231,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) ...@@ -227,6 +231,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
static int tegra_cpu_exit(struct cpufreq_policy *policy) static int tegra_cpu_exit(struct cpufreq_policy *policy)
{ {
cpufreq_frequency_table_put_attr(policy->cpu); cpufreq_frequency_table_put_attr(policy->cpu);
clk_disable_unprepare(cpu_clk);
clk_disable_unprepare(emc_clk); clk_disable_unprepare(emc_clk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment