You are not logged in.

#1 2016-11-07 01:26:07

Quardah
Member
Registered: 2014-08-26
Posts: 146

Battery Tresholds?

Hi all.

Lately i've had issues with the laptop (ThinkPad T540p) refusing to charge to 100%, it would stop at 96%. I downloaded "TLP" and managed to use the fullcharge once, but i'd like to permanently remove the thresholds.

I am having problems finding the info on how to properly do it, and i don't really understand the power related stuff. I have found the config file for TLP but if i could just get the battery to work as expected without any additional software that would be best.

In short, how to i set the battery to default behaviors? Then i'll get rid of TLP.

Thanks.


ThinkPad P16s AMD / KDE

Offline

#2 2016-11-07 17:19:15

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: Battery Tresholds?

Hi,

provided you didn't configure thresholds in the configuration file (or unconfigured them) tlp fullcharge does exactly what you want, i.e remove the thresholds permanently.

Please show the output of (as root)

tlp-stat -c -b

Last edited by linrunner (2016-11-07 17:19:40)

Offline

#3 2016-11-07 19:53:30

Quardah
Member
Registered: 2014-08-26
Posts: 146

Re: Battery Tresholds?

Hi.

Here is the output :

[jape@T540p ~]$ sudo tlp-stat -c -b
--- TLP 0.9 --------------------------------------------

+++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1
NMI_WATCHDOG=0
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=powersave
DISK_DEVICES="sda sdb"
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power
AHCI_RUNTIME_PM_TIMEOUT=15
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on
WOL_DISABLE=Y
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1
SOUND_POWER_SAVE_CONTROLLER=Y
BAY_POWEROFF_ON_BAT=0
BAY_DEVICE="sr0"
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto
RUNTIME_PM_ALL=1
RUNTIME_PM_DRIVER_BLACKLIST="radeon nouveau"
USB_AUTOSUSPEND=1
USB_BLACKLIST_WWAN=1
RESTORE_DEVICE_STATE_ON_STARTUP=0

+++ ThinkPad Extended Battery Functions
tp-smapi   = inactive (kernel module 'tp_smapi' not installed)
tpacpi-bat = active

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer                   = LGC
/sys/class/power_supply/BAT0/model_name                     = 45N1153
/sys/class/power_supply/BAT0/cycle_count                    = (not supported)
/sys/class/power_supply/BAT0/energy_full_design             =  99460 [mWh]
/sys/class/power_supply/BAT0/energy_full                    =  84500 [mWh]
/sys/class/power_supply/BAT0/energy_now                     =  84420 [mWh]
/sys/class/power_supply/BAT0/power_now                      =      0 [mW]
/sys/class/power_supply/BAT0/status                         = Unknown (threshold effective)

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

Charge                                                      =   99.9 [%]
Capacity                                                    =   85.0 [%]

tlp fullcharge does nothing.

[jape@T540p ~]$ sudo tlp fullcharge
Setting temporary charge thresholds for BAT0:
  stop  = 100
  start = 96
[jape@T540p ~]$ acpi -i
Battery 0: Unknown, 99%
Battery 0: design capacity 7757 mAh, last full capacity 6590 mAh = 84%

From my previous tests, the battery is "Unknown" if plugged on AC but cannot charge because of a threshold. Right now i cannot simply uninstall TLP and get it to function as expected (just charge to 100% when plugged). I NEED to get rid of TLP because it provokes issues with bumblebee and optirun. If TLP is installed (not even running) bumblebee reports an error and cannot change the power state of the card. Somewhere this is interfering.

All i really want is to get the battery on its default configuration. What files should i delete or edit you think? I cannot find them.

Thanks.


ThinkPad P16s AMD / KDE

Offline

#4 2016-11-08 00:55:29

Quardah
Member
Registered: 2014-08-26
Posts: 146

Re: Battery Tresholds?

About the problem, after i removed TLP i removed the acpi-call package, and i *think* that this fixed the issue. Will report with more data soon.

linrunner wrote:

Hi,

provided you didn't configure thresholds in the configuration file (or unconfigured them) tlp fullcharge does exactly what you want, i.e remove the thresholds permanently.

Please show the output of (as root)

tlp-stat -c -b

I just realized you are the one that made TLP lol.

I'd like to know a thing while we're at it:

1 - When i uninstall TLP, why are the thresholds still there? Is it built in new ThinkPads? I have never seen any types of thresholds on the T420, it was plain and simply, charge as much as possible when plugged until it reached 100%.

2 - Do you have any clue why TLP interferes with bumblebee? When installed bumblebee cannot change the card's power state. Any clue on this would be appreciated.

3 - Do you think i could only port the "bayoff" function? As of right now, it's the function i will miss the most considering i need bumblebee over TLP (don't worry, i blame it on nvidia not you).

Thanks.


ThinkPad P16s AMD / KDE

Offline

#5 2016-11-08 19:24:11

Quardah
Member
Registered: 2014-08-26
Posts: 146

Re: Battery Tresholds?

Ok yea, to "unfuck" the charge thresholds, what i did is remove the battery from the ThinkPad and held the power button for 30 seconds.

Somehow now everything works as expected.

I do not have tlp installed because i am not taking the change to break my bumblebee again. Pretty sad because i would love to have the "bayoff" function.


ThinkPad P16s AMD / KDE

Offline

#6 2016-11-08 19:30:22

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: Battery Tresholds?

1 - You'll find the explanation in the FAQ:

Do charge thresholds work even when Linux/TLP is not running?

Yes. The charging process is not controlled by software, but by hardware. TLP just writes the thresholds to the hardware registers (via tp-smapi or tpacpi-bat). Once stored in the hardware the charge thresholds stay effective permanently. See below for removal.

Thus neither removing TLP nor acpi-call clears the thresholds. Therefore:

How do I disable the charge thresholds?

Remove the charge thresholds from the configuration by inserting a leading '#'
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80

and use
sudo tlp fullcharge

to immediately activate the factory settings 96 / 100%.

In fact your output shows factory presets i.e. "no thresholds":

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

Charge                                                      =   99.9 [%]
Capacity                                                    =   85.0 [%]

96/100 means the battery won't start to charge again before being discharged to 95 % to prevent very small cycles. Works as designed.

2 - I can only speculate because i have no Optimus hardware (and neither plan to nor do i recommend it).

TLP's default config spares Nvidia open source driver from power save:

RUNTIME_PM_DRIVER_BLACKLIST="radeon nouveau amdgpu"

You may try to add the proprietary driver "nvidia"

3 - The code is on GitHub. Serve yourself please.

Last edited by linrunner (2016-11-08 19:35:21)

Offline

#7 2016-11-08 20:39:42

Quardah
Member
Registered: 2014-08-26
Posts: 146

Re: Battery Tresholds?

Hi all.

A friend and i made a handy script which only has bayoff functionnality. It is located here : https://github.com/Quardah/.bin/blob/master/bayoff.sh

Feel free to use and enjoy if you are in my situation (having problems with TLP but like the bayoff function).

Have a nice day!


ThinkPad P16s AMD / KDE

Offline

Board footer

Powered by FluxBB