Bug 9627

Summary: Regression: Battery method parse error
Product: ACPI Reporter: Bruce Duncan (bwduncan)
Component: ECAssignee: Alexey Starikovskiy (astarikovskiy)
Status: CLOSED CODE_FIX    
Severity: normal CC: acpi-bugzilla, makalsky, malashenko, msnkipa, nagyt
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.24-rc6 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 9243    
Attachments: dmesg output with battery brokenness
dmesg output fixed by reverting patch
acpidump output
Enable EC region handlers before bus_scan
Enable EC region handlers before bus_scan #2
try the debug patch to see whether the system will be affected by this patch

Description Bruce Duncan 2007-12-23 13:00:17 UTC
Most recent kernel where this bug did not occur: 2.6.24-rc2
Distribution: Debian unstable
Hardware Environment: ULI Laptop

Hi all,

I noticed that my battery meter stopped working somewhere in the 2.6.24-rc series, so I did a bisect and found this:

commit 5870a8cd23181703cc76f88f630372f8602c7648
Author: Alexey Starikovskiy <astarikovskiy@suse.de>
Date:   Thu Nov 15 21:52:47 2007 +0300

    ACPI: EC: Don't init EC early if it has no _INI

    Option to init EC early inserted to handle #8598 ASUS problem,
    introduced several others.

    EC driver in this particular case has fake _INI method, not present on
    other machines, which don't need or break from this workaround, so lets use
    its presence as a flag for early init.

    http://bugzilla.kernel.org/show_bug.cgi?id=9262
    http://bugzilla.kernel.org/show_bug.cgi?id=8598
    https://bugzilla.novell.com/show_bug.cgi?id=334806

    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
    Signed-off-by: Len Brown <len.brown@intel.com>

Reverting this patch does indeed fix the problem with 2.6.24-rc6. I'll attach dmesg with and without patch, along with an acpidump.

Regards,
Bruce
Comment 1 Bruce Duncan 2007-12-23 13:02:18 UTC
Created attachment 14158 [details]
dmesg output with battery brokenness
Comment 2 Bruce Duncan 2007-12-23 13:02:49 UTC
Created attachment 14159 [details]
dmesg output fixed by reverting patch
Comment 3 Bruce Duncan 2007-12-23 13:03:38 UTC
Created attachment 14160 [details]
acpidump output
Comment 4 Anonymous Emailer 2007-12-23 13:07:33 UTC
Reply-To: akpm@linux-foundation.org

On Sun, 23 Dec 2007 13:00:19 -0800 (PST) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=9627

Looks like another regression to track, please.
Comment 5 Alexey Starikovskiy 2007-12-24 08:10:28 UTC
Created attachment 14170 [details]
Enable EC region handlers before bus_scan

Please check if this patch helps.
Comment 6 Bruce Duncan 2007-12-25 05:52:51 UTC
Sorry, no. I get the same error, with subtly different addresses.

bruce@moon:~/build/linux$ cut -f6- -d' ' /home/bruce/dmesg.bat| diff - /var/log/dmesg
> APIC error on CPU0: 40(40)
88c87
< APIC timer calibration result 12500398
---
> APIC timer calibration result 12500441
98c97
< ACPI Error (evregion-0316): No handler for Region [RAM_] (ffff810037804a40) [EmbeddedControl] [20070126]
---
> ACPI Error (evregion-0316): No handler for Region [RAM_] (ffff81003781aa40)
> [EmbeddedControl] [20070126]
100c99
< ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.BAT0._STA] (Node ffff810037805180), AE_NOT_EXIST
---
> ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.BAT0._STA]
> (Node ffff810037819180), AE_NOT_EXIST

Bruce
Comment 7 Alexey Starikovskiy 2007-12-25 07:47:57 UTC
Could you please add some printk into acpi_boot_ec_enable() in ec.c?
Please check if it is executed _before_ your failing call to _STA.
Comment 8 Alexey Starikovskiy 2007-12-25 08:00:48 UTC
Created attachment 14181 [details]
Enable EC region handlers before bus_scan #2

Please check this updated patch.
Comment 9 malashenko 2007-12-25 14:44:01 UTC
After applying this patch to 2.6.24-rc6-git1 the battery meter has started to work in my MSI-GX700 laptop.
Thank you very much!
Comment 10 malashenko 2007-12-25 14:55:05 UTC
But unfortunately it doesn't show the correct remaining time (the same as it was before 2.6.24-rc4):
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
Comment 11 Alexey Starikovskiy 2007-12-25 14:58:49 UTC
Please open separate bug for this issue. Marking this bug as resolved.
Thanks for report and testing.
Comment 12 Bruce Duncan 2007-12-25 15:39:25 UTC
Wonderful. Yes I can also report that this patch resolves the bug. Thanks very much!

Merry Christmas,
Bruce
Comment 13 Len Brown 2008-01-01 11:13:47 UTC
patch in comment #8 applied to acpi test branch
Comment 14 Alexey Starikovskiy 2008-01-07 08:50:24 UTC
*** Bug 9697 has been marked as a duplicate of this bug. ***
Comment 15 Mark 2008-01-07 12:52:35 UTC
I confirm that the patch does resolves the issue, and in my case the battery status show also correct discharge rate and remaining time. 
Comment 16 Alexey Starikovskiy 2008-01-11 14:28:18 UTC
*** Bug 9724 has been marked as a duplicate of this bug. ***
Comment 17 Alexey Starikovskiy 2008-01-11 14:29:01 UTC
*** Bug 9663 has been marked as a duplicate of this bug. ***
Comment 18 Len Brown 2008-01-13 23:09:18 UTC
patch in comment #8
shipped in linux-2.6.24-rc7-git5

closed.
Comment 19 ykzhao 2008-01-21 18:01:05 UTC
*** Bug 9730 has been marked as a duplicate of this bug. ***
Comment 20 ykzhao 2008-08-28 01:59:24 UTC
Created attachment 17497 [details]
try the debug patch to see whether the system will be affected by this patch

Hi, Mark && Bruce
    Will you please try the debug patch and see whether the system will be affected by this patch?
    Thanks.
Comment 21 Mark 2008-08-28 02:29:55 UTC
ykzhao:
Which kernel version would you like me to try this patch on?
Comment 22 ykzhao 2008-08-28 03:00:08 UTC
Had better try the latest kernel. For example: 2.6.27-rc4(Of course 2.6.27-rc1/2/3 is also OK).
Comment 23 Mark 2008-10-29 15:36:41 UTC
ykzhao:
sorry I've missed the opportunity to test this patch.
However there is a new and possibly related bug, that I have submitted here: http://bugzilla.kernel.org/show_bug.cgi?id=11892

If you think your patch is still relevant I can try to apply it.

Thanks a lot.