Bug 9341

Summary: /proc/acpi/battery displays Incorrect voltages - Gateway 450ROG, MSI GX700
Product: ACPI Reporter: Sean Bridges (sean)
Component: ECAssignee: Alexey Starikovskiy (astarikovskiy)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: acpi-bugzilla, malashenko, yakui.zhao
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.23.1 Subsystem:
Regression: --- Bisected commit-id:
Attachments: acpidump output
MSI GX700 acpidump output
MSI GX700 dmesq output
Clear return value from space handler
patch #2
ec patch

Description Sean Bridges 2007-11-09 21:39:34 UTC
Most recent kernel where this bug did not occur: Not sure.  It might have been present in previous kernels, however after this latest kernel update I also have a hal issue where this bug causes a flood of BAT events to hald (which I think is another issue)...  Hoping that correcting this, will indirectly resolve the other. 

Distribution: Ubuntu Gutsy
Hardware Environment: Gateway 450ROG Laptop. PentM.

Problem Description:
ACPI is reporting some conflicting battery information.

  /proc/acpi/battery/BAT1/info:design voltage: 14800 mV
  /proc/acpi/battery/BAT1/state:present voltage: 44800 mV

The present voltage is being reported incorrectly. I have tried this with a different battery and also a second battery in the battery bay. All report higher than expected present voltage values which I beleive is causing the following event to occur.

This is causing hald to flood with.
[9229]: 13:27:37.905 [D] addon-acpi.c:142: battery event
13:27:37.918 [I] hald_dbus.c:2287: entering, local_interface=1
13:27:37.918 [D] hald_dbus.c:2296: udi=/org/freedesktop/Hal/devices/acpi_BAT1
13:27:37.921 [D] acpi.c:162: Current voltage is unknown, smaller than 501001765435r greater than design
[9229]: 13:27:37.927 [D] addon-acpi.c:113: event is 'battery BAT1 00000000 00000001

#:/proc/acpi/battery/BAT1$ grep . /proc/acpi/battery/BAT1/*
/proc/acpi/battery/BAT1/alarm:alarm: unsupported
/proc/acpi/battery/BAT1/info:present: yes
/proc/acpi/battery/BAT1/info:design capacity: 4000 mAh
/proc/acpi/battery/BAT1/info:last full capacity: 1864 mAh
/proc/acpi/battery/BAT1/info:battery technology: rechargeable
/proc/acpi/battery/BAT1/info:design voltage: 14800 mV
/proc/acpi/battery/BAT1/info:design capacity warning: 250 mAh
/proc/acpi/battery/BAT1/info:design capacity low: 100 mAh
/proc/acpi/battery/BAT1/info:capacity granularity 1: 10 mAh
/proc/acpi/battery/BAT1/info:capacity granularity 2: 25 mAh
/proc/acpi/battery/BAT1/info:model number: OAL4$
/proc/acpi/battery/BAT1/info:serial number:
/proc/acpi/battery/BAT1/info:battery type: LION
/proc/acpi/battery/BAT1/info:OEM info: SANYO
/proc/acpi/battery/BAT1/state:present: yes
/proc/acpi/battery/BAT1/state:capacity state: ok
/proc/acpi/battery/BAT1/state:charging state: charging
/proc/acpi/battery/BAT1/state:present rate: 2252 mA
/proc/acpi/battery/BAT1/state:remaining capacity: 754 mAh


Steps to reproduce:
 Happens everytime.  If I have a single battery installed, I only see the hald error messages come across 4 times, no major impact.  However, if I have two batteries installed the events stream in from each battery in succession.  Causes hald to consume 50% cpu responding to all the events.
