]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[CPUFREQ] Recalibrate cpu_khz [2/2]
authorDave Jones <davej@redhat.com>
Wed, 1 Jun 2005 02:03:46 +0000 (19:03 -0700)
committerDave Jones <davej@redhat.com>
Wed, 1 Jun 2005 02:03:46 +0000 (19:03 -0700)
Some cpufreq drivers (at that time, only powernow-k7) need to recalibrate the
cpu_khz at runtime.

Signed-off-by: Bruno Ducrot <ducrot@poupinou.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Jones <davej@redhat.com>
arch/i386/kernel/timers/common.c
arch/i386/kernel/timers/timer_tsc.c
include/asm-i386/timer.h

index f7f90005e22e352ffedf7a19347ae0da92fe728b..8e201219f5253f53a84d1254b922ab7a7ff1a519 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/timex.h>
 #include <linux/errno.h>
 #include <linux/jiffies.h>
+#include <linux/module.h>
 
 #include <asm/io.h>
 #include <asm/timer.h>
@@ -24,7 +25,7 @@
 
 #define CALIBRATE_TIME (5 * 1000020/HZ)
 
-unsigned long __init calibrate_tsc(void)
+unsigned long calibrate_tsc(void)
 {
        mach_prepare_counter();
 
@@ -139,7 +140,7 @@ bad_calibration:
 #endif
 
 /* calculate cpu_khz */
-void __init init_cpu_khz(void)
+void init_cpu_khz(void)
 {
        if (cpu_has_tsc) {
                unsigned long tsc_quotient = calibrate_tsc();
@@ -158,3 +159,4 @@ void __init init_cpu_khz(void)
                }
        }
 }
+
index 7926d967be00ddf89718a4c43c4e866b17f09cfc..180444d87824e4299979a68b8f726da94ec50725 100644 (file)
@@ -320,6 +320,26 @@ core_initcall(cpufreq_tsc);
 static inline void cpufreq_delayed_get(void) { return; }
 #endif 
 
+int recalibrate_cpu_khz(void)
+{
+#ifndef CONFIG_SMP
+       unsigned long cpu_khz_old = cpu_khz;
+
+       if (cpu_has_tsc) {
+               init_cpu_khz();
+               cpu_data[0].loops_per_jiffy =
+                   cpufreq_scale(cpu_data[0].loops_per_jiffy,
+                                 cpu_khz_old,
+                                 cpu_khz);
+               return 0;
+       } else
+               return -ENODEV;
+#else
+       return -ENODEV;
+#endif
+}
+EXPORT_SYMBOL(recalibrate_cpu_khz);
+
 static void mark_offset_tsc(void)
 {
        unsigned long lost,delay;
index 40c54f69780e66ccd417f736816736a56851dce4..c347098498397e67c1bf66453806ef3f7c811037 100644 (file)
@@ -53,6 +53,7 @@ extern struct init_timer_opts timer_cyclone_init;
 
 extern unsigned long calibrate_tsc(void);
 extern void init_cpu_khz(void);
+extern int recalibrate_cpu_khz(void);
 #ifdef CONFIG_HPET_TIMER
 extern struct init_timer_opts timer_hpet_init;
 extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr);