Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Nov 2004 11:57:33 +0100
From:      Bruno Ducrot <ducrot@poupinou.org>
To:        plasma <plasma@ms9.hinet.net>
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: [speedstep] Testers wanted
Message-ID:  <20041124105733.GB5749@poupinou.org>
In-Reply-To: <20041123121651.GA871@plasmanb.plasma.idv.tw>
References:  <20041122100701.GE33509@bombur.guldan.demon.nl> <20041122121210.GA857@plasmanb.plasma.idv.tw> <20041122122827.GH33509@bombur.guldan.demon.nl> <20041122144407.GA821@plasmanb.plasma.idv.tw> <20041122184414.GL33509@bombur.guldan.demon.nl> <20041123065935.GB20758@plasmanb.plasma.idv.tw> <20041123093420.GB4353@poupinou.org> <20041123100834.GA72233@plasmanb.plasma.idv.tw> <20041123102712.GD4353@poupinou.org> <20041123121651.GA871@plasmanb.plasma.idv.tw>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 23, 2004 at 08:16:51PM +0800, plasma wrote:
> On Tue, Nov 23, 2004 at 11:27:12AM +0100, Bruno Ducrot wrote:
> > There are some API in kernel in order to detect power profile changes
> > (performance vs economy).  When Nate will polish his cpufreq, this will
> > be done in a generic way.  But in the meantime, it may be helpfull to
> > implement that in ichist so that we don't have to care about AC changes
> > via acpi or apm.
> 
> This sounds good!  Should I just poll a sysctl variable periodically,
> or ...?
> 

It's finishedi but not tested (I don't have the hardware to play with).

http://www.poupinou.org/cpufreq/bsd/
the tar ball is
ichist.ugly_for_use_with_ichctrl.tar.gz

There will be 3 new sysctl under dev.ichist.0, namely:
profile: read only
ac_profile:  read write
batt_profile: read write

The values are the same as for ichctrl, that is:
0: min
1: adaptative
2: max

for example, if 'ac_profile' is 2, at each time the kernel
detect a power profile change (most time AC plug-in), then
'profile' will be updated to 2, and the processor will be put
at the max frequency.

For ichctrl, the only required stuff maybe is to modify the frequency
only if 'profile' is set to 1.  So the main loop should be something
like this:

	for(;;) {
		sleep (...);
		if (get_profile() != 1)
			continue;
		...
		...
	}


PS1: my laptop (AMD athlon-xp) do not detect correctly the AC adapter
with ACPI under FreeBSD 5.3, but I'm pretty sure it worked before.
I don't know why exactly.  Also be sure to boot with '-v' so that
you will see something like:
system power profile changed to 'economy'
system power profile changed to 'performance'
in dmesg.  If that not the case, then something is wrong with ACPI or
APM.

PS2: as the cpufreq interface from Nate will handle this more
cleanly and should be independant of hardware hopefully, I have
put this one as a different tar ball.

-- 
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041124105733.GB5749>