<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/acpi/battery.c, branch linux-3.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2012-11-16T21:28:58Z</updated>
<entry>
<title>ACPI / battery: Correct battery capacity values on Thinkpads</title>
<updated>2012-11-16T21:28:58Z</updated>
<author>
<name>Kamil Iskra</name>
</author>
<published>2012-11-16T21:28:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4000e626156935dfb626321ce09cae2c833eabbb'/>
<id>urn:sha1:4000e626156935dfb626321ce09cae2c833eabbb</id>
<content type='text'>
Add a quirk to correctly report battery capacity on 2010 and 2011
Lenovo Thinkpad models.

The affected models that I tested (x201, t410, t410s, and x220)
exhibit a problem where, when battery capacity reporting unit is mAh,
the values being reported are wrong.  Pre-2010 and 2012 models appear
to always report in mWh and are thus unaffected.  Also, in mid-2012
Lenovo issued a BIOS update for the 2011 models that fixes the issue
(tested on x220 with a post-1.29 BIOS).  No such update is available
for the 2010 models, so those still need this patch.

Problem description: for some reason, the affected Thinkpads switch
the reporting unit between mAh and mWh; generally, mAh is used when a
laptop is plugged in and mWh when it's unplugged, although a
suspend/resume or rmmod/modprobe is needed for the switch to take
effect.  The values reported in mAh are *always* wrong.  This does
not appear to be a kernel regression; I believe that the values were
never reported correctly.  I tested back to kernel 2.6.34, with
multiple machines and BIOS versions.

Simply plugging a laptop into mains before turning it on is enough to
reproduce the problem.  Here's a sample /proc/acpi/battery/BAT0/info
from Thinkpad x220 (before a BIOS update) with a 4-cell battery:

present:                 yes
design capacity:         2886 mAh
last full capacity:      2909 mAh
battery technology:      rechargeable
design voltage:          14800 mV
design capacity warning: 145 mAh
design capacity low:     13 mAh
cycle count:              0
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            42T4899
serial number:           21064
battery type:            LION
OEM info:                SANYO

Once the laptop switches the unit to mWh (unplug from mains, suspend,
resume), the output changes to:

present:                 yes
design capacity:         28860 mWh
last full capacity:      29090 mWh
battery technology:      rechargeable
design voltage:          14800 mV
design capacity warning: 1454 mWh
design capacity low:     200 mWh
cycle count:              0
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            42T4899
serial number:           21064
battery type:            LION
OEM info:                SANYO

Can you see how the values for "design capacity", etc., differ by a
factor of 10 instead of 14.8 (the design voltage of this battery)?
On the battery itself it says: 14.8V, 1.95Ah, 29Wh, so clearly the
values reported in mWh are correct and the ones in mAh are not.

My guess is that this problem has been around ever since those
machines were released, but because the most common Thinkpad
batteries are rated at 10.8V, the error (8%) is small enough that it
simply hasn't been noticed or at least nobody could be bothered to
look into it.

My patch works around the problem by adjusting the incorrectly
reported mAh values by "10000 / design_voltage".  The patch also has
code to figure out if it should be activated or not.  It only
activates on Lenovo Thinkpads, only when the unit is mAh, and, as an
extra precaution, only when the battery capacity reported through
ACPI does not match what is reported through DMI (I've never
encountered a machine where the first two conditions would be true
but the last would not, but better safe than sorry).

I've been using this patch for close to a year on several systems
without any problems.

