Bug 33722

Summary: s16 negative battery current quirk required for Atom-based tablet PC
Product: ACPI Reporter: James Ettle (james)
Component: Power-BatteryAssignee: Lan Tianyu (tianyu.lan)
Status: CLOSED CODE_FIX    
Severity: normal CC: florian, lenb, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.38.3 Subsystem:
Regression: No Bisected commit-id:
Attachments: acpidump for this tablet
dmidecode
dmesg
grep . /proc/acpi/battery/*/* on AC
grep . /sys/class/power_supply/*/* on AC
grep . /proc/acpi/battery/*/* on battery
grep . /sys/class/power_supply/*/* on battery
dmesg from the unpatched Fedora kernel that produced the greps above
Change 16-bit signed negative battery current into correct value
grep . /sys/class/power_supply/*/* on AC with patch from Comment #19
grep . /sys/class/power_supply/*/* on battery with patch from Comment #19

Description James Ettle 2011-04-19 08:47:09 UTC
Created attachment 54692 [details]
acpidump for this tablet

My Atom tablet PC reports ludicrous values for /sys/class/power_supply/BAT0/current_now on AC power (65336000 µA, if I recall the number correctly). This leads to gnome-power-manager claiming that the machine has only 3 minutes of power left when first unplugged.

Commenting out 'dmi_name_in_vendors("Acer") &&' in acpi_battery_quirks() in drivers/acpi/battery.c to force the quirk results in more sane current_now values (around 200000) when on AC.

dmidecode and acpidump attached.
Comment 1 James Ettle 2011-04-19 08:47:30 UTC
Created attachment 54702 [details]
dmidecode
Comment 2 James Ettle 2011-04-19 08:47:49 UTC
Created attachment 54712 [details]
dmesg
Comment 3 Lan Tianyu 2011-05-26 03:31:46 UTC
Please attach the output of "grep . /sys/class/power_supply/*/*" respectively when on the AC and unplugged.
Comment 4 James Ettle 2011-05-26 16:02:09 UTC
(In reply to comment #3)
> Please attach the output of "grep . /sys/class/power_supply/*/*" respectively
> when on the AC and unplugged.

With or without the patch described in the Description above?
Comment 5 Lan Tianyu 2011-05-27 03:10:26 UTC
Without the patch and add the output of "grep . /proc/acpi/battery/*/*".

Do you have a power monitor to measure the actual current? This is very helpful to locate the problem. 

BTW: Is your tablet on the market?
Comment 6 James Ettle 2011-05-28 18:24:34 UTC
Created attachment 59852 [details]
grep . /proc/acpi/battery/*/* on AC
Comment 7 James Ettle 2011-05-28 18:25:01 UTC
Created attachment 59862 [details]
grep . /sys/class/power_supply/*/* on AC
Comment 8 James Ettle 2011-05-28 18:26:14 UTC
Created attachment 59872 [details]
grep . /proc/acpi/battery/*/* on battery
Comment 9 James Ettle 2011-05-28 18:27:05 UTC
Created attachment 59882 [details]
grep . /sys/class/power_supply/*/* on battery
Comment 10 James Ettle 2011-05-28 18:28:05 UTC
Created attachment 59892 [details]
dmesg from the unpatched Fedora kernel that produced the greps above
Comment 11 James Ettle 2011-05-28 18:30:43 UTC
OK, the attached output was obtained from an unpatched Fedora 14 kernel, kernel-2.6.35.13-91.fc14.i686. I don't have any way to measure the current independently.

This tablet is on the market, in various forms; I believe it's actually a re-branded CZC P10P (or a variant thereof with a 1280x720 display).
Comment 12 Lan Tianyu 2011-05-30 07:17:29 UTC
I guess there are two problems.
First one is the abnormal value for /sys/class/power_supply/BAT0/current_now 
on AC. The value comes from the "_BST" method in the DSDT. The log of "acpi_battery_quirks" says that the problem was caused by DSDT bug.So If there was new Bios version for your tablet, you could have a try. 

Second one is the abnormal situation. 
> This leads to gnome-power-manager claiming that the machine has only 3
> minutes > of power left when first unplugged.

Will this status return to the normal state? From your attachment of "grep . /sys/class/power_supply/*/*" on battery, the current_now is normal value. 
The value of current_now during unplugged should be used to calculate the power life rather than the one when on AC. But now, I guess the value on the AC has been used.
Comment 13 Lan Tianyu 2011-05-30 07:30:19 UTC
I guess there are two problems.
First one is the abnormal value for /sys/class/power_supply/BAT0/current_now 
on AC. The value comes from the "_BST" method in the DSDT. The log of "acpi_battery_quirks" says that the problem was caused by DSDT bug.So If there was new Bios version for your tablet, you could have a try. 

Second one is the abnormal situation. 
> This leads to gnome-power-manager claiming that the machine has only 3
> minutes > of power left when first unplugged.

Will this status return to the normal state? From your attachment of "grep . /sys/class/power_supply/*/*" on battery, the current_now is normal value. 
The value of current_now during unplugged should be used to calculate the power life rather than the one when on AC. But now, I guess the value on the AC has been used.
Comment 14 Len Brown 2011-05-31 02:00:16 UTC
the DMI information looks like it was copied from a template
and never udpated.  This makes it problematic to create a
DMI matching string that will not also fire on other
systems.

Please attach the output from "lspci -nn" so that maybe
the host bridge pci-id can be used for a quirk
in addition to the DMI info.
Comment 15 James Ettle 2011-05-31 16:14:23 UTC
I'll try chasing up any BIOS updates for this tablet, only I'm not entirely sure to whom and how I should report this issue. (I believe this model was introduced around January 2011.) I don't even know if it's the OEM or vendor who's supposed to customise the DMI info for this machine...

Anyway, lspci -nn is as follows:


00:00.0 Host bridge [0600]: Intel Corporation N10 Family DMI Bridge [8086:a010]
00:02.0 VGA compatible controller [0300]: Intel Corporation N10 Family Integrated Graphics Controller [8086:a011]
00:02.1 Display controller [0380]: Intel Corporation N10 Family Integrated Graphics Controller [8086:a012]
00:1b.0 Audio device [0403]: Intel Corporation N10/ICH 7 Family High Definition Audio Controller [8086:27d8] (rev 02)
00:1c.0 PCI bridge [0604]: Intel Corporation N10/ICH 7 Family PCI Express Port 1 [8086:27d0] (rev 02)
00:1c.1 PCI bridge [0604]: Intel Corporation N10/ICH 7 Family PCI Express Port 2 [8086:27d2] (rev 02)
00:1d.0 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 [8086:27c8] (rev 02)
00:1d.1 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 [8086:27c9] (rev 02)
00:1d.2 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 [8086:27ca] (rev 02)
00:1d.3 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 [8086:27cb] (rev 02)
00:1d.7 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller [8086:27cc] (rev 02)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev e2)
00:1f.0 ISA bridge [0601]: Intel Corporation NM10 Family LPC Controller [8086:27bc] (rev 02)
00:1f.2 SATA controller [0106]: Intel Corporation N10/ICH7 Family SATA AHCI Controller [8086:27c1] (rev 02)
00:1f.3 SMBus [0c05]: Intel Corporation N10/ICH 7 Family SMBus Controller [8086:27da] (rev 02)
02:00.0 Network controller [0280]: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) [168c:002b] (rev 01)
Comment 16 Lan Tianyu 2011-06-03 05:25:11 UTC
Does windows work correctly on your tablet?
Comment 17 James Ettle 2011-06-03 17:34:01 UTC
(In reply to comment #16)
> Does windows work correctly on your tablet?

As far as I can recall, although I only tested it for a few days before wiping it. These tablets are being otherwise sold as Windows 7 machines, with said operating system pre-installed. I think they're also being sold, although possibly under other names or variants (with firmware changes? Don't know), as hardware for various mobile Linux distros.
Comment 18 Len Brown 2011-06-07 02:22:41 UTC
> I don't even know if it's the OEM or vendor
> who's supposed to customise the DMI info for this machine...

