https://bugzilla.kernel.org/show_bug.cgi?id=28192
Summary: battery confuses mW and mA reporting units => wrong
rate/energy
Product: ACPI
Version: 2.5
Kernel Version: v2.6.38-rc3
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Power-Battery
AssignedTo: [email protected]
ReportedBy: [email protected]
Regression: Yes
On Thinkpad X201, often either of these erroneous power supply data (from
/sys/class/power_supply/BAT0) are visible in user space apps:
- energy and rate too low by factor of ~10
- energy and rate too high by factor of ~10
This happens mostly after resuming from hibernate or after fresh boot. I've
compiled battery as module -- reloading the module corrects the data most of
the time.
Using ACPI tracing, I checked the data returned by _BIF and _BST (it always
checks out with the corresponding raw sysfs values).
My suspicion as to what is happening:
- _BIF, which among others returns the reporting unit of the battery data, is
only called once at module load. Depending on the unit, either sysfs file
current_now or power_now is set up -- after that, always containing the number
in the second field of the package returned by _BST.
- Thinkpad X201 sometimes changes its mind which unit the data is in it reports
to the periodically called _BST.
- But the module doesn't detect that and so there are two possibilities of
miscalculations (data set used see at bottom):
1. unit mW at module load, changed to mA:
- power_now is present, but its value is a current, e.g. 1312000 (= 1.312
A)
- so power is 1.312 "W", instead of voltage_now*current_now = 14.6 W
2. unit mA at module load, changed to mW:
- current_now is present, but its value is a power, e.g. 14740000
(= 14.74 W)
- so power is calculated as voltage_now*current now, yielding 163.7 "W" in
user space apps (like gnome-power-manager)
- reloading the module calls _BIF and _BST in short succession and the data
units and values fit again.
The approximate factor 10 can be identified as voltage_now, which is about 11
V.
Data set used as example follows. Here, _BIF must have reported mW initially,
but _BST reports mA numbers. After reloading the module, the X201 changes its
mind and reports mW again.
- fresh boot:
$ cat energy_now voltage_now power_now
2049000
11093000
1312000
- after reloading battery module:
$ cat energy_now voltage_now power_now
20360000
11108000
14740000
Please note I suspect this is a regression since v2.6.35 or so, but I'm having
trouble bisecting because it's very time consuming. Most of the time, the error
only appears after the X201 was turned off for a longer time period.
Please advise if I can help, though I don't feel competent (yet) for developing
a fix.
--
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
acpi-bugzilla mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla