bk://linux-dj.bkbits.net/cpufreq
davej@redhat.com|ChangeSet|20050321044514|41621 davej

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/22 14:05:43-08:00 akpm@bix.(none) 
#   Merge bk://linux-dj.bkbits.net/cpufreq
#   into bix.(none):/usr/src/bk-cpufreq
# 
# arch/i386/kernel/cpu/cpufreq/Kconfig
#   2005/03/22 14:05:38-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/20 23:45:14-05:00 davej@redhat.com 
#   [CPUFREQ] AMD Elan SC520 cpufreq driver.
#   
#   From: Sean Young <sean@mess.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/sc520_freq.c
#   2005/03/20 23:45:03-05:00 davej@redhat.com +179 -0
# 
# arch/i386/kernel/cpu/cpufreq/sc520_freq.c
#   2005/03/20 23:45:03-05:00 davej@redhat.com +0 -0
#   BitKeeper file /mnt/data/src/bk/cpufreq/arch/i386/kernel/cpu/cpufreq/sc520_freq.c
# 
# arch/i386/kernel/cpu/cpufreq/Makefile
#   2005/03/20 23:45:02-05:00 davej@redhat.com +1 -0
#   [CPUFREQ] AMD Elan SC520 cpufreq driver.
#   
#   From: Sean Young <sean@mess.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/Kconfig
#   2005/03/20 23:45:02-05:00 davej@redhat.com +13 -1
#   [CPUFREQ] AMD Elan SC520 cpufreq driver.
#   
#   From: Sean Young <sean@mess.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# Documentation/cpu-freq/user-guide.txt
#   2005/03/20 23:45:02-05:00 davej@redhat.com +1 -0
#   [CPUFREQ] AMD Elan SC520 cpufreq driver.
#   
#   From: Sean Young <sean@mess.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 23:41:43-08:00 akpm@bix.(none) 
#   Merge bk://linux-dj.bkbits.net/cpufreq
#   into bix.(none):/usr/src/bk-cpufreq
# 
# drivers/cpufreq/cpufreq.c
#   2005/03/14 23:41:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/cpufreq/Kconfig
#   2005/03/14 23:41:39-08:00 akpm@bix.(none) +0 -10
#   Auto merged
# 
# arch/i386/kernel/cpu/cpufreq/Kconfig
#   2005/03/14 23:41:39-08:00 akpm@bix.(none) +0 -24
#   Auto merged
# 
# ChangeSet
#   2005/03/14 21:49:06-05:00 davej@redhat.com 
#   [CPUFREQ] Add warning comment about default governors.
#   
#   This comes up time and time again. Until its fixed, place this
#   comment in the Kconfig which should stem the flow of resubmissions.
#   
#   Signed-off-by: Rob Weryk <rjweryk@uwo.ca>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# drivers/cpufreq/Kconfig
#   2005/03/14 21:48:56-05:00 davej@redhat.com +4 -0
#   [CPUFREQ] Add warning comment about default governors.
#   
#   This comes up time and time again. Until its fixed, place this
#   comment in the Kconfig which should stem the flow of resubmissions.
#   
#   Signed-off-by: Rob Weryk <rjweryk@uwo.ca>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 21:43:30-05:00 davej@redhat.com 
#   [CPUFREQ] speedstep-smi: it works on at least one P4M
#   
#   The speedstep-smi driver actually works on >=1 notebook with a
#   Pentium 4-M CPU where all other cpufreq drivers fail. Therefore,
#   allow speedstep-smi on P4Ms again, but warn users of likely failure
#   
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
#   2005/03/14 21:43:20-05:00 davej@redhat.com +3 -0
#   [CPUFREQ] speedstep-smi: it works on at least one P4M
#   
#   The speedstep-smi driver actually works on >=1 notebook with a
#   Pentium 4-M CPU where all other cpufreq drivers fail. Therefore,
#   allow speedstep-smi on P4Ms again, but warn users of likely failure
#   
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 21:42:13-05:00 davej@redhat.com 
#   [CPUFREQ] ondemand: trivial clean-ups
#   
#   From: Eric Piel <Eric.Piel@tremplin-utc.net>
#   
#   Trivial ondemand governor clean-ups:
#   - change from sampling_rate_in_HZ() to the official function
#   usecs_to_jiffies().
#   - use for_each_online_cpu() to instead of using "if (cpu_online(i))"
#   
#   Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
#   Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# drivers/cpufreq/cpufreq_ondemand.c
#   2005/03/14 21:42:03-05:00 davej@redhat.com +6 -8
#   [CPUFREQ] ondemand: trivial clean-ups
#   
#   From: Eric Piel <Eric.Piel@tremplin-utc.net>
#   
#   Trivial ondemand governor clean-ups:
#   - change from sampling_rate_in_HZ() to the official function
#   usecs_to_jiffies().
#   - use for_each_online_cpu() to instead of using "if (cpu_online(i))"
#   
#   Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
#   Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 21:41:23-05:00 davej@redhat.com 
#   [CPUFREQ] core/x86: Kconfig cleanup
#   
#   From: Roman Zippel <zippel@linux-m68k.org>
#   
#   This properly indents the cpufreq menu.
#   Remove CPU_FREQ_TABLE as visible option and use select instead.
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# drivers/cpufreq/Kconfig
#   2005/03/14 21:41:13-05:00 davej@redhat.com +10 -10
#   [CPUFREQ] core/x86: Kconfig cleanup
#   
#   From: Roman Zippel <zippel@linux-m68k.org>
#   
#   This properly indents the cpufreq menu.
#   Remove CPU_FREQ_TABLE as visible option and use select instead.
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/Kconfig
#   2005/03/14 21:41:13-05:00 davej@redhat.com +24 -30
#   [CPUFREQ] core/x86: Kconfig cleanup
#   
#   From: Roman Zippel <zippel@linux-m68k.org>
#   
#   This properly indents the cpufreq menu.
#   Remove CPU_FREQ_TABLE as visible option and use select instead.
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 21:40:17-05:00 davej@redhat.com 
#   [CPUFREQ] speedstep-centrino: Pentium 4 - M (HT) support
#   
#   The Pentium 4 - Ms (HT) with CPUID 0xF34 and 0xF41 seem to support
#   centrino-like enhanced speedstep; however, no "table" support is possible.
#   Therefore, put NULL entries into speedstep-centrino.c
#   
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
#   2005/03/14 21:37:57-05:00 davej@redhat.com +6 -0
#   [CPUFREQ] speedstep-centrino: Pentium 4 - M (HT) support
#   
#   The Pentium 4 - Ms (HT) with CPUID 0xF34 and 0xF41 seem to support
#   centrino-like enhanced speedstep; however, no "table" support is possible.
#   Therefore, put NULL entries into speedstep-centrino.c
#   
#   Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/03/14 21:25:51-05:00 davej@delerium.kernelslacker.org 
#   Merge delerium.kernelslacker.org:/mnt/data/src/bk/bk-linus
#   into delerium.kernelslacker.org:/mnt/data/src/bk/cpufreq
# 
# drivers/cpufreq/cpufreq.c
#   2005/03/14 21:25:45-05:00 davej@delerium.kernelslacker.org +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/01 22:12:24-08:00 akpm@bix.(none) 
#   Merge bk://linux-dj.bkbits.net/cpufreq
#   into bix.(none):/usr/src/bk-cpufreq
# 
# drivers/cpufreq/cpufreq.c
#   2005/03/01 22:12:20-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/02/23 12:49:22-05:00 davej@redhat.com 
#   [CPUFREQ] cpufreq-core: reduce warning messages.
#   
#   cpufreq core is printing out messages at KERN_WARNING level that the core
#   recovers from without intervention, and that the system administrator can
#   do nothing about.  Patch below reduces the severity of these messages to
#   debug.
#   
#   Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# drivers/cpufreq/cpufreq.c
#   2005/02/23 12:49:13-05:00 davej@redhat.com +4 -4
#   [CPUFREQ] cpufreq-core: reduce warning messages.
#   
#   cpufreq core is printing out messages at KERN_WARNING level that the core
#   recovers from without intervention, and that the system administrator can
#   do nothing about.  Patch below reduces the severity of these messages to
#   debug.
#   
#   Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# ChangeSet
#   2005/01/27 19:16:17-05:00 davej@redhat.com 
#   [CPUFREQ] powernow-k7: don't print khz element of FSB.
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k7.c
#   2005/01/27 19:16:08-05:00 davej@redhat.com +1 -1
#   [CPUFREQ] powernow-k7: don't print khz element of FSB.
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
# 
diff -Nru a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt
--- a/Documentation/cpu-freq/user-guide.txt	2005-03-24 18:18:34 -08:00
+++ b/Documentation/cpu-freq/user-guide.txt	2005-03-24 18:18:34 -08:00
@@ -53,6 +53,7 @@
 The following processors for the x86 architecture are supported by cpufreq:
 
 AMD Elan - SC400, SC410