References: https://bugzilla.kernel.org/show_bug.cgi?id=41062
Acked-by: Henrique de Moraes Holschuh &lt;hmh@hmh.eng.br&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI / PM: Fix unused function warnings for CONFIG_PM_SLEEP</title>
<updated>2012-08-10T11:35:32Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2012-08-09T21:00:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9069240480e24a2d6ce23404c9ad6cabf59b7258'/>
<id>urn:sha1:9069240480e24a2d6ce23404c9ad6cabf59b7258</id>
<content type='text'>
According to compiler warnings, several suspend/resume functions
in ACPI drivers are not used for CONFIG_PM_SLEEP unset, so add
#ifdefs to prevent them from being built in that case.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux</title>
<updated>2012-07-26T21:28:55Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2012-07-26T21:28:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=476525004ac7e2f990b6956efcd44d0780c2ab4c'/>
<id>urn:sha1:476525004ac7e2f990b6956efcd44d0780c2ab4c</id>
<content type='text'>
Pull ACPI &amp; power management update from Len Brown:
 "Re-write of the turbostat tool.
     lower overhead was necessary for measuring very large system when
     they are very idle.

  IVB support in intel_idle
     It's what I run on my IVB, others should be able to also:-)

  ACPICA core update
     We have found some bugs due to divergence between Linux and the
     upstream ACPICA base.  Most of these patches are to reduce that
     divergence to reduce the risk of future bugs.

  Some cpuidle updates, mostly for non-Intel
     More will be coming, as they depend on this part.

  Some thermal management changes needed by non-ACPI systems.

  Some _OST (OS Status Indication) updates for hot ACPI hot-plug."

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (51 commits)
  Thermal: Documentation update
  Thermal: Add Hysteresis attributes
  Thermal: Make Thermal trip points writeable
  ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
  tools/power: turbostat: fix large c1% issue
  tools/power: turbostat v2 - re-write for efficiency
  ACPICA: Update to version 20120711
  ACPICA: AcpiSrc: Fix some translation issues for Linux conversion
  ACPICA: Update header files copyrights to 2012
  ACPICA: Add new ACPI table load/unload external interfaces
  ACPICA: Split file: tbxface.c -&gt; tbxfload.c
  ACPICA: Add PCC address space to space ID decode function
  ACPICA: Fix some comment fields
  ACPICA: Table manager: deploy new firmware error/warning interfaces
  ACPICA: Add new interfaces for BIOS(firmware) errors and warnings
  ACPICA: Split exception code utilities to a new file, utexcep.c
  ACPI: acpi_pad: tune round_robin_time
  ACPICA: Update to version 20120620
  ACPICA: Add support for implicit notify on multiple devices
  ACPICA: Update comments; no functional change
  ...
</content>
</entry>
<entry>
<title>ACPI: Use struct dev_pm_ops for power management in the battery driver</title>
<updated>2012-07-01T11:31:00Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2012-06-27T21:26:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a6f50dc8ef26819c510cda84477dd60e3d1c90bb'/>
<id>urn:sha1:a6f50dc8ef26819c510cda84477dd60e3d1c90bb</id>
<content type='text'>
Make the ACPI battery driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct acpi_device_ops.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>ACPI Battery: Added capacity</title>
<updated>2012-06-01T22:57:11Z</updated>
<author>
<name>srinivas pandruvada</name>
</author>
<published>2012-04-06T00:38:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a58e1150225cc9e554b76da5519b2bb5bb6e46ff'/>
<id>urn:sha1:a58e1150225cc9e554b76da5519b2bb5bb6e46ff</id>
<content type='text'>
Added Capacity field, which is a pre-defined power_supply
property. Calculating capacity using current charge/energy and
full charge/energy.
Some user mode implementations are relying on capacity field to
show battery strength and power down decision.

Signed-off-by: srinivas pandruvada &lt;srinivas.pandruvada@intel.com&gt;
Signed-off-by: Len Brown &lt;len.brown@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI battery: only refresh the sysfs files when pertinent information changes</title>
<updated>2012-05-08T05:49:57Z</updated>
<author>
<name>Andy Whitcroft</name>
</author>
<published>2012-05-03T13:48:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c5971456964290da7e98222892797b71ef793e62'/>
<id>urn:sha1:c5971456964290da7e98222892797b71ef793e62</id>
<content type='text'>
We only need to regenerate the sysfs files when the capacity units
change, avoid the update otherwise.

The origin of this issue is dates way back to 2.6.38:
da8aeb92d4853f37e281f11fddf61f9c7d84c3cd
(ACPI / Battery: Update information on info notification and resume)

cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andy Whitcroft &lt;apw@canonical.com&gt;
Tested-by: Ralf Jung &lt;post@ralfj.de&gt;
Signed-off-by: Len Brown &lt;len.brown@intel.com&gt;
</content>
</entry>
<entry>
<title>switch procfs to umode_t use</title>
<updated>2012-01-04T03:54:56Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2011-07-24T07:36:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d161a13f974c72fd7ff0069d39a3ae57cb5694ff'/>
<id>urn:sha1:d161a13f974c72fd7ff0069d39a3ae57cb5694ff</id>
<content type='text'>
both proc_dir_entry -&gt;mode and populating functions

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'battery' into release</title>
<updated>2011-08-06T02:16:42Z</updated>
<author>
<name>Len Brown</name>
</author>
<published>2011-08-06T02:16:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5389102e231d5f06da8b2897336293db18af9d76'/>
<id>urn:sha1:5389102e231d5f06da8b2897336293db18af9d76</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Battery: sysfs_remove_battery(): possible circular locking</title>
<updated>2011-08-06T02:15:18Z</updated>
<author>
<name>Sergey Senozhatsky</name>
</author>
<published>2011-08-05T22:34:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=69d94ec6d83d84044252d9ba03f6a8970816e350'/>
<id>urn:sha1:69d94ec6d83d84044252d9ba03f6a8970816e350</id>
<content type='text'>
Commit 9c921c22a7f33397a6774d7fa076db9b6a0fd669
Author: Lan Tianyu &lt;tianyu.lan@intel.com&gt;

    ACPI / Battery: Resolve the race condition in the sysfs_remove_battery()

fixed BUG https://bugzilla.kernel.org/show_bug.cgi?id=35642 , but as a side
effect made lockdep unhappy with sysfs_remove_battery():