Comment 1 Alexey Starikovskiy 2007-11-13 13:57:24 UTC
Please provide output from acpidump, available as part of pmtools package.
Comment 2 Sean Bridges 2007-11-13 17:18:49 UTC
Created attachment 13537 [details]
acpidump output
Comment 3 Sean Bridges 2007-11-13 17:20:46 UTC
Attached acpidump output. Thanks for looking at this request. I am available to provide any other input you need.  
Comment 4 malashenko 2007-12-27 12:44:59 UTC
I also experienced the problem. Battery status changes spontaneously. Here are 2 examples of cat /proc/acpi/battery/BAT1/* picked up during 1 minute:

cat /proc/acpi/battery/BAT1/*
present:                 no
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          38442 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          charged
present rate:            unknown
remaining capacity:      unknown
present voltage:         10000 mV

cat /proc/acpi/battery/BAT1/*
alarm:                   unsupported
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          38442 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            4137 mA
remaining capacity:      276 mAh
present voltage:         9798 mV
Comment 5 malashenko 2007-12-27 12:48:11 UTC
Created attachment 14208 [details]
MSI GX700 acpidump output

Here is my acpidump output
Comment 6 malashenko 2007-12-27 12:49:33 UTC
Created attachment 14209 [details]
MSI GX700 dmesq output
Comment 7 Alexey Starikovskiy 2007-12-27 14:45:24 UTC
Could you please check if with latest -rc kernel you see different picture?
Do you run with latest BIOS? 
Comment 8 malashenko 2007-12-27 15:31:27 UTC
I am running 2.6.24-rc6-git1 kernel with your patch from here: http://bugzilla.kernel.org/show_bug.cgi?id=9627. Without this patch there wasn't battery info at all.
At the moment I use the latest official BIOS for MSI GX700 laptop.
The problem appears more frequently when power consumption is bigger and changeable (for example kernel compiling).
The problem doesn't appear in vista under any loading.

Thank you!
Comment 9 malashenko 2008-01-07 15:58:17 UTC
The problem continuous with 2.6.24-rc6-git6 on MSI GX700. Here is the result of several consecutive cat /proc/acpi/battery/BAT1/*:
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:43:59
alarm:                   unsupported
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          22570 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          charging
present rate:            1526 mA
remaining capacity:      22022 mAh
present voltage:         50985 mV
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:44:01
alarm:                   unsupported
present:                 no
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            1526 mA
remaining capacity:      22022 mAh
present voltage:         50985 mV
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:44:02
present:                 no
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          22570 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          charging
present rate:            1526 mA
remaining capacity:      5126 mAh
present voltage:         50729 mV
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:44:04
alarm:                   unsupported
present:                 no
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            unknown
remaining capacity:      unknown
present voltage:         10000 mV
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:44:06
alarm:                   unsupported
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          22570 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            2527 mA
remaining capacity:      1731 mAh
present voltage:         10589 mV
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /proc/acpi/battery/BAT1/*
TIME:01:44:07
alarm:                   unsupported
present:                 yes
design capacity:         1297 mAh
last full capacity:      12304 mAh
battery technology:      rechargeable
design voltage:          22570 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            MS-1719

serial number:

battery type:            LION

OEM info:                MSI Corp.

present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            2519 mA
remaining capacity:      1730 mAh
present voltage:         10589 mV
Comment 10 Alexey Starikovskiy 2008-01-08 09:17:24 UTC
Created attachment 14364 [details]
Clear return value from space handler

Please check if this patch helps.
Comment 11 malashenko 2008-01-08 13:54:00 UTC
Unfortunately, this patch doesn't fix the problem. Please find the result of several consecutive cat /sys/class/power_supply/BAT1/* below. The AC adapter was disconnected all the time.
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:10
0
4184000
4400000
-1000
-1000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Full
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=10000000
POWER_SUPPLY_CURRENT_NOW=-1000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=-1000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
10000000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:12
0
4184000
4400000
13827000
1523000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Charging
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=38951000
POWER_SUPPLY_CURRENT_NOW=1523000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=13827000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
38951000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:13
0
4184000
4400000
64771000
1524000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Charging
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=38696000
POWER_SUPPLY_CURRENT_NOW=1524000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=64771000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
38696000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:15
0
4184000
4400000
-1000
-1000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Full
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=10000000
POWER_SUPPLY_CURRENT_NOW=-1000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=-1000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
10000000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:17
0
4184000
4400000
35843000
1525000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Charging
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=38184000
POWER_SUPPLY_CURRENT_NOW=1525000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=35843000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
38184000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:20
0
4184000
4400000
-1000
-1000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Full
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=10000000
POWER_SUPPLY_CURRENT_NOW=-1000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=-1000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
10000000
[root@repair-msi ~]# date '+TIME:%H:%M:%S'; cat /sys/class/power_supply/BAT1/*
TIME:23:39:22
0
4184000
4400000
18947000
1518000
cat: /sys/class/power_supply/BAT1/device: Is a directory
MSI Corp.

MS-1719

cat: /sys/class/power_supply/BAT1/power: Is a directory
1
Charging
cat: /sys/class/power_supply/BAT1/subsystem: Is a directory
Unknown
Battery
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=36903000
POWER_SUPPLY_CURRENT_NOW=1518000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4184000
POWER_SUPPLY_CHARGE_NOW=18947000
POWER_SUPPLY_MODEL_NAME=MS-1719
POWER_SUPPLY_MANUFACTURER=MSI Corp.
10800000
36903000

Sometimes  /sys/class/power_supply/BAT1 spontaneously disappears at all.
Comment 12 Alexey Starikovskiy 2008-01-08 15:50:19 UTC
Created attachment 14370 [details]
patch #2

Please check if this patch improves situation...
Comment 13 malashenko 2008-01-09 16:34:01 UTC
I applied the patch to 2.6.24-rc7. The behavior of power meter has changed. It was correct, but sometimes (several times per hour) the battery info disappeared:
cat /proc/acpi/battery/BAT1/*
present:                 no
present:                 no
present:                 no
In one or two minutes after disappearing, battery info appeared again and indicated correct values.
 
Comment 14 Alexey Starikovskiy 2008-01-09 17:27:30 UTC
Ok, with this patch we essentially revert patch from #4980... So, it will require long and careful testing. 
Comment 15 malashenko 2008-01-10 11:19:44 UTC
Here people discussing about the same problem: https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/147560
Comment 16 malashenko 2008-01-15 15:31:09 UTC
I am testing the patch from Comment#12 more than one week. Sometimes battery info randomly disappears in both /proc/acpi/battery/BAT1/* and /sys/class/power_supply/. It can return back spontaneously in 1-60 minutes.
But when the battery info exists it shows the correct values.
Comment 17 Alexey Starikovskiy 2008-01-15 15:58:49 UTC
Could you try to comment out acpi_ec_burst_disable()? 
Comment 18 malashenko 2008-01-18 14:24:37 UTC
I commented out acpi_ec_burst_disable() but unfortunately, there was no visible changes.
Comment 19 ykzhao 2008-02-04 18:21:35 UTC
Hi, Malashenko
    Will you please try the debug patch in comment #4 of bug 9823 and attach the output?
    Thanks.
    
Comment 20 Len Brown 2008-02-10 14:40:03 UTC
patch in comment #12 shipped in Linux-2.6.24-rc22 as two patches:

commit b3b233c7d948a5f55185fb5a1b248157b948a1e5
Author: Alexey Starikovskiy <astarikovskiy@suse.de>
Date:   Fri Jan 11 02:42:57 2008 +0300

    ACPI: EC: Some hardware requires burst mode to operate properly

    Burst mode temporary (50 ms) locks EC to do only transactions with
    driver, without it some hardware returns abstract garbage.
commit 3e71a87d03055de0b8c8e42aba758ee6494af083
Author: Alexey Starikovskiy <astarikovskiy@suse.de>
Date:   Fri Jan 11 02:42:51 2008 +0300

    ACPI: EC: Do the byte access with a fast path

    Specification allows only byte access for EC region, so
    make it separate from bug-compatible multi-byte access.
    Also do not allow return of garbage in supplied *value.

So it looks like battery information on these systems is now
correct when available, but its availability is intermitant.
So we'll keep the report open to address that issue.
Comment 21 malashenko 2008-07-06 08:10:48 UTC
Hi!
It looks like the hint from here:
http://ubuntuforums.org/showpost.php?p=4843977&postcount=143 fixes the problem. After the changes the battery info is now stable on my MSI GX700.
Comment 22 Alexey Starikovskiy 2008-07-06 09:58:20 UTC
Could you show the resulting patch? I'm lost in their "remove this code ... add this code..."...
Comment 23 malashenko 2008-07-06 10:16:13 UTC
Created attachment 16748 [details]
ec patch

I applied the patch. Maybe there is something wrong but it works.
Comment 24 ykzhao 2008-08-11 23:35:20 UTC
Can someone try the three debug patches in 
http://bugzilla.kernel.org/show_bug.cgi?id=11141#c11,14,16 
and see whether the problem still exists?
After the test, please attach the output of dmesg, cat /proc/acpi/battery/BAT1/*.

Thanks.
Comment 25 ykzhao 2008-08-13 22:51:44 UTC
One laptop in this bug is also MSI GX700, which is the same as that in bug 9823.
IMO this bug can also be closed or marked as the duplicated bug of bug 9823 as the bug 9823 can be fixed by the debug patch in
http://bugzilla.kernel.org/show_bug.cgi?id=9823#c53.

Of course it will be better if someone can try the debug patch mentioned in comment #24.

Thanks.
Comment 26 Shaohua 2008-09-23 22:35:33 UTC
yakui, can we mark this closed?
Comment 27 ykzhao 2008-09-23 22:47:08 UTC
The laptop of bug reporter is the same as that in bug 9823.
As the bug 9823 can be fixed by the patch in http://bugzilla.kernel.org/show_bug.cgi?id=9823#c53, IMO this bug can be closed.
Thanks.