+AMD Elan - SC520
 AMD mobile K6-2+
 AMD mobile K6-3+
 AMD mobile Duron
diff -Nru a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig
--- a/arch/i386/kernel/cpu/cpufreq/Kconfig	2005-03-24 18:18:34 -08:00
+++ b/arch/i386/kernel/cpu/cpufreq/Kconfig	2005-03-24 18:18:34 -08:00
@@ -23,7 +23,7 @@
 	  If in doubt, say N.
 
 config ELAN_CPUFREQ
-	tristate "AMD Elan"
+	tristate "AMD Elan SC500 and SC410"
 	select CPU_FREQ_TABLE
 	depends on X86_ELAN
 	---help---
@@ -37,6 +37,18 @@
 	  For details, take a look at <file:Documentation/cpu-freq/>.
 
 	  If in doubt, say N.
+
+config SC520_CPUFREQ
+	tristate "AMD Elan SC520"
+	select CPU_FREQ_TABLE
+	depends on X86_ELAN
+	---help---
+	  This adds the CPUFreq driver for AMD Elan SC520 processor.
+
+	  For details, take a look at <file:Documentation/cpu-freq/>.
+
+	  If in doubt, say N.
+
 
 config X86_POWERNOW_K6
 	tristate "AMD Mobile K6-2/K6-3 PowerNow!"
