iMac G5 frequency switching

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Sep 11 07:58:18 EST 2005


On Fri, 2005-09-09 at 13:43 +0200, Markus Demleitner wrote:
> Hi,
> 
> I've figured out how to switch frequencies of the iMac G5 CPU (at
> least for my 1600 MHz models) and at that opportunity found that OF
> puts the machine into half speed on boot, and that's what Linux got,
> then.  

Hehe, I'm not surprised :) Good job.

> This is bad news for the solution of the riddle how Apple keeps the
> fans that quiet while I need to run them, since clearly it's not
> because they run the machine at half speed most of the time.  Running
> the machine at full speed under Linux has the fans roaring even on an
> idle machine, at least when you've got about 30 degrees outside
> temperature.  OS X keeps the thing quiet, even though not drawing
> considerably less power.
> 
> I've written the cpufreq driver as an external module for now, since
> there's no "platforms" subdir in arch/ppc64 yet (which is where the
> pmac_cpufreq driver resides in ppc).  Here's the code:

Why would you _need_ a platform subdir ? just add a pmac_cpufreq in
arch/ppc64/kernel for now...

> http://tucana.cl.uni-heidelberg.de/imacg5/g5-cpufreq-0.01.tar.gz
> 
> I don't do any voltage stuff myself, mainly because OF doesn't
> either.  If anyone knows if I should, please let me know.

OF does set voltage no ? You definitely should as this is where you save
the most power. It can be done by getting the target voltage for the
requested frequency divisor from the SMU partition data in the
device-tree and calling the appropriate SMU function iirc (I don't have
this in mind, but I figured it out a while ago, it  wasn't too hard).

> Apart from the functions that actually do the switch this is
> completely untested, because compiling cpufreq itself into the kernel
> (I've simply hacked arch/ppc64/Kconfig to source the Kconfig) yields
> a kernel that locks up.  I figure I could spend weeks trying to find
> out why, so here's my plea to the ppc64 gods: Could anyone have a
> look at why cpufreq without any cpu drivers loaded would lock the
> machine at boot time?

Hrm...

> Two somewhat related notes:
> 
> (a) I've set up a page with hints on running linux on the iMac G5.
> If this is a duplicate effort, let me know and I'll pull the page.
> 
> (b) On that page, I link to benh's first SMU patch as the one to
> apply (from
> http://ozlabs.org/pipermail/linuxppc64-dev/2005-April/003835.html).
> In the meantime, benh has put out a newer SMU patch -- however, that
> one won't compile with vanilla 2.6.13 (it's lacking struct of_match,
> OF_ANY_MATCH and some others, and I gave up on it after fiddling for
> a while), whereas the one I used does.  That's an excuse to benh for
> having ignored the second patch.

Heheh, ok, I'll check that out. I'll be away for about a week though.
I'll see if I find time to send a fixed up patch today. If not, it will
have to wait.

> And then a last question:
> 
> The nap/doze stuff the G5 can do sounds nifty and might be part of
> the explanation for the thermal trouble.  It's G5 generic and thus
> I'm wondering if anyone has given putting it into Linux any thought
> already.

Unless we missed something, the kernel should NAP when idle already on
the G5. __setup_cpu_ppc970() will set the NAP HID bit and native_idle
will be used which triggers MSR:POW.

Another thing OS X does btw is, afaik, slow down the video chip...

Ben.





More information about the Linuxppc64-dev mailing list