Battery

Differences between revisions 1 and 2
Revision 1 as of 2010-12-14 16:27:41
Size: 4138
Editor: cpc7-craw6-2-0-cust128
Comment:
Revision 2 as of 2010-12-14 16:36:58
Size: 4063
Editor: cpc7-craw6-2-0-cust128
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#title Platform Services Hardware Enablement Team Powermanagement S4 info

ACPI Battery Methods

Batteries and ACPI are tied together in quite a complex way. Generally, the battery state information is transmitted over an i2c bus to the embedded controller 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.

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

If one is seeing a machine shutdown because of low battery reports then check that _BIF or _BIX return sane values. Maybe the warning or capacity low values are incorrect. If they are, this needs to be fixed in the packages that the _BIF (or _BIX) methods return.

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 123-204-163-241)