Commit 8122c6ce authored by Thomas Renninger's avatar Thomas Renninger Committed by Dave Jones

[CPUFREQ] move policy's governor initialisation out of low-level drivers into cpufreq core

Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Cc: Andi Kleen <ak@suse.de>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent a09d60a6
...@@ -269,7 +269,6 @@ static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy) ...@@ -269,7 +269,6 @@ static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy)
return -EINVAL; return -EINVAL;
policy->cur = policy->min = policy->max = imx_get_speed(0); policy->cur = policy->min = policy->max = imx_get_speed(0);
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.min_freq = 8000; policy->cpuinfo.min_freq = 8000;
policy->cpuinfo.max_freq = 200000; policy->cpuinfo.max_freq = 200000;
/* Manual states, that PLL stabilizes in two CLK32 periods */ /* Manual states, that PLL stabilizes in two CLK32 periods */
......
...@@ -331,7 +331,6 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) ...@@ -331,7 +331,6 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
if (policy->cpu != 0) if (policy->cpu != 0)
return -EINVAL; return -EINVAL;
policy->cur = policy->min = policy->max = sa11x0_getspeed(0); policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.min_freq = 59000; policy->cpuinfo.min_freq = 59000;
policy->cpuinfo.max_freq = 287000; policy->cpuinfo.max_freq = 287000;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
......
...@@ -108,7 +108,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy) ...@@ -108,7 +108,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
if (policy->cpu != 0) if (policy->cpu != 0)
return -EINVAL; return -EINVAL;
policy->cur = policy->min = policy->max = omap_getspeed(0); policy->cur = policy->min = policy->max = omap_getspeed(0);
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000; policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
......
...@@ -118,8 +118,6 @@ static int __init __bf533_cpu_init(struct cpufreq_policy *policy) ...@@ -118,8 +118,6 @@ static int __init __bf533_cpu_init(struct cpufreq_policy *policy)
if (policy->cpu != 0) if (policy->cpu != 0)
return -EINVAL; return -EINVAL;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
/*Now ,only support one cpu */ /*Now ,only support one cpu */
policy->cur = bf533_getfreq(0); policy->cur = bf533_getfreq(0);
......
...@@ -646,7 +646,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -646,7 +646,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = policy->cpuinfo.transition_latency =
perf->states[i].transition_latency * 1000; perf->states[i].transition_latency * 1000;
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
data->max_freq = perf->states[0].core_frequency * 1000; data->max_freq = perf->states[0].core_frequency * 1000;
/* table init */ /* table init */
......
...@@ -363,7 +363,6 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy) ...@@ -363,7 +363,6 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
policy->cur = nforce2_get(policy->cpu); policy->cur = nforce2_get(policy->cpu);
policy->min = policy->cpuinfo.min_freq; policy->min = policy->cpuinfo.min_freq;
policy->max = policy->cpuinfo.max_freq; policy->max = policy->cpuinfo.max_freq;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
return 0; return 0;
} }
......
...@@ -253,7 +253,6 @@ static int eps_cpu_init(struct cpufreq_policy *policy) ...@@ -253,7 +253,6 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
f_table[k].frequency = CPUFREQ_TABLE_END; f_table[k].frequency = CPUFREQ_TABLE_END;
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */ policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */
policy->cur = fsb * current_multiplier; policy->cur = fsb * current_multiplier;
......
...@@ -219,7 +219,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) ...@@ -219,7 +219,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
} }
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = elanfreq_get_cpu_frequency(0); policy->cur = elanfreq_get_cpu_frequency(0);
......
...@@ -420,7 +420,6 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) ...@@ -420,7 +420,6 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy)
policy->min = maxfreq / POLICY_MIN_DIV; policy->min = maxfreq / POLICY_MIN_DIV;
policy->max = maxfreq; policy->max = maxfreq;
policy->cur = curfreq; policy->cur = curfreq;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.min_freq = maxfreq / max_duration; policy->cpuinfo.min_freq = maxfreq / max_duration;
policy->cpuinfo.max_freq = maxfreq; policy->cpuinfo.max_freq = maxfreq;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
......
...@@ -877,7 +877,6 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) ...@@ -877,7 +877,6 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0)) if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0))
longhaul_setup_voltagescaling(); longhaul_setup_voltagescaling();
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 200000; /* nsec */ policy->cpuinfo.transition_latency = 200000; /* nsec */
policy->cur = calc_speed(longhaul_get_cpu_mult()); policy->cur = calc_speed(longhaul_get_cpu_mult());
......
...@@ -229,7 +229,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) ...@@ -229,7 +229,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu); cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu);
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 1000000; /* assumed */ policy->cpuinfo.transition_latency = 1000000; /* assumed */
policy->cur = stock_freq; policy->cur = stock_freq;
......
...@@ -160,7 +160,6 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) ...@@ -160,7 +160,6 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
} }
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = busfreq * max_multiplier; policy->cur = busfreq * max_multiplier;
......
...@@ -637,8 +637,6 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy) ...@@ -637,8 +637,6 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)
printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n", printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n",
minimum_speed/1000, maximum_speed/1000); minimum_speed/1000, maximum_speed/1000);
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency); policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency);
policy->cur = powernow_get(0); policy->cur = powernow_get(0);
......
...@@ -1208,7 +1208,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1208,7 +1208,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
/* run on any CPU again */ /* run on any CPU again */
set_cpus_allowed(current, oldmask); set_cpus_allowed(current, oldmask);
pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
if (cpu_family == CPU_HW_PSTATE) if (cpu_family == CPU_HW_PSTATE)
pol->cpus = cpumask_of_cpu(pol->cpu); pol->cpus = cpumask_of_cpu(pol->cpu);
else else
......
...@@ -111,7 +111,6 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy) ...@@ -111,7 +111,6 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
return -ENODEV; return -ENODEV;
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 1000000; /* 1ms */ policy->cpuinfo.transition_latency = 1000000; /* 1ms */
policy->cur = sc520_freq_get_cpu_frequency(0); policy->cur = sc520_freq_get_cpu_frequency(0);
......
...@@ -393,7 +393,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) ...@@ -393,7 +393,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
freq = get_cur_freq(policy->cpu); freq = get_cur_freq(policy->cpu);
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */ policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */
policy->cur = freq; policy->cur = freq;
......
...@@ -348,7 +348,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -348,7 +348,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
(speed / 1000)); (speed / 1000));
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cur = speed; policy->cur = speed;
result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
......
...@@ -290,7 +290,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -290,7 +290,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
(speed / 1000)); (speed / 1000));
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = speed; policy->cur = speed;
......
...@@ -321,8 +321,6 @@ acpi_cpufreq_cpu_init ( ...@@ -321,8 +321,6 @@ acpi_cpufreq_cpu_init (
data->acpi_data.states[i].transition_latency * 1000; data->acpi_data.states[i].transition_latency * 1000;
} }
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cur = processor_get_freq(data, policy->cpu); policy->cur = processor_get_freq(data, policy->cpu);
/* table init */ /* table init */
......
...@@ -107,8 +107,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -107,8 +107,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
/* if DEBUG is enabled set_pmode() measures the latency /* if DEBUG is enabled set_pmode() measures the latency
* of a transition */ * of a transition */
policy->cpuinfo.transition_latency = 25000; policy->cpuinfo.transition_latency = 25000;
......
...@@ -195,8 +195,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -195,8 +195,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
pr_debug("%d: %d\n", i, pas_freqs[i].frequency); pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = get_gizmo_latency(); policy->cpuinfo.transition_latency = get_gizmo_latency();
cur_astate = get_cur_astate(policy->cpu); cur_astate = get_cur_astate(policy->cpu);
......
...@@ -410,7 +410,6 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -410,7 +410,6 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
if (policy->cpu != 0) if (policy->cpu != 0)
return -ENODEV; return -ENODEV;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = cur_freq; policy->cur = cur_freq;
......
...@@ -357,7 +357,6 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu) ...@@ -357,7 +357,6 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy) static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
{ {
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = g5_cpu_freqs[g5_query_freq()].frequency; policy->cur = g5_cpu_freqs[g5_query_freq()].frequency;
/* secondary CPUs are tied to the primary one by the /* secondary CPUs are tied to the primary one by the
......
...@@ -93,7 +93,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -93,7 +93,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cur = sh_cpufreq_get(policy->cpu); policy->cur = sh_cpufreq_get(policy->cpu);
policy->min = policy->cpuinfo.min_freq; policy->min = policy->cpuinfo.min_freq;
policy->max = policy->cpuinfo.max_freq; policy->max = policy->cpuinfo.max_freq;
......
...@@ -326,7 +326,6 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) ...@@ -326,7 +326,6 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
table[2].index = 5; table[2].index = 5;
table[3].frequency = CPUFREQ_TABLE_END; table[3].frequency = CPUFREQ_TABLE_END;
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 0; policy->cpuinfo.transition_latency = 0;
policy->cur = clock_tick; policy->cur = clock_tick;
......
...@@ -763,6 +763,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -763,6 +763,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
init_completion(&policy->kobj_unregister); init_completion(&policy->kobj_unregister);
INIT_WORK(&policy->update, handle_update); INIT_WORK(&policy->update, handle_update);
/* Set governor before ->init, so that driver could check it */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
/* call driver. From then on the cpufreq must be able /* call driver. From then on the cpufreq must be able
* to accept all calls to ->verify and ->setpolicy for this CPU * to accept all calls to ->verify and ->setpolicy for this CPU
*/ */
......
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