Powerd comments

Richard A. Smith richard at laptop.org
Tue Mar 16 19:04:57 EDT 2010


On 03/16/2010 04:33 PM, Paul Fox wrote:

> the wakeup events currently available are the "SOC"
> (state-of-charge) event, which is emitted every time the battery
> capacity changes by 1%, and the "critical" event, which is
> emitted when the battery is critically low.
>
> if the battery has less than 20% capacity left when the system is
> put to sleep, powerd will enable the SOC event to wakeup and check the
> battery condition periodically in order to shutdown properly.  on
> XO-1.5 we may also be able to use the "critical" event -- on XO-1 that
> event only comes when the battery is too weak to actually run the
> system -- responding to it causes an immediate crash.

This perhaps could be made better in new firmware for the XO1 if we 
really needed it.  The problem is that "critical" was empirically set 
based on  some discharge logs I have.  Those logs were taken while the 
system was running with cpu idle.  So there's a >4W load on the battery. 
  In suspend the load on the battery is much less.  This means that the 
critical voltage is much different.  Unfortunately, its different in the 
wrong direction.  Less load means higher critical voltage.  So by the 
time you reach critical in suspend you can't maintain enough voltage to 
run the CPU load.

The critical indicator was added for the cases where the SOC is 
incorrect.  That way you get some indication of impending doom rather 
than just have the laptop abruptly shut off.

One possibility is 2 different critical levels.  One while in suspend 
and one while idle.

>   >  Since we have power consumption controlled in sleep it should be easy
>   >  to estimate how long we can keep the computer in suspend at the
>   >  battery level immediately before sleep. Wake a little short of this
>   >  time and poll the battery and see if we need to shutdown, if not
>   >  snooze until shortly before we think the battery will run out. Its all
>   >  there in powerd already except shutdown time should be determined by a
>   >  function to estimate how long the battery will last in sleep instead
>   >  of reading from the config file.
>
> yes, i'm sure we can do better than we're doing now.

In theory it seems easy.  In practice its a bit more difficult.  If it 
were that easy, I'd do it in the EC and it would always be correct. :)

The big problem is that SOC is a % of full available capacity and FAC 
changes from around 2600mAh to 3100mAh depending on the battery. 
Without knowing your FAC pretty close you can't make an accurate 
estimate of how much longer you are going to last.  You can only guess a 
range.  If your range guess is too short then you don't make it and if 
its too long then it gets ignored or disabled cause its not accurate 
enough.

When the battery voltage starts to droop the system will draw around 
900mA to 1A.  If you set critical reserve capacity to be 500mAh 
(3100-2600) then that's somewhere between 0 and 33 minutes of runtime 
you lose.

FAC also reduces with each cycle.  Based on our mfg rated numbers its 
.025% per cycle.  So after some x amount of cycles you have to run a 
calibration to update your FAC.

-- 
Richard A. Smith  <richard at laptop.org>
One Laptop per Child



More information about the Devel mailing list