From: heeb@iis.ethz.ch (Hansruedi Heeb)
Subject: Laptop Power Management - a Start (Western Digital chips only)
Originator: mdw@theory.TC.Cornell.EDU
Keywords: Linux, laptop, power management, Western Digital
Organization: Integrated Systems Lab, ETH Zurich, Switzerland
Date: Fri, 29 Jan 1993 04:28:17 GMT

Laptop Power Management - a Start (Western Digital 7600 chips only)
-------------------------------------------------------------------

This is far from being finished. But since I have no time to
work on it for the next few weeks I uploaded it now.

Currently all 'pwrm' does is to set the time-outs for the
LCD and the backlighting. And it does an installation check
for the WD7600 chipset and returns its status.
Time-out settings include permanently on and permanently off.

This was tested on SLS 0.98 pl 1 (Nov 12). But it should be
pretty independent of the kernel version.

Uploaded to sunsite.unc.edu:/pub/Linux/Incoming and tsx-11.mit.edu:/incoming

Notes
-----

- UNLESS YOU HAVE A WD7600 CHIPSET THIS IS USELESS FOR YOU!!
  Power management is sufficiently different between chipsets
  that this code is of no use whatsoever on anything but the WD7600.
  If you have code for another chipset (like APM) I would like
  to build it into 'pwrm'. It is probably better to have a
  single Linux laptop power manager than one for each architecture.

- If you do not know what chipset you have:
  * Watch the messages when you boot MessyDOS, you may get a message
    like "Western Digital power manager installed"
  * Just run 'pwrm'. The installation check is reliable and safe (see below).
  * I would like to compile a list of laptops that have the WD7600.
    If you have such a machine drop me a line!
    I have a CompuAdd Express 425CXL.

- This is potentially dangerous code because it does an 'iopl(3)'
  which unlockes all I/O ports (IT ONLY RUNS AS ROOT of course).
  However the installation check consists of two simple reads
  (no writes) and should therefore be safe on any machine.
  If the installation check fails, 'pwrm' exits.

Installation
------------

Type 'make'.

'su' to root!

'pwrm -u' will give you the command line options.

To Do List
----------

Volunteers ? Send me mail if you want to try one of them!

- Add harddisk time-out. This can hopefully be done by calling
  the kernel somehow, I have not checked yet. There seem to be
  no provisions in the WD7600 for that (they use BIOS I think).

- Sleep mode (stopping the processor clock): If your processor
  can handle this then it is a huge power saver (see below)
  This is so fast that it should go into the idle process
  (and the wake-up should go into the interrupt rotines).

- User initiated switching of the clock speed. My chipset
  can handle 6 MHz, 12 MHz and 25 MHz.

- Suspend mode (powering down the whole machine except one
  of the WD7600 chips): The toughest. Lots of stuff has to
  be saved, lots of things have to switched (clock speeds,
  clock sources ...). Probably quite a challenge.

- Getting a remaining battery estimation: The WD7600 has no
  provision for that. So this must be calculated from the
  time each part of the system is up.

Current measurements on the CompuAdd 425 CXL
--------------------------------------------

The surprise is that the largest power savings (after
suspend mode) is not the harddisk nor the backlighting but sleep mode!
Most numbers are quite approximate.

Base current: 700 to 780 mA
(Linux or DOS with sleep mode disabled, HD running, LCD, backl. on)

Differences:

Sleep mode enabled, idle DOS: -200 to -280 mA (!!)
Sleep mode anabled, active  : -100 to -180 mA
Backlighting off            :         -110 mA
Harddisk off                :  -40 to  -80 mA (!!)
LCD off                     :          -20 mA
Clock at 12 MHz (no sleep)  :  -60 to  -80 mA
Clock at  6 MHz (no sleep)  : -110 to -130 mA

Harddisk startup            :         +300 mA (for 1 to 2 sec)
Floppy                      :         +200 mA
COM chip on                 :          +10 mA

Suspend mode draws about 100 mA only!

Questions to the DOS/Linux gurus
--------------------------------

- Send me mail if you know how to switch on/off the hard-disk
  through system calls. That would save me some digging in
  the kernel sources.

- The MessyDos driver does lots of OUTs to port ED(hex).
  Anybody knows what that does ??

Other Info
----------

Western Digital's tech info phone number is (714) 932 4900
The manual I used is called 'WD7600 Chip Set - Programmer's Guide'

Enjoy,

Hansruedi Heeb - heeb@iis.ethz.ch

-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
Newsgroups: comp.os.linux.announce