Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STOP_CHARGE_THRESH_BAT1 not honored for Slice 19+ on X220 #735

Closed
samveen opened this issue Mar 24, 2024 · 4 comments
Closed

STOP_CHARGE_THRESH_BAT1 not honored for Slice 19+ on X220 #735

samveen opened this issue Mar 24, 2024 · 4 comments

Comments

@samveen
Copy link

samveen commented Mar 24, 2024

[x] I've read and accepted the Bug Reporting Howto
[x] I've provided all required tlp-stat outputs via Gist (see below)

Describe the bug

The STOP_CHARGE_THRESH_BAT1 threshold for BAT1 (Lenovo Slice 19+) are not honored when charging, and the charging continues till 100%

Expected behavior

The STOP_CHARGE_THRESH_BAT1 threshold for BAT1 (Lenovo Slice 19+) should be honored when charging, and the charging should stop at the configured percentage.

To Reproduce

Steps to reproduce the unexpected behavior:

  1. Let the battery discharge below the STOP_CHARGE_THRESH_BAT1.
  2. Connect the charger back to the Slice 19+ and start charging.
  3. Let charging complete.

** tlp-stat -b while discharging

samveen@samveen-x220:~$ sudo tlp-stat -b
--- TLP 1.6.1 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = active (charge thresholds, recalibration)
* tp-smapi (tp_smapi)     = readonly (status)
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/devices/platform/smapi/BAT0/manufacturer               = LGC
/sys/devices/platform/smapi/BAT0/model                      = 45N1029
/sys/devices/platform/smapi/BAT0/manufacture_date           = 2016-03-22
/sys/devices/platform/smapi/BAT0/first_use_date             = 2016-10-04
/sys/devices/platform/smapi/BAT0/cycle_count                =    219
/sys/devices/platform/smapi/BAT0/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT0/design_capacity            =  86580 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =   4970 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =   4090 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     82 [%]
/sys/devices/platform/smapi/BAT0/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT0/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT0/power_now                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/power_avg                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/state                      = idle

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

Charge                                                      =   82.3 [%]
Capacity                                                    =    5.7 [%]

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/devices/platform/smapi/BAT1/manufacturer               = SONY
/sys/devices/platform/smapi/BAT1/model                      = 42T4967
/sys/devices/platform/smapi/BAT1/manufacture_date           = 2015-06-12
/sys/devices/platform/smapi/BAT1/first_use_date             = 2020-02-21
/sys/devices/platform/smapi/BAT1/cycle_count                =     19
/sys/devices/platform/smapi/BAT1/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT1/design_capacity            =  64380 [mWh]
/sys/devices/platform/smapi/BAT1/last_full_capacity         =  61330 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_capacity         =  48340 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_percent          =     79 [%]
/sys/devices/platform/smapi/BAT1/remaining_running_time_now =    182 [min]
/sys/devices/platform/smapi/BAT1/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT1/power_now                  = -12842 [mW]
/sys/devices/platform/smapi/BAT1/power_avg                  = -13111 [mW]
/sys/devices/platform/smapi/BAT1/state                      = discharging

/sys/class/power_supply/BAT1/charge_control_start_threshold =     75 [%]
/sys/class/power_supply/BAT1/charge_control_end_threshold   =     85 [%]
/sys/class/power_supply/BAT1/charge_behaviour               = [auto] inhibit-charge force-discharge

Charge                                                      =   78.8 [%]
Capacity                                                    =   95.3 [%]

+++ Charge total                                            =   79.1 [%]

** tlp-stat -b while charging

samveen@samveen-x220:~$ sudo tlp-stat -b
--- TLP 1.6.1 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = active (charge thresholds, recalibration)
* tp-smapi (tp_smapi)     = readonly (status)
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/devices/platform/smapi/BAT0/manufacturer               = LGC
/sys/devices/platform/smapi/BAT0/model                      = 45N1029
/sys/devices/platform/smapi/BAT0/manufacture_date           = 2016-03-22
/sys/devices/platform/smapi/BAT0/first_use_date             = 2016-10-04
/sys/devices/platform/smapi/BAT0/cycle_count                =    219
/sys/devices/platform/smapi/BAT0/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT0/design_capacity            =  86580 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =   4970 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =   4090 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     82 [%]
/sys/devices/platform/smapi/BAT0/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT0/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT0/power_now                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/power_avg                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/state                      = idle

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