[14818.477168]
[14818.477170] =======================================================
[14818.477200] [ INFO: possible circular locking dependency detected ]
[14818.477221] 3.1.0-dbg-07865-g1280ea8-dirty #668
[14818.477236] -------------------------------------------------------
[14818.477257] s2ram/1599 is trying to acquire lock:
[14818.477276]  (s_active#8){++++.+}, at: [&lt;ffffffff81169147&gt;] sysfs_addrm_finish+0x31/0x5a
[14818.477323]
[14818.477325] but task is already holding lock:
[14818.477350]  (&amp;battery-&gt;lock){+.+.+.}, at: [&lt;ffffffffa0047278&gt;] sysfs_remove_battery+0x10/0x4b [battery]
[14818.477395]
[14818.477397] which lock already depends on the new lock.
[14818.477399]
[..]
[14818.479121] stack backtrace:
[14818.479148] Pid: 1599, comm: s2ram Not tainted 3.1.0-dbg-07865-g1280ea8-dirty #668
[14818.479175] Call Trace:
[14818.479198]  [&lt;ffffffff814828c3&gt;] print_circular_bug+0x293/0x2a4
[14818.479228]  [&lt;ffffffff81070cb5&gt;] __lock_acquire+0xfe4/0x164b
[14818.479260]  [&lt;ffffffff81169147&gt;] ? sysfs_addrm_finish+0x31/0x5a
[14818.479288]  [&lt;ffffffff810718d2&gt;] lock_acquire+0x138/0x1ac
[14818.479316]  [&lt;ffffffff81169147&gt;] ? sysfs_addrm_finish+0x31/0x5a
[14818.479345]  [&lt;ffffffff81168a79&gt;] sysfs_deactivate+0x9b/0xec
[14818.479373]  [&lt;ffffffff81169147&gt;] ? sysfs_addrm_finish+0x31/0x5a
[14818.479405]  [&lt;ffffffff81169147&gt;] sysfs_addrm_finish+0x31/0x5a
[14818.479433]  [&lt;ffffffff81167bc5&gt;] sysfs_hash_and_remove+0x54/0x77
[14818.479461]  [&lt;ffffffff811681b9&gt;] sysfs_remove_file+0x12/0x14
[14818.479488]  [&lt;ffffffff81385bf8&gt;] device_remove_file+0x12/0x14
[14818.479516]  [&lt;ffffffff81386504&gt;] device_del+0x119/0x17c
[14818.479542]  [&lt;ffffffff81386575&gt;] device_unregister+0xe/0x1a
[14818.479570]  [&lt;ffffffff813c6ef9&gt;] power_supply_unregister+0x23/0x27
[14818.479601]  [&lt;ffffffffa004729c&gt;] sysfs_remove_battery+0x34/0x4b [battery]
[14818.479632]  [&lt;ffffffffa004778f&gt;] battery_notify+0x2c/0x3a [battery]
[14818.479662]  [&lt;ffffffff8148fe82&gt;] notifier_call_chain+0x74/0xa1
[14818.479692]  [&lt;ffffffff810624b4&gt;] __blocking_notifier_call_chain+0x6c/0x89
[14818.479722]  [&lt;ffffffff810624e0&gt;] blocking_notifier_call_chain+0xf/0x11
[14818.479751]  [&lt;ffffffff8107e40e&gt;] pm_notifier_call_chain+0x15/0x27
[14818.479770]  [&lt;ffffffff8107ee1a&gt;] enter_state+0xa7/0xd5
[14818.479782]  [&lt;ffffffff8107e341&gt;] state_store+0xaa/0xc0
[14818.479795]  [&lt;ffffffff8107e297&gt;] ? pm_async_store+0x45/0x45
[14818.479807]  [&lt;ffffffff81248837&gt;] kobj_attr_store+0x17/0x19
[14818.479820]  [&lt;ffffffff81167e27&gt;] sysfs_write_file+0x103/0x13f
[14818.479834]  [&lt;ffffffff81109037&gt;] vfs_write+0xad/0x13d
[14818.479847]  [&lt;ffffffff811092b2&gt;] sys_write+0x45/0x6c
[14818.479860]  [&lt;ffffffff81492f92&gt;] system_call_fastpath+0x16/0x1b

This patch introduces separate lock to struct acpi_battery to
grab in sysfs_remove_battery() instead of battery-&gt;lock.
So fix by Lan Tianyu is still there, we just grab independent lock.

Signed-off-by: Sergey Senozhatsky &lt;sergey.senozhatsky@gmail.com&gt;
Tested-by: Lan Tianyu &lt;tianyu.lan@intel.com&gt;
Signed-off-by: Len Brown &lt;len.brown@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6</title>
<updated>2011-08-03T07:17:02Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2011-08-03T07:17:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c299eba3c5a801657f275d33be588b34831cd30e'/>
<id>urn:sha1:c299eba3c5a801657f275d33be588b34831cd30e</id>
<content type='text'>
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (28 commits)
  ACPI:  delete stale reference in kernel-parameters.txt
  ACPI: add missing _OSI strings
  ACPI: remove NID_INVAL
  thermal: make THERMAL_HWMON implementation fully internal
  thermal: split hwmon lookup to a separate function
  thermal: hide CONFIG_THERMAL_HWMON
  ACPI print OSI(Linux) warning only once
  ACPI: DMI workaround for Asus A8N-SLI Premium and Asus A8N-SLI DELUX
  ACPI / Battery: propagate sysfs error in acpi_battery_add()
  ACPI / Battery: avoid acpi_battery_add() use-after-free
  ACPI: introduce "acpi_rsdp=" parameter for kdump
  ACPI: constify ops structs
  ACPI: fix CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
  ACPI: fix 80 char overflow
  ACPI / Battery: Resolve the race condition in the sysfs_remove_battery()
  ACPI / Battery: Add the check before refresh sysfs in the battery_notify()
  ACPI / Battery: Add the hibernation process in the battery_notify()
  ACPI / Battery: Rename acpi_battery_quirks2 with acpi_battery_quirks
  ACPI / Battery: Change 16-bit signed negative battery current into correct value
  ACPI / Battery: Add the power unit macro
  ...
</content>
</entry>
</feed>
