Commit 42124408 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] scaling_available_frequencies work for remaining x86 drivers.

Export scaling_available_frequencies on the remaining
x86 freq_table-based cpufreq drivers. powernow-k7, acpi and speedstep-centrino
are already queued.
                                                                                                       
Please note that this cannot be done in the cpufreq core as the cpufreq core
tries very hard to be independent of the freq_table helpers. 
parent a553f9a7
......@@ -199,6 +199,7 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
{
struct cpuinfo_x86 *c = cpu_data;
unsigned int i;
int result;
/* capability check */
if ((c->x86_vendor != X86_VENDOR_AMD) ||
......@@ -220,7 +221,20 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = elanfreq_get_cpu_frequency();
return cpufreq_frequency_table_cpuinfo(policy, &elanfreq_table[0]);;
result = cpufreq_frequency_table_cpuinfo(policy, elanfreq_table);
if (result)
return (result);
cpufreq_frequency_table_get_attr(elanfreq_table, policy->cpu);
return 0;
}
static int elanfreq_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
......@@ -245,12 +259,20 @@ __setup("elanfreq=", elanfreq_setup);
#endif
static struct freq_attr* elanfreq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver elanfreq_driver = {
.verify = elanfreq_verify,
.target = elanfreq_target,
.init = elanfreq_cpu_init,
.exit = elanfreq_cpu_exit,
.name = "elanfreq",
.owner = THIS_MODULE,
.attr = elanfreq_attr,
};
......
......@@ -234,6 +234,8 @@ static int __init longhaul_get_ranges (void)
case 2:
rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
//TODO: Nehemiah may have borken MaxMHzBR.
// need to extrapolate from FSB.
invalue = longhaul.bits.MaxMHzBR;
if (longhaul.bits.MaxMHzBR4)
invalue += 16;
......@@ -447,15 +449,34 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb);
return cpufreq_frequency_table_cpuinfo(policy, longhaul_table);
ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);
if (ret)
return ret;
cpufreq_frequency_table_get_attr(longhaul_table, policy->cpu);
return 0;
}
static int longhaul_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
static struct freq_attr* longhaul_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver longhaul_driver = {
.verify = longhaul_verify,
.target = longhaul_target,
.init = longhaul_cpu_init,
.exit = longhaul_cpu_exit,
.name = "longhaul",
.owner = THIS_MODULE,
.attr = longhaul_attr,
};
static int __init longhaul_init (void)
......
......@@ -140,6 +140,7 @@ static int powernow_k6_target (struct cpufreq_policy *policy,
static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
{
unsigned int i;
int result;
if (policy->cpu != 0)
return -ENODEV;
......@@ -161,7 +162,13 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = busfreq * max_multiplier;
return cpufreq_frequency_table_cpuinfo(policy, &clock_ratio[0]);
result = cpufreq_frequency_table_cpuinfo(policy, clock_ratio);
if (result)
return (result);
cpufreq_frequency_table_get_attr(clock_ratio, policy->cpu);
return 0;
}
......@@ -172,9 +179,14 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
if (i==max_multiplier)
powernow_k6_set_state(i);
}
return 0;
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
static struct freq_attr* powernow_k6_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver powernow_k6_driver = {
.verify = powernow_k6_verify,
......@@ -183,6 +195,7 @@ static struct cpufreq_driver powernow_k6_driver = {
.exit = powernow_k6_cpu_exit,
.name = "powernow-k6",
.owner = THIS_MODULE,
.attr = powernow_k6_attr,
};
......
......@@ -802,6 +802,8 @@ powernowk8_cpu_init(struct cpufreq_policy *pol)
return -EINVAL;
}
cpufreq_frequency_table_get_attr(powernow_table, pol->cpu);
printk(KERN_INFO PFX "cpu_init done, current fid 0x%x, vid 0x%x\n",
currfid, currvid);
......@@ -813,12 +815,19 @@ static int __exit powernowk8_cpu_exit (struct cpufreq_policy *pol)
if (pol->cpu != 0)
return -EINVAL;
cpufreq_frequency_table_put_attr(pol->cpu);
if (powernow_table)
kfree(powernow_table);
return 0;
}
static struct freq_attr* powernow_k8_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver cpufreq_amd64_driver = {
.verify = powernowk8_verify,
.target = powernowk8_target,
......@@ -826,6 +835,7 @@ static struct cpufreq_driver cpufreq_amd64_driver = {
.exit = powernowk8_cpu_exit,
.name = "powernow-k8",
.owner = THIS_MODULE,
.attr = powernow_k8_attr,
};
......
......@@ -303,16 +303,37 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = speed;
return cpufreq_frequency_table_cpuinfo(policy, &speedstep_freqs[0]);
result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
if (result)
return (result);
cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
return 0;
}
static int speedstep_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
static struct freq_attr* speedstep_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver speedstep_driver = {
.name = "speedstep-ich",
.verify = speedstep_verify,
.target = speedstep_target,
.init = speedstep_cpu_init,
.exit = speedstep_cpu_exit,
.owner = THIS_MODULE,
.attr = speedstep_attr,
};
......
......@@ -286,7 +286,20 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = speed;
return cpufreq_frequency_table_cpuinfo(policy, &speedstep_freqs[0]);
result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
if (result)
return (result);
cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
return 0;
}
static int speedstep_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
......@@ -300,14 +313,20 @@ static int speedstep_resume(struct cpufreq_policy *policy)
return result;
}
static struct freq_attr* speedstep_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver speedstep_driver = {
.name = "speedstep-smi",
.verify = speedstep_verify,
.target = speedstep_target,
.init = speedstep_cpu_init,
.exit = speedstep_cpu_exit,
.resume = speedstep_resume,
.owner = THIS_MODULE,
.attr = speedstep_attr,
};
/**
......
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