2003-05-22 03:15:10

by Disconnect

[permalink] [raw]
Subject: [PATCH][2.4][CPUFREQ] Allow user to force speedstep speed

As the comment says, IANAKG so this may be way wrong. "It works for
me"..

Basically it adds "speedstep_default" as a module param (untested!) and
as a boot-time option to allow forcing of cpufreq default policy. (It is
only implemented for speedstep, but should be easily ported to others;
if it doesn't have any other glaring flaws I may do so unless someone
beats me to it.)

My laptop (Dell Inspiron) gives no bios option to force cpufreq speed -
it is either completely disabled or based on the AC status at boot. (It
also has ACPI instead of APM, so swsusp is my friend..) The problem is
that if you suspend in performance mode and then boot without AC, the
bios forces it to powersave mode and things get weird - /proc/cpufreq
indicates powersave, but /proc/cpuinfo shows the performance speed (and
bogomips). At one point while testing that I found that my 2g p4m was
reporting at around 3.8g (wow!), I suspect due to suspending in
powersave (1.2g) and restoring in performance.

This patch (plus a small addition to the pre/post suspend scripts in
swsusp) allows you to set the cpu to a known value on suspend and then
restore that on resume, before the swsusp handler kicks in. (For module
users it won't help, but they may want to force policy at modprobe and
the change was minimal to allow that.) I've run through a few
boot/suspend/resume cycles here without managing to confuse it, and the
(AFAICT) worst side-effect is either jumping to performance mode on
batteries or booting/resuming in powersave mode while on AC, depending
on your choice of 'known state'.

These patches are against 2.4.21-rc2 and "speedstep.c,v 1.68 2003/01/20
17:31:47" (the cpufreq patch is actually from -ck5, cleaned up for
mostly-bare 2.4.21-rc2, as I can't find a valid repository for cpufreq
other than the cvs snapshots.)

Params.diff is to Documentation/kernel-parameters (adds 'CPUFREQ' as a
depends-on [] flag and information about speedstep_default) and
speedstep.diff is for arch/i386/kernel/speedstep.c

Comments encouraged, I'm on the list.

--
Disconnect <[email protected]>


Attachments:
params.diff (848.00 B)
speedstep.diff (2.57 kB)
Download all attachments