diff -Nru a/arch/i386/kernel/cpu/cpufreq/Makefile b/arch/i386/kernel/cpu/cpufreq/Makefile
--- a/arch/i386/kernel/cpu/cpufreq/Makefile	2005-03-24 18:18:34 -08:00
+++ b/arch/i386/kernel/cpu/cpufreq/Makefile	2005-03-24 18:18:34 -08:00
@@ -3,6 +3,7 @@
 obj-$(CONFIG_X86_POWERNOW_K8)		+= powernow-k8.o
 obj-$(CONFIG_X86_LONGHAUL)		+= longhaul.o
 obj-$(CONFIG_ELAN_CPUFREQ)		+= elanfreq.o
+obj-$(CONFIG_SC520_CPUFREQ)		+= sc520_freq.o
 obj-$(CONFIG_X86_LONGRUN)		+= longrun.o  
 obj-$(CONFIG_X86_GX_SUSPMOD)		+= gx-suspmod.o
 obj-$(CONFIG_X86_SPEEDSTEP_ICH)		+= speedstep-ich.o
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	2005-03-24 18:18:34 -08:00
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	2005-03-24 18:18:34 -08:00
@@ -592,7 +592,7 @@
 		printk(KERN_WARNING PFX "can not determine bus frequency\n");
 		return -EINVAL;
 	}
-	dprintk("FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000);
+	dprintk("FSB: %3dMHz\n", fsb/1000);
 
 	if (dmi_check_system(powernow_dmi_table) || acpi_force) {
 		printk (KERN_INFO PFX "PSB/PST known to be broken.  Trying ACPI instead\n");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c	2005-03-24 18:18:34 -08:00
@@ -0,0 +1,179 @@
+/*
+ *	sc520_freq.c: cpufreq driver for the AMD Elan sc520
+ *
+ *	Copyright (C) 2005 Sean Young <sean@mess.org>
+ *
+ *	This program is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU General Public License
+ *	as published by the Free Software Foundation; either version
+ *	2 of the License, or (at your option) any later version.
+ *
+ *	Based on elanfreq.c
+ *
+ *	2005-03-30: - initial revision
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/cpufreq.h>
+
+#include <asm/msr.h>
+#include <asm/timex.h>
+#include <asm/io.h>
+
+#define MMCR_BASE       0xfffef000      /* The default base address */
+#define OFFS_CPUCTL	0x2   /* CPU Control Register */
+
+static __u8 __iomem *cpuctl;
+
+static struct cpufreq_frequency_table sc520_freq_table[] = {
+	{0x01,	100000},
+	{0x02,	133000},
+	{0,	CPUFREQ_TABLE_END},
+};
+
+static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
+{
+	u8 clockspeed_reg = *cpuctl;
+
+	switch (clockspeed_reg & 0x03) {
+	default:
+		printk(KERN_ERR "sc520_freq: error: cpuctl register has unexpected value %02x\n", clockspeed_reg);
+	case 0x01:
+		return 100000;
+	case 0x02:
+		return 133000;
+	}
+}
+
+static void sc520_freq_set_cpu_state (unsigned int state)
+{
+
+	struct cpufreq_freqs    freqs;
+
+	freqs.old = sc520_freq_get_cpu_frequency(0);
+	freqs.new = sc520_freq_table[state].frequency;
+	freqs.cpu = 0; /* AMD Elan is UP */
+
+	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+
+	printk(KERN_INFO "sc520_freq: attempting to set frequency to %i kHz\n",
+			sc520_freq_table[state].frequency);
+
+	*cpuctl = sc520_freq_table[state].index;
+
+	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+};
+
+static int sc520_freq_verify (struct cpufreq_policy *policy)
+{
+	return cpufreq_frequency_table_verify(policy, &sc520_freq_table[0]);
+}
+
+static int sc520_freq_target (struct cpufreq_policy *policy,
+			    unsigned int target_freq,
+			    unsigned int relation)
+{
+	unsigned int newstate = 0;
+
+	if (cpufreq_frequency_table_target(policy, sc520_freq_table, target_freq, relation, &newstate))
+		return -EINVAL;
+
+	sc520_freq_set_cpu_state(newstate);
+
+	return 0;
+}
+
+
+/*
+ *	Module init and exit code
+ */
+
+static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
+{
+	struct cpuinfo_x86 *c = cpu_data;
+	int result;
+
+	/* capability check */
+	if (c->x86_vendor != X86_VENDOR_AMD ||
+	    c->x86 != 4 || c->x86_model != 9)
+		return -ENODEV;
+
+	/* cpuinfo and default policy values */
+	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
+	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	policy->cur = sc520_freq_get_cpu_frequency(0);
+
+	result = cpufreq_frequency_table_cpuinfo(policy, sc520_freq_table);
+	if (result)
+		return (result);
+
+        cpufreq_frequency_table_get_attr(sc520_freq_table, policy->cpu);
+
+	return 0;
+}
+
+
+static int sc520_freq_cpu_exit(struct cpufreq_policy *policy)
+{
+	cpufreq_frequency_table_put_attr(policy->cpu);
+	return 0;
+}
+
+
+static struct freq_attr* sc520_freq_attr[] = {
+	&cpufreq_freq_attr_scaling_available_freqs,
+	NULL,
+};
+
+
+static struct cpufreq_driver sc520_freq_driver = {
+	.get	= sc520_freq_get_cpu_frequency,
+	.verify	= sc520_freq_verify,
+	.target	= sc520_freq_target,
+	.init	= sc520_freq_cpu_init,
+	.exit	= sc520_freq_cpu_exit,
+	.name	= "sc520_freq",
+	.owner	= THIS_MODULE,
+	.attr	= sc520_freq_attr,
+};
+
+
+static int __init sc520_freq_init(void)
+{
+	struct cpuinfo_x86 *c = cpu_data;
+
+	/* Test if we have the right hardware */
+	if (c->x86_vendor != X86_VENDOR_AMD ||
+		c->x86 != 4 || c->x86_model != 9) {
+		printk(KERN_INFO "sc520_freq: error: no Elan SC520 processor found!\n");
+                return -ENODEV;
+	}
+	cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1);
+	if(!cpuctl) {
+		printk(KERN_ERR "sc520_freq: error: failed to remap memory\n");
+		return -ENOMEM;
+	}
+
+	return cpufreq_register_driver(&sc520_freq_driver);
+}
+
+
+static void __exit sc520_freq_exit(void)
+{
+	cpufreq_unregister_driver(&sc520_freq_driver);
+	iounmap(cpuctl);
+}
+
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sean Young <sean@mess.org>");
+MODULE_DESCRIPTION("cpufreq driver for AMD's Elan sc520 CPU");
+
+module_init(sc520_freq_init);
+module_exit(sc520_freq_exit);
+
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c	2005-03-24 18:18:34 -08:00
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c	2005-03-24 18:18:34 -08:00
@@ -54,6 +54,8 @@
 	CPU_DOTHAN_A1,
 	CPU_DOTHAN_A2,
 	CPU_DOTHAN_B0,
+	CPU_MP4HT_D0,
+	CPU_MP4HT_E0,
 };
 
 static const struct cpu_id cpu_ids[] = {
@@ -61,6 +63,8 @@
 	[CPU_DOTHAN_A1]	= { 6, 13, 1 },
 	[CPU_DOTHAN_A2]	= { 6, 13, 2 },
 	[CPU_DOTHAN_B0]	= { 6, 13, 6 },
+	[CPU_MP4HT_D0]	= {15,  3, 4 },
+	[CPU_MP4HT_E0]	= {15,  4, 1 },
 };
 #define N_IDS	(sizeof(cpu_ids)/sizeof(cpu_ids[0]))
 
