[ltp] Battery recalibration (was: T470 multi-battery, discharging order)

Axel Braun axel.braun at gmx.de
Thu Mar 31 08:58:14 CEST 2022


Am Mittwoch, 30. März 2022, 16:22:43 CEST schrieb Kevin Locke:
> On Wed, 2022-03-30 at 13:02 +0200, Axel Braun wrote:
> > Am Mittwoch, 30. März 2022, 12:00:02 CEST schrieb linux-thinkpad-
request at linux-thinkpad.org:
> >> You can also get the battery information with:
> >> tlp-stat -b
> > 
> > Interesting. When running this I see as last sentence:
> > 
> > +++ Recommendations
> > * Install acpi_call kernel module for ThinkPad battery recalibration
> > 
> > I was not aware that Battery recalibration und Linux works, and I dont
> > have a acpi_call kernel module (running kernel 5.16.15)
> > 
> > Does anyone know how to get this working?
> 
> I believe battery recalibration simply discharges the battery then
> recharges it.[1]  To do so without disconnecting AC power, tlp can use
> Linux-native force-discharge added in b55d416d48f5[2] (5.17-rc1),
> acpi_call[3][4] (via tpacpi-bat[5], if installed), or tp_smapi[6] for
> older models, which it tries in that order.

From the code it looks as if it does not follow any discharge pattern, but 
simply waits until empty

> On a T470 with kernel 5.16.15 you'd likely want to install tpacpi-bat
> with the acpi_call kernel module, as described in Diego's reply, then
> run `tpacpi-bat -g FD 1` to force-discharge battery 1.  However, if
> you can upgrade to Linux 5.17, no additional software or modules are
> required and the process should be as simple as:

5.17 kernel is already in staging (for Tumbleweed), so it should arrive the 
next days (and fingers crossed that Nvidia modules dont break, as they are 
likely to do on any major kernel upgrade)

> if charge thresholds are being used, clear them during recalibration:
>     echo 0 >/sys/class/power_supply/BAT0/charge_control_start_threshold
>     echo 100 >/sys/class/power_supply/BAT0/charge_control_end_threshold
> echo force-discharge >/sys/class/power_supply/BAT0/charge_behaviour
> # Wait until battery is fully discharged
> # Wait until battery is fully recharged
> # Restore change thresholds as desired
> 
> Change BAT0 to BAT1 to recalibrate a second battery.
> 
> Of course, if you have physical access to the machine, you could
> recalibrate without software by simply disconnecting AC power,
> discharging the battery, then reconnecting.

I did not expect it to be that simple....
 
> Be aware that with any of the above methods, power management tools
> (GNOME Power Manager, KDE Power Devil, XFCE Power Manager, etc.) may
> automatically sleep, hibernate, or shutdown the machine when the
> battery charge drops below a configured level.  This may reduce the
> effectiveness of the recalibration, but avoids issues due to abrupt
> power loss.  You may get a more accurate recalibration by disabling
> this behavior.  If doing so, you would likely want to mount any
> persistent filesystems as read-only or take other steps to minimize
> the risk of corruption due to abrupt power loss.

Sure, or just boot a live system and wait for it to 'die'

Thanks
Axel




More information about the Linux-Thinkpad mailing list