Charge                                                      =   82.3 [%]
Capacity                                                    =    5.7 [%]

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/devices/platform/smapi/BAT1/manufacturer               = SONY
/sys/devices/platform/smapi/BAT1/model                      = 42T4967
/sys/devices/platform/smapi/BAT1/manufacture_date           = 2015-06-12
/sys/devices/platform/smapi/BAT1/first_use_date             = 2020-02-21
/sys/devices/platform/smapi/BAT1/cycle_count                =     19
/sys/devices/platform/smapi/BAT1/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT1/design_capacity            =  64380 [mWh]
/sys/devices/platform/smapi/BAT1/last_full_capacity         =  61330 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_capacity         =  49310 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_percent          =     80 [%]
/sys/devices/platform/smapi/BAT1/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT1/remaining_charging_time    =     78 [min]
/sys/devices/platform/smapi/BAT1/power_now                  =  17394 [mW]
/sys/devices/platform/smapi/BAT1/power_avg                  =  17346 [mW]
/sys/devices/platform/smapi/BAT1/state                      = charging

/sys/class/power_supply/BAT1/charge_control_start_threshold =     75 [%]
/sys/class/power_supply/BAT1/charge_control_end_threshold   =     85 [%]
/sys/class/power_supply/BAT1/charge_behaviour               = [auto] inhibit-charge force-discharge

Charge                                                      =   80.4 [%]
Capacity                                                    =   95.3 [%]

+++ Charge total                                            =   80.5 [%]

** tlp-stat -b once the threshold is breached:

samveen@samveen-x220:~$ sudo tlp-stat -b
--- TLP 1.6.1 --------------------------------------------

+++ Battery Care
Plugin: thinkpad
Supported features: charge thresholds, recalibration
Driver usage:
* natacpi (thinkpad_acpi) = active (charge thresholds, recalibration)
* tp-smapi (tp_smapi)     = readonly (status)
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/devices/platform/smapi/BAT0/manufacturer               = LGC
/sys/devices/platform/smapi/BAT0/model                      = 45N1029
/sys/devices/platform/smapi/BAT0/manufacture_date           = 2016-03-22
/sys/devices/platform/smapi/BAT0/first_use_date             = 2016-10-04
/sys/devices/platform/smapi/BAT0/cycle_count                =    219
/sys/devices/platform/smapi/BAT0/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT0/design_capacity            =  86580 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =   4970 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =   4090 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     82 [%]
/sys/devices/platform/smapi/BAT0/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT0/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT0/power_now                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/power_avg                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/state                      = idle

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

Charge                                                      =   82.3 [%]
Capacity                                                    =    5.7 [%]

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/devices/platform/smapi/BAT1/manufacturer               = SONY
/sys/devices/platform/smapi/BAT1/model                      = 42T4967
/sys/devices/platform/smapi/BAT1/manufacture_date           = 2015-06-12
/sys/devices/platform/smapi/BAT1/first_use_date             = 2020-02-21
/sys/devices/platform/smapi/BAT1/cycle_count                =     19
/sys/devices/platform/smapi/BAT1/temperature                =     37 [°C]
/sys/devices/platform/smapi/BAT1/design_capacity            =  64380 [mWh]
/sys/devices/platform/smapi/BAT1/last_full_capacity         =  61330 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_capacity         =  52920 [mWh]
/sys/devices/platform/smapi/BAT1/remaining_percent          =     86 [%]
/sys/devices/platform/smapi/BAT1/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT1/remaining_charging_time    =     65 [min]
/sys/devices/platform/smapi/BAT1/power_now                  =  17538 [mW]
/sys/devices/platform/smapi/BAT1/power_avg                  =  17526 [mW]
/sys/devices/platform/smapi/BAT1/state                      = charging

/sys/class/power_supply/BAT1/charge_control_start_threshold =     75 [%]
/sys/class/power_supply/BAT1/charge_control_end_threshold   =     85 [%]
/sys/class/power_supply/BAT1/charge_behaviour               = [auto] inhibit-charge force-discharge

Charge                                                      =   86.3 [%]
Capacity                                                    =   95.3 [%]

+++ Charge total                                            =   86.0 [%]

Additional Environment Context

samveen@samveen-x220:~$ uname -a
Linux samveen-x220 6.1.65-060165-generic #202312031100-Ubuntu SMP PREEMPT_DYNAMIC Sun Dec  3 12:00:13 UTC x86_64 x86_64 x86_64 GNU/Linux
samveen@samveen-x220:~$ grep VER /etc/os-release 
VERSION="20.04.6 LTS (Focal Fossa)"
VERSION_ID="20.04"
VERSION_CODENAME=focal
samveen@samveen-x220:~$ apt show tp-smapi-dkms acpi-call-dkms tlp 2>/dev/null |grep -E '^Package|^Version|^APT-Sources'
Package: tp-smapi-dkms
Version: 0.43-1
APT-Sources: http://in.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Package: acpi-call-dkms
Version: 1.2.2-0~focal
APT-Sources: http://ppa.launchpad.net/linrunner/tlp/ubuntu focal/main amd64 Packages
Package: tlp
Version: 1.6.1-2~focal1
APT-Sources: http://ppa.launchpad.net/linrunner/tlp/ubuntu focal/main amd64 Packages