@@ -226,6 +230,8 @@
 	{ &cpu_ids[CPU_DOTHAN_A1], NULL, 0, NULL },
 	{ &cpu_ids[CPU_DOTHAN_A2], NULL, 0, NULL },
 	{ &cpu_ids[CPU_DOTHAN_B0], NULL, 0, NULL },
+	{ &cpu_ids[CPU_MP4HT_D0], NULL, 0, NULL },
+	{ &cpu_ids[CPU_MP4HT_E0], NULL, 0, NULL },
 
 	{ NULL, }
 };
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	2005-03-24 18:18:34 -08:00
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	2005-03-24 18:18:34 -08:00
@@ -357,6 +357,9 @@
 	case SPEEDSTEP_PROCESSOR_PIII_C:
 	case SPEEDSTEP_PROCESSOR_PIII_C_EARLY:
 		break;
+	case SPEEDSTEP_PROCESSOR_P4M:
+		printk(KERN_INFO "speedstep-smi: you're trying to use this cpufreq driver on a Pentium 4-based CPU. Most likely it will not work.\n");
+		break;
 	default:
 		speedstep_processor = 0;
 	}
diff -Nru a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
--- a/drivers/cpufreq/Kconfig	2005-03-24 18:18:34 -08:00
+++ b/drivers/cpufreq/Kconfig	2005-03-24 18:18:34 -08:00
@@ -46,6 +46,10 @@
          This will show detail CPU frequency translation table in sysfs file
          system
 
