Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91350ed4 authored by Dave Jones's avatar Dave Jones
Browse files

[CPUFREQ] Recalibrate cpu_khz [1/2]



We have to recalibrate cpu_khz in order to use the current FID instead the max
FID since some BIOS do not put the processor at maximum frequency at POST. 
Also, some BIOS will change the processor frequency at our back after cpu_khz
was calibrate.  Finally, this will fix a long standing bug when we do
something like this:

# rmmod powernow-k7
# modprobe powernow-k7

Signed-off-by: default avatarBruno Ducrot <ducrot@poupinou.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent bf6fc9fd
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/dmi.h>

#include <asm/msr.h>
#include <asm/timer.h>
#include <asm/timex.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -586,8 +587,12 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)

	rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);

	/* A K7 with powernow technology is set to max frequency by BIOS */
	fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.MFID];
	/* recalibrate cpu_khz */
	result = recalibrate_cpu_khz();
	if (result)
		return result;

	fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID];
	if (!fsb) {
		printk(KERN_WARNING PFX "can not determine bus frequency\n");
		return -EINVAL;