Commit 9b80ac47 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-dj.bkbits.net/cpufreq

into home.osdl.org:/home/torvalds/v2.5/linux
parents 9c203f3d c2ffde0c
...@@ -12,7 +12,7 @@ config CPU_FREQ ...@@ -12,7 +12,7 @@ config CPU_FREQ
because the lower the clock speed, the less power the CPU consumes. because the lower the clock speed, the less power the CPU consumes.
For more information, take a look at linux/Documentation/cpu-freq or For more information, take a look at linux/Documentation/cpu-freq or
at <http://www.brodo.de/cpufreq/> at <http://www.codemonkey.org.uk/projects/cpufreq/>
If in doubt, say N. If in doubt, say N.
...@@ -90,7 +90,7 @@ config X86_POWERNOW_K7 ...@@ -90,7 +90,7 @@ config X86_POWERNOW_K7
config X86_POWERNOW_K8 config X86_POWERNOW_K8
tristate "AMD Opteron/Athlon64 PowerNow!" tristate "AMD Opteron/Athlon64 PowerNow!"
depends on CPU_FREQ_TABLE depends on CPU_FREQ && EXPERIMENTAL
help help
This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
......
...@@ -373,7 +373,7 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy) ...@@ -373,7 +373,7 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy)
case 6: case 6:
cpuname = "C3 'Samuel' [C5A]"; cpuname = "C3 'Samuel' [C5A]";
longhaul_version=1; longhaul_version=1;
memcpy (clock_ratio, longhaul1_clock_ratio, sizeof(longhaul1_clock_ratio)); memcpy (clock_ratio, samuel1_clock_ratio, sizeof(samuel1_clock_ratio));
memcpy (eblcr_table, samuel1_eblcr, sizeof(samuel1_eblcr)); memcpy (eblcr_table, samuel1_eblcr, sizeof(samuel1_eblcr));
break; break;
...@@ -382,13 +382,17 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy) ...@@ -382,13 +382,17 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy)
case 0: case 0:
cpuname = "C3 'Samuel 2' [C5B]"; cpuname = "C3 'Samuel 2' [C5B]";
longhaul_version=1; longhaul_version=1;
memcpy (clock_ratio, longhaul1_clock_ratio, sizeof(longhaul1_clock_ratio)); /* Note, this is not a typo, early Samuel2's had Samuel1 ratios. */
memcpy (clock_ratio, samuel1_clock_ratio, sizeof(samuel1_clock_ratio));
memcpy (eblcr_table, samuel2_eblcr, sizeof(samuel2_eblcr)); memcpy (eblcr_table, samuel2_eblcr, sizeof(samuel2_eblcr));
break; break;
case 1 ... 15: case 1 ... 15:
cpuname = "C3 'Ezra' [C5C]"; if (c->x86_mask < 8)
cpuname = "C3 'Samuel 2' [C5B]";
else
cpuname = "C3 'Ezra' [C5C]";
longhaul_version=2; longhaul_version=2;
memcpy (clock_ratio, longhaul2_clock_ratio, sizeof(longhaul2_clock_ratio)); memcpy (clock_ratio, ezra_clock_ratio, sizeof(ezra_clock_ratio));
memcpy (eblcr_table, ezra_eblcr, sizeof(ezra_eblcr)); memcpy (eblcr_table, ezra_eblcr, sizeof(ezra_eblcr));
break; break;
} }
...@@ -398,14 +402,16 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy) ...@@ -398,14 +402,16 @@ static int longhaul_cpu_init (struct cpufreq_policy *policy)
cpuname = "C3 'Ezra-T [C5M]"; cpuname = "C3 'Ezra-T [C5M]";
longhaul_version=3; longhaul_version=3;
numscales=32; numscales=32;
memcpy (clock_ratio, longhaul3_clock_ratio, sizeof(longhaul3_clock_ratio)); memcpy (clock_ratio, ezrat_clock_ratio, sizeof(ezrat_clock_ratio));
memcpy (eblcr_table, c5m_eblcr, sizeof(c5m_eblcr)); memcpy (eblcr_table, ezrat_eblcr, sizeof(ezrat_eblcr));
break; break;
/* /*
case 9: case 9:
cpuname = "C3 'Nehemiah' [C5N]"; cpuname = "C3 'Nehemiah' [C5N]";
longhaul_version=3; longhaul_version=3;
numscales=32; numscales=32;
memcpy (clock_ratio, nehemiah_clock_ratio, sizeof(nehemiah_clock_ratio));
memcpy (eblcr_table, nehemiah_eblcr, sizeof(nehemiah_eblcr));
*/ */
default: default:
cpuname = "Unknown"; cpuname = "Unknown";
...@@ -445,12 +451,8 @@ static int __init longhaul_init (void) ...@@ -445,12 +451,8 @@ static int __init longhaul_init (void)
return -ENODEV; return -ENODEV;
switch (c->x86_model) { switch (c->x86_model) {
case 6 ... 7: case 6 ... 8:
return cpufreq_register_driver(&longhaul_driver); return cpufreq_register_driver(&longhaul_driver);
case 8:
printk (KERN_INFO PFX "Ezra-T unsupported: Waiting on updated docs "
"from VIA before this is usable.\n");
break;
case 9: case 9:
printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon " printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon "
"from VIA before this is usable.\n"); "from VIA before this is usable.\n");
......
...@@ -56,7 +56,7 @@ union msr_longhaul { ...@@ -56,7 +56,7 @@ union msr_longhaul {
/* /*
* VIA C3 Samuel 1 & Samuel 2 (stepping 0) * VIA C3 Samuel 1 & Samuel 2 (stepping 0)
*/ */
static int __initdata longhaul1_clock_ratio[16] = { static int __initdata samuel1_clock_ratio[16] = {
-1, /* 0000 -> RESERVED */ -1, /* 0000 -> RESERVED */
30, /* 0001 -> 3.0x */ 30, /* 0001 -> 3.0x */
40, /* 0010 -> 4.0x */ 40, /* 0010 -> 4.0x */
...@@ -95,27 +95,8 @@ static int __initdata samuel1_eblcr[16] = { ...@@ -95,27 +95,8 @@ static int __initdata samuel1_eblcr[16] = {
}; };
/* /*
* VIA C3 Samuel2 Stepping 1->15 & VIA C3 Ezra * VIA C3 Samuel2 Stepping 1->15
*/ */
static int __initdata longhaul2_clock_ratio[16] = {
100, /* 0000 -> 10.0x */
30, /* 0001 -> 3.0x */
40, /* 0010 -> 4.0x */
90, /* 0011 -> 9.0x */
95, /* 0100 -> 9.5x */
35, /* 0101 -> 3.5x */
45, /* 0110 -> 4.5x */
55, /* 0111 -> 5.5x */
60, /* 1000 -> 6.0x */
70, /* 1001 -> 7.0x */
80, /* 1010 -> 8.0x */
50, /* 1011 -> 5.0x */
65, /* 1100 -> 6.5x */
75, /* 1101 -> 7.5x */
85, /* 1110 -> 8.5x */
120, /* 1111 -> 12.0x */
};
static int __initdata samuel2_eblcr[16] = { static int __initdata samuel2_eblcr[16] = {
50, /* 0000 -> 5.0x */ 50, /* 0000 -> 5.0x */
30, /* 0001 -> 3.0x */ 30, /* 0001 -> 3.0x */
...@@ -135,6 +116,28 @@ static int __initdata samuel2_eblcr[16] = { ...@@ -135,6 +116,28 @@ static int __initdata samuel2_eblcr[16] = {
65, /* 1111 -> 6.5x */ 65, /* 1111 -> 6.5x */
}; };
/*
* VIA C3 Ezra
*/
static int __initdata ezra_clock_ratio[16] = {
100, /* 0000 -> 10.0x */
30, /* 0001 -> 3.0x */
40, /* 0010 -> 4.0x */
90, /* 0011 -> 9.0x */
95, /* 0100 -> 9.5x */
35, /* 0101 -> 3.5x */
45, /* 0110 -> 4.5x */
55, /* 0111 -> 5.5x */
60, /* 1000 -> 6.0x */
70, /* 1001 -> 7.0x */
80, /* 1010 -> 8.0x */
50, /* 1011 -> 5.0x */
65, /* 1100 -> 6.5x */
75, /* 1101 -> 7.5x */
85, /* 1110 -> 8.5x */
120, /* 1111 -> 12.0x */
};
static int __initdata ezra_eblcr[16] = { static int __initdata ezra_eblcr[16] = {
50, /* 0000 -> 5.0x */ 50, /* 0000 -> 5.0x */
30, /* 0001 -> 3.0x */ 30, /* 0001 -> 3.0x */
...@@ -157,7 +160,7 @@ static int __initdata ezra_eblcr[16] = { ...@@ -157,7 +160,7 @@ static int __initdata ezra_eblcr[16] = {
/* /*
* VIA C3 (Ezra-T) [C5M]. * VIA C3 (Ezra-T) [C5M].
*/ */
static int __initdata longhaul3_clock_ratio[32] = { static int __initdata ezrat_clock_ratio[32] = {
100, /* 0000 -> 10.0x */ 100, /* 0000 -> 10.0x */
30, /* 0001 -> 3.0x */ 30, /* 0001 -> 3.0x */
40, /* 0010 -> 4.0x */ 40, /* 0010 -> 4.0x */
...@@ -193,7 +196,7 @@ static int __initdata longhaul3_clock_ratio[32] = { ...@@ -193,7 +196,7 @@ static int __initdata longhaul3_clock_ratio[32] = {
-1, /* 1111 -> RESERVED (12.0x) */ -1, /* 1111 -> RESERVED (12.0x) */
}; };
static int __initdata c5m_eblcr[32] = { static int __initdata ezrat_eblcr[32] = {
50, /* 0000 -> 5.0x */ 50, /* 0000 -> 5.0x */
30, /* 0001 -> 3.0x */ 30, /* 0001 -> 3.0x */
40, /* 0010 -> 4.0x */ 40, /* 0010 -> 4.0x */
...@@ -229,7 +232,79 @@ static int __initdata c5m_eblcr[32] = { ...@@ -229,7 +232,79 @@ static int __initdata c5m_eblcr[32] = {
145, /* 1111 -> 14.5x */ 145, /* 1111 -> 14.5x */
}; };
/*
* VIA C3 Nehemiah */
static int __initdata nehemiah_clock_ratio[32] = {
100, /* 0000 -> 10.0x */
160, /* 0001 -> 16.0x */
-1, /* 0010 -> RESERVED */
90, /* 0011 -> 9.0x */
95, /* 0100 -> 9.5x */
-1, /* 0101 -> RESERVED */
-1, /* 0110 -> RESERVED */
55, /* 0111 -> 5.5x */
60, /* 1000 -> 6.0x */
70, /* 1001 -> 7.0x */
80, /* 1010 -> 8.0x */
50, /* 1011 -> 5.0x */
65, /* 1100 -> 6.5x */
75, /* 1101 -> 7.5x */
85, /* 1110 -> 8.5x */
120, /* 1111 -> 12.0x */
100, /* 0000 -> 10.0x */
110, /* 0001 -> 11.0x */
120, /* 0010 -> 12.0x */
90, /* 0011 -> 9.0x */
105, /* 0100 -> 10.5x */
115, /* 0101 -> 11.5x */
125, /* 0110 -> 12.5x */
135, /* 0111 -> 13.5x */
140, /* 1000 -> 14.0x */
150, /* 1001 -> 15.0x */
160, /* 1010 -> 16.0x */
130, /* 1011 -> 13.0x */
145, /* 1100 -> 14.5x */
155, /* 1101 -> 15.5x */
-1, /* 1110 -> RESERVED */
120, /* 1111 -> 12.0x */
};
static int __initdata nehemiah_eblcr[32] = {
50, /* 0000 -> 5.0x */
160, /* 0001 -> 16.0x */
-1, /* 0010 -> RESERVED */
100, /* 0011 -> 10.0x */
55, /* 0100 -> 5.5x */
-1, /* 0101 -> RESERVED */
-1, /* 0110 -> RESERVED */
95, /* 0111 -> 9.5x */
90, /* 1000 -> 9.0x */
70, /* 1001 -> 7.0x */
80, /* 1010 -> 8.0x */
60, /* 1011 -> 6.0x */
120, /* 1100 -> 12.0x */
75, /* 1101 -> 7.5x */
85, /* 1110 -> 8.5x */
65, /* 1111 -> 6.5x */
90, /* 0000 -> 9.0x */
110, /* 0001 -> 11.0x */
120, /* 0010 -> 12.0x */
100, /* 0011 -> 10.0x */
135, /* 0100 -> 13.5x */
115, /* 0101 -> 11.5x */
125, /* 0110 -> 12.5x */
105, /* 0111 -> 10.5x */
130, /* 1000 -> 13.0x */
150, /* 1001 -> 15.0x */
160, /* 1010 -> 16.0x */
140, /* 1011 -> 14.0x */
120, /* 1100 -> 12.0x */
155, /* 1101 -> 15.5x */
-1, /* 1110 -> RESERVED */
-1, /* 1111 -> RESERVED */
};
/* /*
* Voltage scales. Div/Mod by 1000 to get actual voltage. * Voltage scales. Div/Mod by 1000 to get actual voltage.
* Which scale to use depends on the VRM type in use. * Which scale to use depends on the VRM type in use.
......
...@@ -72,9 +72,9 @@ static u32 batps; /* limit on the number of p states when on battery */ ...@@ -72,9 +72,9 @@ static u32 batps; /* limit on the number of p states when on battery */
/* - set by BIOS in the PSB/PST */ /* - set by BIOS in the PSB/PST */
static struct cpufreq_driver cpufreq_amd64_driver = { static struct cpufreq_driver cpufreq_amd64_driver = {
.verify = drv_verify, .verify = powernowk8_verify,
.target = drv_target, .target = powernowk8_target,
.init = drv_cpu_init, .init = powernowk8_cpu_init,
.name = "cpufreq-amd64", .name = "cpufreq-amd64",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
...@@ -90,7 +90,7 @@ find_freq_from_fid(u32 fid) ...@@ -90,7 +90,7 @@ find_freq_from_fid(u32 fid)
} }
/* Return a fid matching an input frequency in MHz */ /* Return a fid matching an input frequency in MHz */
u32 static u32
find_fid_from_freq(u32 freq) find_fid_from_freq(u32 freq)
{ {
return (freq - 800) / 100; return (freq - 800) / 100;
...@@ -718,7 +718,7 @@ find_psb_table(void) ...@@ -718,7 +718,7 @@ find_psb_table(void)
/* Converts a frequency (that might not necessarily be a multiple of 200) */ /* Converts a frequency (that might not necessarily be a multiple of 200) */
/* to a fid. */ /* to a fid. */
u32 static u32
find_closest_fid(u32 freq, int searchup) find_closest_fid(u32 freq, int searchup)
{ {
if (searchup == SEARCH_UP) if (searchup == SEARCH_UP)
...@@ -861,7 +861,7 @@ transition_frequency(u32 * preq, u32 * pmin, u32 * pmax, u32 searchup) ...@@ -861,7 +861,7 @@ transition_frequency(u32 * preq, u32 * pmin, u32 * pmax, u32 searchup)
/* Driver entry point to switch to the target frequency */ /* Driver entry point to switch to the target frequency */
static int static int
drv_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation)
{ {
u32 checkfid = currfid; u32 checkfid = currfid;
u32 checkvid = currvid; u32 checkvid = currvid;
...@@ -909,7 +909,7 @@ drv_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) ...@@ -909,7 +909,7 @@ drv_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation)
/* Driver entry point to verify the policy and range of frequencies */ /* Driver entry point to verify the policy and range of frequencies */
static int static int
drv_verify(struct cpufreq_policy *pol) powernowk8_verify(struct cpufreq_policy *pol)
{ {
u32 min = pol->min / 1000; u32 min = pol->min / 1000;
u32 max = pol->max / 1000; u32 max = pol->max / 1000;
...@@ -935,6 +935,7 @@ drv_verify(struct cpufreq_policy *pol) ...@@ -935,6 +935,7 @@ drv_verify(struct cpufreq_policy *pol)
return -ENODEV; return -ENODEV;
} }
#warning pol->policy is in undefined state here
res = find_match(&targ, &min, &max, res = find_match(&targ, &min, &max,
pol->policy == CPUFREQ_POLICY_POWERSAVE ? pol->policy == CPUFREQ_POLICY_POWERSAVE ?
SEARCH_DOWN : SEARCH_UP, 0, 0); SEARCH_DOWN : SEARCH_UP, 0, 0);
...@@ -947,14 +948,14 @@ drv_verify(struct cpufreq_policy *pol) ...@@ -947,14 +948,14 @@ drv_verify(struct cpufreq_policy *pol)
/* per CPU init entry point to the driver */ /* per CPU init entry point to the driver */
static int __init static int __init
drv_cpu_init(struct cpufreq_policy *pol) powernowk8_cpu_init(struct cpufreq_policy *pol)
{ {
if (pol->cpu != 0) { if (pol->cpu != 0) {
printk(KERN_ERR PFX "init not cpu 0\n"); printk(KERN_ERR PFX "init not cpu 0\n");
return -ENODEV; return -ENODEV;
} }
pol->policy = CPUFREQ_POLICY_PERFORMANCE; /* boot as fast as we can */ pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
/* Take a crude guess here. */ /* Take a crude guess here. */
pol->cpuinfo.transition_latency = ((rvo + 8) * vstable * VST_UNITS_20US) pol->cpuinfo.transition_latency = ((rvo + 8) * vstable * VST_UNITS_20US)
...@@ -980,7 +981,7 @@ drv_cpu_init(struct cpufreq_policy *pol) ...@@ -980,7 +981,7 @@ drv_cpu_init(struct cpufreq_policy *pol)
/* driver entry point for init */ /* driver entry point for init */
static int __init static int __init
drv_init(void) powernowk8_init(void)
{ {
int rc; int rc;
...@@ -994,7 +995,7 @@ drv_init(void) ...@@ -994,7 +995,7 @@ drv_init(void)
return rc; return rc;
if (pending_bit_stuck()) { if (pending_bit_stuck()) {
printk(KERN_ERR PFX "drv_init fail, change pending bit set\n"); printk(KERN_ERR PFX "powernowk8_init fail, change pending bit set\n");
kfree(ppst); kfree(ppst);
return -EIO; return -EIO;
} }
...@@ -1004,9 +1005,9 @@ drv_init(void) ...@@ -1004,9 +1005,9 @@ drv_init(void)
/* driver entry point for term */ /* driver entry point for term */
static void __exit static void __exit
drv_exit(void) powernowk8_exit(void)
{ {
dprintk(KERN_INFO PFX "drv_exit\n"); dprintk(KERN_INFO PFX "powernowk8_exit\n");
cpufreq_unregister_driver(&cpufreq_amd64_driver); cpufreq_unregister_driver(&cpufreq_amd64_driver);
kfree(ppst); kfree(ppst);
...@@ -1016,5 +1017,5 @@ MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com>"); ...@@ -1016,5 +1017,5 @@ MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com>");
MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(drv_init); module_init(powernowk8_init);
module_exit(drv_exit); module_exit(powernowk8_exit);
...@@ -120,7 +120,7 @@ struct pst_s { ...@@ -120,7 +120,7 @@ struct pst_s {
static inline int core_voltage_pre_transition(u32 reqvid); static inline int core_voltage_pre_transition(u32 reqvid);
static inline int core_voltage_post_transition(u32 reqvid); static inline int core_voltage_post_transition(u32 reqvid);
static inline int core_frequency_transition(u32 reqfid); static inline int core_frequency_transition(u32 reqfid);
static int drv_verify(struct cpufreq_policy *pol); static int powernowk8_verify(struct cpufreq_policy *pol);
static int drv_target(struct cpufreq_policy *pol, unsigned targfreq, static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq,
unsigned relation); unsigned relation);
static int __init drv_cpu_init(struct cpufreq_policy *pol); static int __init powernowk8_cpu_init(struct cpufreq_policy *pol);
...@@ -6,7 +6,7 @@ config CPU_FREQ_PROC_INTF ...@@ -6,7 +6,7 @@ config CPU_FREQ_PROC_INTF
CPUFreq. Please note that it is recommended to use the sysfs CPUFreq. Please note that it is recommended to use the sysfs
interface instead (which is built automatically). interface instead (which is built automatically).
For details, take a look at linux/Documentation/cpufreq. For details, take a look at linux/Documentation/cpu-freq.
If in doubt, say N. If in doubt, say N.
...@@ -64,7 +64,7 @@ config CPU_FREQ_GOV_USERSPACE ...@@ -64,7 +64,7 @@ config CPU_FREQ_GOV_USERSPACE
be able to set the CPU dynamically, like on LART be able to set the CPU dynamically, like on LART
<http://www.lart.tudelft.nl/> <http://www.lart.tudelft.nl/>
For details, take a look at linux/Documentation/cpufreq. For details, take a look at linux/Documentation/cpu-freq.
If in doubt, say Y. If in doubt, say Y.
...@@ -78,6 +78,6 @@ config CPU_FREQ_24_API ...@@ -78,6 +78,6 @@ config CPU_FREQ_24_API
the same functionality as long as "userspace" is the the same functionality as long as "userspace" is the
selected governor for the specified CPU. selected governor for the specified CPU.
For details, take a look at linux/Documentation/cpufreq. For details, take a look at linux/Documentation/cpu-freq.
If in doubt, say N. If in doubt, say N.
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