+# Note that it is not currently possible to set the other governors (such as ondemand)
+# as the default, since if they fail to initialise, cpufreq will be
+# left in an undefined state.
+
 choice
 	prompt "Default CPUFreq governor"
 	default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110
diff -Nru a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
--- a/drivers/cpufreq/cpufreq.c	2005-03-24 18:18:34 -08:00
+++ b/drivers/cpufreq/cpufreq.c	2005-03-24 18:18:34 -08:00
@@ -258,7 +258,7 @@
 			    (likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&
 			    (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur)))
 			{
-				printk(KERN_WARNING "Warning: CPU frequency is %u, "
+				dprintk("Warning: CPU frequency is %u, "
 				       "cpufreq assumed %u kHz.\n", freqs->old, cpufreq_cpu_data[freqs->cpu]->cur);
 				freqs->old = cpufreq_cpu_data[freqs->cpu]->cur;
 			}
@@ -814,7 +814,7 @@
 {
 	struct cpufreq_freqs freqs;
 
-	printk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing "
+	dprintk("Warning: CPU frequency out of sync: cpufreq and timing "
 	       "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
 
 	freqs.cpu = cpu;
@@ -922,8 +922,8 @@
 		if (unlikely(cur_freq != cpu_policy->cur)) {
 			struct cpufreq_freqs freqs;
 
-			printk(KERN_WARNING "Warning: CPU frequency is %u, "
-			       "cpufreq assumed %u kHz.\n", cur_freq, cpu_policy->cur);
+			dprintk("Warning: CPU frequency is %u, cpufreq assumed %u kHz.\n",
+							cur_freq, cpu_policy->cur);
 
 			freqs.cpu = cpu;
 			freqs.old = cpu_policy->cur;
diff -Nru a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
--- a/drivers/cpufreq/cpufreq_ondemand.c	2005-03-24 18:18:34 -08:00
+++ b/drivers/cpufreq/cpufreq_ondemand.c	2005-03-24 18:18:34 -08:00
@@ -57,7 +57,6 @@
 #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER	(1000)
 #define DEF_SAMPLING_DOWN_FACTOR		(10)
 #define TRANSITION_LATENCY_LIMIT		(10 * 1000)
-#define sampling_rate_in_HZ(x)			(((x * HZ) < (1000 * 1000))?1:((x * HZ) / (1000 * 1000)))
 
 static void do_dbs_timer(void *data);
 
@@ -281,7 +280,7 @@
 	/* Scale idle ticks by 100 and compare with up and down ticks */
 	idle_ticks *= 100;
 	up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
 
 	if (idle_ticks < up_idle_ticks) {
 		__cpufreq_driver_target(policy, policy->max, 
@@ -328,7 +327,7 @@
 	freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *
 		dbs_tuners_ins.sampling_down_factor;
 	down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *
-			sampling_rate_in_HZ(freq_down_sampling_rate);
+			usecs_to_jiffies(freq_down_sampling_rate);
 
 	if (idle_ticks > down_idle_ticks ) {
 		freq_down_step = (5 * policy->max) / 100;
@@ -348,11 +347,10 @@
 { 
 	int i;
 	down(&dbs_sem);
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_online(i))
-			dbs_check_cpu(i);
+	for_each_online_cpu(i)
+		dbs_check_cpu(i);
 	schedule_delayed_work(&dbs_work, 
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	up(&dbs_sem);
 } 
 
@@ -360,7 +358,7 @@
 {
 	INIT_WORK(&dbs_work, do_dbs_timer, NULL);
 	schedule_delayed_work(&dbs_work,
-			sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));
+			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	return;
 }