Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1025902: tlp: Battery charge thresholds are ignored

555 views
Skip to first unread message

Benedikt Ahrens

unread,
Dec 11, 2022, 12:50:03 PM12/11/22
to
Package: tlp
Version: 1.5.0-1
Severity: normal
X-Debbugs-Cc: benedik...@gmx.net

Dear Maintainer,

TLP does not set the battery charge threshold configured in the TLP
configuration file.

Specifically, the configuration file (attached) aims to set the battery charge
thresholds to something like 75%. However, the battery is charged to 100%. The
output of `tlp-stat -b` is

```
# tlp-stat -b
--- TLP 1.5.0 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = active (charge thresholds, recalibration)
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1: 0(off)..96(default)..99
* STOP_CHARGE_THRESH_BAT0/1: 1..100(default)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer = SMP
/sys/class/power_supply/BAT0/model_name = 5B10W51864
/sys/class/power_supply/BAT0/cycle_count = 7
/sys/class/power_supply/BAT0/energy_full_design = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_full = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_now = 37640 [mWh]
/sys/class/power_supply/BAT0/power_now = 4902 [mW]
/sys/class/power_supply/BAT0/status = Discharging

/sys/class/power_supply/BAT0/charge_control_start_threshold = 0 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold = 100 [%]
/sys/class/power_supply/BAT0/charge_behaviour = [auto] inhibit-
charge force-discharge

Charge = 71.7 [%]
Capacity = 100.0 [%]

```

Rebooting does not change the output, or the charging behaviour.


-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-5-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages tlp depends on:
ii hdparm 9.65+ds-1
ii iw 5.19-1
ii pciutils 1:3.9.0-2
ii rfkill 2.38.1-4
ii usbutils 1:014-1

Versions of packages tlp recommends:
ii ethtool 1:6.0-1
ii tlp-rdw 1.5.0-1

Versions of packages tlp suggests:
pn acpi-call-dkms <none>
pn linux-cpupower <none>
pn smartmontools <none>
ii tp-smapi-dkms 0.43-1

-- Configuration Files:
/etc/tlp.conf changed:


-- no debconf information

Benedikt Ahrens

unread,
Dec 13, 2022, 9:40:04 AM12/13/22
to
Here is the relevant part of /etc/tlp.conf:


# Battery Care -- Charge thresholds
# Charging starts when the charge level is below the START_CHARGE_THRESH
value
# when the charger is connected. It stops when the STOP_CHARGE_THRESH
value is
# reached.
# Required hardware: Lenovo ThinkPads and select other laptop brands are
driven
# via specific plugins, the actual support status is shown by tlp-stat -b.
# For more explanations and vendor specific details refer to
# https://linrunner.de/tlp/settings/battery.html
# Notes:
# - ThinkPads may require external kernel module(s), refer to the output of
# tlp-stat -b
# - Vendor specific parameter value ranges are shown by tlp-stat -b
# - If your hardware supports a start *and* a stop threshold, you must
# specify both, otherwise TLP will refuse to apply the single threshold
# - If your hardware supports only a stop threshold, set the start value
to 0

# BAT0: Primary / Main / Internal battery (values in %)
# Note: also use for batteries BATC, BATT and CMB0
# Default: <none>

#START_CHARGE_THRESH_BAT0=65
#STOP_CHARGE_THRESH_BAT0=75

# BAT1: Secondary / Ultrabay / Slice / Replaceable battery (values in %)
# Note: primary on some laptops
# Default: <none>

#START_CHARGE_THRESH_BAT1=65
#STOP_CHARGE_THRESH_BAT1=75

# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
# Default: 0

#RESTORE_THRESHOLDS_ON_BAT=1

# Control battery care drivers: 0=disable, 1=enable.
# Default: 1 (all)

#NATACPI_ENABLE=1
#TPACPI_ENABLE=1
#TPSMAPI_ENABLE=1

Raphaël Halimi

unread,
Dec 28, 2022, 2:10:04 PM12/28/22
to
Hi,

Sorry for the late answer, the e-mail from the BTS fell into my spam folder.

Usually, in configuration files, a hash symbol (#) indicates a comment,
and is ignored by the software.

It seems that you didn't un-comment the lines when modifying the charge
thresholds. Remove the # symbol in front of the lines you modified (the
ones starting with START_CHARGE_THRESH and STOP_CHARGE_THRESH) and it
should work.

Regards,

--
Raphaël Halimi

Benedikt Ahrens

unread,
Jan 7, 2023, 8:10:04 AM1/7/23
to
Dear Raphaël,

Thanks a lot for your advice.

I have uncommented the corresponding lines in the configuration file
(which I am sending in attachment). However, the output of `tlp-stat -b`
still shows no change to the charge thresholds, even after reboot:

```
# tlp-stat -b
--- TLP 1.5.0 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = active (charge thresholds, recalibration)
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1: 0(off)..96(default)..99
* STOP_CHARGE_THRESH_BAT0/1: 1..100(default)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer = SMP
/sys/class/power_supply/BAT0/model_name = 5B10W51864
/sys/class/power_supply/BAT0/cycle_count = 14
/sys/class/power_supply/BAT0/energy_full_design = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_full = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_now = 37120 [mWh]
/sys/class/power_supply/BAT0/power_now = 14472 [mW]
/sys/class/power_supply/BAT0/status = Discharging

/sys/class/power_supply/BAT0/charge_control_start_threshold = 0 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold = 100 [%]
/sys/class/power_supply/BAT0/charge_behaviour = [auto]
inhibit-charge force-discharge

Charge = 70.7 [%]
Capacity = 100.0 [%]

```


I would be grateful for any advice.
All the best,
Benedikt
tlp.conf

Raphaël Halimi

unread,
Jan 7, 2023, 10:30:06 AM1/7/23
to
Le 07/01/2023 à 14:04, Benedikt Ahrens a écrit :
> Dear Raphaël,
>
> Thanks a  lot for your advice.
>
> I have uncommented the corresponding lines in the configuration file
> (which I am sending in attachment). However, the output of `tlp-stat -b`
> still shows no change to the charge thresholds, even after reboot:

What model of ThinkPad do you have ?

Maybe the natacpi driver doesn't work and you need another one.

Regards,

--
Raphaël Halimi

Benedikt Ahrens

unread,
Jan 7, 2023, 11:20:04 AM1/7/23
to


On 07/01/2023 16:21, Raphaël Halimi wrote:
>
> What model of ThinkPad do you have ?

I have a T14 G3.

> Maybe the natacpi driver doesn't work and you need another one.

I don't know how to switch to another driver. Would you be able to point
me to documentation on how to do that?

Thanks a lot!
Benedikt

Raphaël Halimi

unread,
Jan 7, 2023, 6:40:04 PM1/7/23
to
Le 07/01/2023 à 17:07, Benedikt Ahrens a écrit :
>> What model of ThinkPad do you have ?
>
> I have a T14 G3.

It's a fairly recent model (February 2022), I can't say if it's not
supported by thinkpad_acpi yet, but trying good old acpi_call may be
worth it. Bear in mind that I'm only the package maintainer, not the
main developer, so I'm really not sure if it's the cause of the problem.

>> Maybe the natacpi driver doesn't work and you need another one.
>
> I don't know how to switch to another driver. Would you be able to point
> me to documentation on how to do that?

Make sure you install the kernel headers package matching your kernel
(probably linux-headers-amd64), and then install acpi-call-dkms. It
should build the module automatically. Then try to load it :

$ sudo modprobe acpi_call

...and tell TLP to use it by disabling natacpi (which supersedes
tpacpi-bat). To do so, change the value of the NATACPI_ENABLE to 0 in
tlp.conf. Restart tlp, and see if it solves your problem.

If loading the module says something like "Operation not permitted", it
means secure boot is enabled and you have to create a key pair, enroll
it in the MOK (machine owner keys), and sign the module with it. It's
far outside of the scope of TLP, so in the meantime, for the purpose of
testing, just reboot into BIOS and disable secure boot.

Regards,

--
Raphaël Halimi

Benedikt Ahrens

unread,
Jan 8, 2023, 8:30:03 AM1/8/23
to
Dear Raphaël,

Thanks a lot for your advice. The change you propose does not solve the
problem:

```
# tlp-stat -b
--- TLP 1.5.0 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = inactive (disabled by configuration)
* tpacpi-bat (acpi_call) = active (charge thresholds, recalibration)
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1: 0(off)..96(default)..99
* STOP_CHARGE_THRESH_BAT0/1: 1..100(default)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer = SMP
/sys/class/power_supply/BAT0/model_name = 5B10W51864
/sys/class/power_supply/BAT0/cycle_count = 14
/sys/class/power_supply/BAT0/energy_full_design = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_full = 52500 [mWh]
/sys/class/power_supply/BAT0/energy_now = 14440 [mWh]
/sys/class/power_supply/BAT0/power_now = 9165 [mW]
/sys/class/power_supply/BAT0/status = Discharging

tpacpi-bat.BAT0.startThreshold = 0 [%]
tpacpi-bat.BAT0.stopThreshold = 100 [%]
tpacpi-bat.BAT0.forceDischarge = 0

Charge = 27.5 [%]
Capacity = 100.0 [%]
```

Please let me know if there is anything I can do to debug this issue.

All the best,
Benedikt

Raphaël Halimi

unread,
Jan 8, 2023, 10:40:04 AM1/8/23
to
Le 08/01/2023 à 14:18, Benedikt Ahrens a écrit :
> Dear Raphaël,
>
> Thanks a lot for your advice. The change you propose does not solve the
> problem:
>
> ```
> tpacpi-bat.BAT0.startThreshold                              =      0 [%]
> tpacpi-bat.BAT0.stopThreshold                               =    100 [%]
> tpacpi-bat.BAT0.forceDischarge                              =      0

Sorry, I didn't realize that the thresholds were at 0% and 100%
(although it was written in your first report) ; they should be at 96%
and 100%.

Maybe your laptop is too recent and not supported yet.

Please undo all the changes and revert to natacpi. I'll try to see that
with upstream.

Regards,

--
Raphaël Halimi

Raphaël Halimi

unread,
Jan 8, 2023, 2:30:04 PM1/8/23
to
Hi again,

I contacted the upstream developer and he'd like you to open an issue
there directly.

The project page is at https://github.com/linrunner/TLP

For starters he needs the output of :

$ tlp-stat --cdiff -s -b

Once you've done that, please reply here with the address of the issue
report, I'll link them in the BTS.

Regards,

--
Raphaël Halimi

Benedikt Ahrens

unread,
Jan 10, 2023, 6:30:04 AM1/10/23
to
Dear Raphaël,

Thanks so much for your help!

The upstream bug report is at https://github.com/linrunner/TLP/issues/670.

Best,
Benedikt
0 new messages