** Non-default configuration

samveen@samveen-x220:~$ sudo tlp-stat --cdiff
--- TLP 1.6.1 --------------------------------------------

+++ Configured Settings (only differences to defaults):
/etc/tlp.d/03-cpu-restrictions.conf L0007: CPU_ENERGY_PERF_POLICY_ON_AC="balance_power"
/etc/tlp.d/01-wlan-powersave-off.conf L0002: WIFI_PWR_ON_BAT="off"
/etc/tlp.d/02-battery-thresholds.conf L0005: START_CHARGE_THRESH_BAT0="75"
/etc/tlp.d/02-battery-thresholds.conf L0006: STOP_CHARGE_THRESH_BAT0="85"
/etc/tlp.d/02-battery-thresholds.conf L0008: START_CHARGE_THRESH_BAT1="75"
/etc/tlp.d/02-battery-thresholds.conf L0009: STOP_CHARGE_THRESH_BAT1="85"
/etc/tlp.d/03-cpu-restrictions.conf L0001: CPU_DRIVER_OPMODE_ON_AC="active"
/etc/tlp.d/03-cpu-restrictions.conf L0002: CPU_DRIVER_OPMODE_ON_BAT="active"
/etc/tlp.d/03-cpu-restrictions.conf L0004: CPU_SCALING_GOVERNOR_ON_AC="powersave"
/etc/tlp.d/03-cpu-restrictions.conf L0005: CPU_SCALING_GOVERNOR_ON_BAT="powersave"
/etc/tlp.d/03-cpu-restrictions.conf L0010: CPU_MIN_PERF_ON_AC="0"
/etc/tlp.d/03-cpu-restrictions.conf L0011: CPU_MAX_PERF_ON_AC="30"
/etc/tlp.d/03-cpu-restrictions.conf L0012: CPU_MIN_PERF_ON_BAT="0"
/etc/tlp.d/03-cpu-restrictions.conf L0013: CPU_MAX_PERF_ON_BAT="30"
/etc/tlp.d/03-cpu-restrictions.conf L0015: CPU_BOOST_ON_AC="0"
/etc/tlp.d/03-cpu-restrictions.conf L0016: CPU_BOOST_ON_BAT="0"
@samveen samveen changed the title [Possible bug] Thresholds for Slice 19+ on X220 not honored [Possible bug] STOP_CHARGE_THRESH_BAT1 for Slice 19+ on X220 not honored. Mar 24, 2024
@linrunner
Copy link
Owner

Your output clearly shows that the thresholds are set correctly:

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
[...]
/sys/class/power_supply/BAT1/charge_control_start_threshold = 75 [%]
/sys/class/power_supply/BAT1/charge_control_end_threshold = 85 [%]

So the behavior is due to your ThinkPad, not TLP. I wouldn't expect everything to still work perfectly on hardware that is about 12 years old.

@linrunner linrunner changed the title [Possible bug] STOP_CHARGE_THRESH_BAT1 for Slice 19+ on X220 not honored. STOP_CHARGE_THRESH_BAT1 not honored for Slice 19+ on X220 Mar 24, 2024
@linrunner linrunner changed the title STOP_CHARGE_THRESH_BAT1 not honored for Slice 19+ on X220 STOP_CHARGE_THRESH_BAT1 not honored for Slice 19+ on X220 Mar 24, 2024
@samveen
Copy link
Author

samveen commented Mar 24, 2024

@linrunner Would you be able to point me towards where I might check for the underlying issue?

@linrunner
Copy link
Owner

linrunner commented Mar 24, 2024

If I did that for every charge threshold hiccup on ThinkPads, the issue tracker would become a support forum and I wouldn't have time to develop anymore.

Just this much: the standard workaround for older models is to reset the EC - remove all batteries, disconnect the power supply, hold the power button for 30 seconds.

https://linrunner.de/tlp//faq/battery.html#faq-thinkpad-thresholds-not-respected

@samveen
Copy link
Author

samveen commented Mar 25, 2024

Thank you !!!

And apologies. It's very easy for forget that helpful people are taking time out from their priorities to make life easier for us, and to not take more of their time. Thank you for making my life easier for the last 4 thinkpads I've had 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants