Differences between revisions 3 and 4
Revision 3 as of 2011-09-05 03:49:28
Size: 4597
Editor: alexhung
Revision 4 as of 2011-09-05 07:58:58
Size: 4596
Editor: alexhung
Deletions are marked like this. Additions are marked like this.
Line 48: Line 48:
that _BIF or _BIX return sane values. It is likely that the design capacity of low is too low. If they are, this needs to be fixed
in the packages that the _BIF (or _BIX) method returns.
that _BIF or _BIX return sane values. It is probable that the design capacity of low is too high. If it is, this needs to be fixed in the packages that the _BIF (or _BIX) method returns.

ACPI Battery Methods

(Control Method) Batteries and ACPI are tied together in quite a complex way. Generally, the battery state information is transmitted over a SMBUS bus to the embedded controller, a.k.a. EC, which in turn interfaces to the OS via ACPI methods. These methods can interrogate the embedded controller for battery state information and the embedded controller is able to generate a SCI when state changes.

i.e. Battery <-- EC <--> BIOS ACPI Methods <--> OS

  • EC reads battery information and status from a battery.
  • EC generates a SCI to BIOS/OS.
  • OS reads via ACPI methods, which query data from EC.

For reference, Section 10 of version 4.0a of the ACPI specification describes in detail the Smart Battery operation.

Static Information: _BIF and _BIX

The ACPI _BIF or _BIX ACPI methods returns to the OS the static (non-changing) information about the battery, such as model number, serial number, design volatage, capacity warning level, capacity low level, etc. This appears in the information presented in /proc/acpi/battery/*/info, e.g. on my machine:

cat /proc/acpi/battery/BAT1/info 
present:                 yes
design capacity:         5100 mAh
last full capacity:      5100 mAh
battery technology:      rechargeable
design voltage:          11100 mV
design capacity warning: 420 mAh
design capacity low:     156 mAh
cycle count:              0
capacity granularity 1:  264 mAh
capacity granularity 2:  3780 mAh
model number:            PA3465U 
serial number:           3658Q
battery type:            Li-Ion
OEM info:                COMPAL

Design capacity of warning refers to a trip point that users should be notified that a battery is soon running out; design capacity of low refers a trip point that a battery is almost drained, and certain actions may be taken, ex. a system will enter S4 state soon to avoid data loss.

If one is seeing a machine shutdown because of low battery reports then check that _BIF or _BIX return sane values. It is probable that the design capacity of low is too high. If it is, this needs to be fixed in the packages that the _BIF (or _BIX) method returns.

The firmware test suite in Natty can be used to extract the _BIF or _BIX values by running the following command:

sudo fwts method - > methods.log

and then look for the _BIF or _BIX test results, e.g.:

00047 method          Test 12 of 69: Check _BIF (Battery Information).
00048 method            Package has 13 elements:
00049 method              00: INTEGER: 0x00000001
00050 method              01: INTEGER: 0x00000fa0
00051 method              02: INTEGER: 0x00000fa0
00052 method              03: INTEGER: 0x00000001
00053 method              04: INTEGER: 0x00002b5c
00054 method              05: INTEGER: 0x000001a4
00055 method              06: INTEGER: 0x0000009c
00056 method              07: INTEGER: 0x00000108
00057 method              08: INTEGER: 0x00000ec4
00058 method              09: STRING:  0xPA3465U 
00059 method              10: STRING:  0x3658Q
00060 method              11: STRING:  0xLi-Ion
00061 method              12: STRING:  0xCOMPAL 

Element 05 in the package contains the "design capacity warning" level and element 06 contains the "design capacity low" level, so check these.

Dynamic Information

The ACPI _BST Method returns the present battery status. Whenever the status changes, a SCI interrupt is generated and the OS is notified. Then the OS (kernel) can evaluate the _BST method and it get the current battery state.

This information is available in /proc/acpi/battery/*/state, on my machine:

cat /proc/acpi/battery/BAT1/state 
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            0 mA
remaining capacity:      5100 mAh
present voltage:         11100 mV

These information should change whenever a battery is being charged or discharged. Everytime it changes one should see a SCI interrupt occur by looking to see if the SCI count increases in /sys/firmware/acpi/interrupts/sci

The firmware test suite contains a test to check for battery charging state and events, use it as follows:

sudo fwts battery - > battery.log

and see what the battery.log says when the tests are complete.

Kernel/Reference/Battery (last edited 2011-09-05 16:35:46 by alexhung)