aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 8ea34e951ea3..8b5ad308d656 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -318,31 +318,19 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
318 318
319#define ROUNDING 0xf 319#define ROUNDING 0xf
320 320
321static int _guess(int guess, int mult)
322{
323 int target;
324
325 target = ((mult/10)*guess);
326 if (mult%10 != 0)
327 target += (guess/2);
328 target += ROUNDING/2;
329 target &= ~ROUNDING;
330 return target;
331}
332
333
334static int guess_fsb(int mult) 321static int guess_fsb(int mult)
335{ 322{
336 int speed = (cpu_khz/1000); 323 int speed = cpu_khz / 1000;
337 int i; 324 int i;
338 int speeds[] = { 66, 100, 133, 200 }; 325 int speeds[] = { 666, 1000, 1333, 2000 };
339 326 int f_max, f_min;
340 speed += ROUNDING/2; 327
341 speed &= ~ROUNDING; 328 for (i = 0; i < 4; i++) {
342 329 f_max = ((speeds[i] * mult) + 50) / 100;
343 for (i=0; i<4; i++) { 330 f_max += (ROUNDING / 2);
344 if (_guess(speeds[i], mult) == speed) 331 f_min = f_max - ROUNDING;
345 return speeds[i]; 332 if ((speed <= f_max) && (speed >= f_min))
333 return speeds[i] / 10;
346 } 334 }
347 return 0; 335 return 0;
348} 336}