Bug 13687 - [PATCH] Work around negative s16 battery current on Acer
Summary: [PATCH] Work around negative s16 battery current on Acer
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Battery (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: acpi_power-battery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-01 18:06 UTC by Hector Martin
Modified: 2009-11-25 03:03 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.29
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Add battery quirk to interpret current as s16 (1.40 KB, patch)
2009-07-01 18:06 UTC, Hector Martin
Details | Diff
Add battery quirk to interpret current as s16 (1.45 KB, patch)
2009-07-01 18:11 UTC, Hector Martin
Details | Diff

Description Hector Martin 2009-07-01 18:06:19 UTC
Created attachment 22169 [details]
Add battery quirk to interpret current as s16

My Acer Aspire 8930G laptop reports the battery current as a 16-bit signed negative when it is charging. It also reports it as 0x10000 when the current is 0. This patch adds a quirk for this which takes the absolute value of the reported current cast to an s16. This is a DSDT bug present in the latest BIOS revision (the EC register is 16 bits signed and the DSDT attempts to take the 16-bit two's complement of this, which works for discharge but not charge. It also breaks zero values because a 32-bit register is used and the high bits aren't thrown away).

I've enabled this for all Acer systems which report in mA units. This should be safe since it won't break compliant systems unless they report a current above 32A, which is insane.
Comment 1 Hector Martin 2009-07-01 18:11:33 UTC
Created attachment 22170 [details]
Add battery quirk to interpret current as s16

Add missing Signed-off-by.
Comment 2 Andrew Morton 2009-07-01 18:13:14 UTC
erk, please don't send patches via bugzilla.

Please email the patch as per Documentation/SubmittingPatches to

Alexey Starikovskiy <astarikovskiy@suse.de>
Len Brown <lenb@kernel.org>
linux-acpi@vger.kernel.org
Andrew Morton <akpm@linux-foundation.org>

Thanks.
Comment 3 Hector Martin 2009-07-01 18:19:33 UTC
My apologies. I had read the following page where it is mentioned that bugzilla is an option for submitting patches.

http://www.lesswatts.org/projects/acpi/submitting-patches.php

E-mail sent.
Comment 4 Zhang Rui 2009-07-02 01:18:28 UTC
Patch has been sent to acpi mail list
Comment 5 Len Brown 2009-08-30 02:23:00 UTC
commit bc76f90b8a5cf4aceedf210d08d5e8292f820cec
Author: Hector Martin <hector@marcansoft.com>
Date:   Thu Aug 6 15:57:48 2009 -0700

    ACPI battery: work around negative s16 battery current on Acer

is in the acpi-test tree, staged for 2.6.32
Comment 6 Len Brown 2009-11-25 03:03:36 UTC
shipped in 2.6.32-rc1

closed.

Note You need to log in before you can comment on or make changes to this bug.