The way it works is that the OEM pays the BIOS vendor for the BIOS,
and as part of that work, the DMI should get updated to reflect
the system the BIOS is running.

This really does look like a pre-production BIOS...
Comment 19 Lan Tianyu 2011-06-16 05:31:30 UTC
Created attachment 62172 [details]
Change 16-bit signed negative battery current into correct value

Please test the patch on your tablet. It is to check the current and take 
its absolute value as current and producing a message when it  
is negative in s16. Thanks.
Comment 20 James Ettle 2011-06-16 22:27:48 UTC
(In reply to comment #19)
> Created an attachment (id=62172) [details]
> Change 16-bit signed negative battery current into correct value

This patch appears to work with sane current_now values and battery life estimates. Tested when applied to kernel 2.6.39.1. I'll attach the outputs of grep . /sys/class/power_supply/*/* below.
Comment 21 James Ettle 2011-06-16 22:28:36 UTC
Created attachment 62382 [details]
grep . /sys/class/power_supply/*/* on AC with patch from Comment #19
Comment 22 James Ettle 2011-06-16 22:29:03 UTC
Created attachment 62392 [details]
grep . /sys/class/power_supply/*/* on battery with patch from Comment #19
Comment 24 Len Brown 2011-07-31 18:12:39 UTC
updated versions of patches above staged in acpi-test for linux-3.1
Comment 25 Florian Mickler 2011-08-08 08:14:22 UTC
A patch referencing this bug report has been merged in Linux v3.1-rc1:

commit 55003b2105a4578736f3e868fbaa889bb1ff3ce0
Author: Lan Tianyu <tianyu.lan@intel.com>
Date:   Thu Jun 30 11:33:12 2011 +0800

    ACPI / Battery: Change 16-bit signed negative battery current into correct value