Installation Steps for tpacpi and acpi-call - Device: Thinkpad x260 - Setting Charge Threshold of 80%

Hi all,

I’m having a bit of trouble understanding what and how to get tpacpi and acpi-call setup and installed. I’ve searched the forum and haven’t been able to find a set of instructions and the Github instructions are a bit hard to comprehend at my current level of skill. The only information I can seem to see is for the well established tp_smapi which the wiki claims is not compatible with my device.

My aim is to make both my laptop’s batteries(internal & detachable) only charge to 80% maximum to increase their usable lifespans.

I’ve installed TLP using "pacman -S " from the official repo’s but I can’t seem to figure out how to get acpi-call and tpacpi installed and configured.

Thanks for reading guys, any help is appreciated.

You only need one and that should be tp_smapi.

I did not intall them - but if you search for “tpacpi-bat” and isntall that it will install “perl” and “acpi_call” as dependencies.

Are you sure your laptop isn’t yet working with tp_smapi? try if TLP actually can set the thresholds

Of course it does or I would not have mentioned it. I use an x201 and x1 and t420. And I do use tlp on all my thinkpads. Also, it depends on the kernel version you are using. Which module to install.

https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html

1 Like

I was typing slow - got distracted while doing so and did not see your reply :wink: anyhow that question wasn’t directed at you (was to encourage OP to try it with tp_smapi) - I have been, and I use thinkpads for the past 14 years - thus why I am in doubt that tp_smapi would -not- work.

Not all thinkpads posses the hardware required to support that feature. If the wiki claims your device is not compatible, then it is not…

With that said, for laptops that are not supported by smapi, there are these available:
tpacpi-bat
acpi_call-dkms

1 Like

For Thinkpad battery charge thresholds:

  1. Install linux*-acpi_call to match your current kernel.
  2. Edit /etc/default/tlp and set the charge start and stop thresholds.
  3. Restart TLP or reboot.
  4. Done.

This works on my X61 and X230.

You may need to undo any other customisation you have made earlier in the thread. You don’t need tp_smapi for newer Thinkpads, of which the X260 is one.

Also, try a newer kernel if 4.14 doesn’t work as expected (it worked for my TPs but then they’re relatively old machines now).

Hi all, thank you for all the replies and the help.

I’ve managed to get the tpacpi-bat installed from the main repo’s and I think it installed all of it’s dependencies so as far as I can tell I reckon that TLP is working after trying out the instructions @jonathon provided.

/etc/default/tlp already contained the following:
[spoiler]

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
# required). Charging starts when the remaining capacity falls below the
# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
# Main / Internal battery (values in %)
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80
# Ultrabay / Slice / Replaceable battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80

[/spoiler]
So i reckon I’m good to go. Testing it now, Ill run both batteries below the above thresholds and if they charge up to what’s stated then everything’s perfect.

Thanks for help again guys, i’ll be sure to throw up the yay or nay on if it’s working.

I’ll leave my failed bbcode attempt in for humor sake :slight_smile:

Remember to uncomment these so they take effect. :wink:

1 Like

Good point, I missed that one.

However even after altering that and draining the device down to about 80% it looks to still be charging up and on-wards towards 90% so I tried some troubleshooting steps that I could think of:
-Device rebooted.
-Ensured that tpacpi-bat was present in /usr/bin
-Ensured that " sudo tlp start " displayed no errors when run. Notification about AC or battery mode displayed without issue.
-Reinstalled acpi_call from offcial repo’s.
-Ensured that the below required code was uncommented.

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
# required). Charging starts when the remaining capacity falls below the
# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
# Main / Internal battery (values in %)
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
# Ultrabay / Slice / Replaceable battery (values in %)
START_CHARGE_THRESH_BAT1=75
STOP_CHARGE_THRESH_BAT1=80

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

Lines that were uncommented:
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
START_CHARGE_THRESH_BAT1=75
STOP_CHARGE_THRESH_BAT1=80
RESTORE_THRESHOLDS_ON_BAT=1

I’m still at a loss as to what the issue is.

Any help would again be appreciated.

Edit: Included that I rebooted the device.

These aren’t in my set of steps:

The set of steps I wrote down were the minimum amount of effort required to get charging thresholds working on the two Thinkpads I own. If you add extra variables (packages, configuration, etc.) then you’re customising beyond what I needed to do.

You might check the acpi_call kernel module is loaded, e.g.

lsmod | grep acpi

I checked my kernel version and it’s indeed 4.14 which as you said previously could be the issue.
Also I was under the impression that tpacpi was a dependency of TLP.

After running lsmod | grep acpi I got:

thinkpad_acpi         102400  1
nvram                  16384  1 thinkpad_acpi
snd                    94208  17 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,thinkpad_acpi,snd_soc_core,snd_pcm
rfkill                 28672  8 bluetooth,thinkpad_acpi,cfg80211
led_class              16384  3 input_leds,iwlmvm,thinkpad_acpi
video                  45056  2 thinkpad_acpi,i915

So it looks like they’re there but I’m not sure if that means they’re active.

Edit: Forgot a ]

Ok guys, again thank you for all the help because I’ve managed to get it TLP partially working by some strange circumstance.

The detatchable BAT1 no appears to automatically stop charging even though it’s at 92%.
The internal BAT0 still acts like normal and charges past the threshold.

Some strange returns still come out of TLP despite one of them working
setcharge :

[sean@beff ~]$ sudo tlp setcharge 75 80 BAT0
Error: ThinkPad battery features not available.
[sean@beff ~]$ sudo tlp setcharge 75 80 BAT1
Error: ThinkPad battery features not available.

I’m not sure how one of them is working at all like this and the other isn’t so I tried the following to see what I can find out.
sudo tlp stat | grep BAT :

DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_BAT=60
CPU_HWP_ON_BAT=balance_power
SCHED_POWERSAVE_ON_BAT=1
ENERGY_PERF_POLICY_ON_BAT=power
DISK_APM_LEVEL_ON_BAT="128 128"
SATA_LINKPWR_ON_BAT="med_power_with_dipm max_performance"
PCIE_ASPM_ON_BAT=powersave
RADEON_POWER_PROFILE_ON_BAT=low
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
WIFI_PWR_ON_BAT=on
SOUND_POWER_SAVE_ON_BAT=1
BAY_POWEROFF_ON_BAT=0
RUNTIME_PM_ON_BAT=auto
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
START_CHARGE_THRESH_BAT1=75
STOP_CHARGE_THRESH_BAT1=80
RESTORE_THRESHOLDS_ON_BAT=1
/sys/class/power_supply/BAT0/manufacturer                   = SONY
/sys/class/power_supply/BAT0/model_name                     = 45N1111
/sys/class/power_supply/BAT0/cycle_count                    = (not supported)
/sys/class/power_supply/BAT0/energy_full_design             =  23200 [mWh]
/sys/class/power_supply/BAT0/energy_full                    =  21570 [mWh]
/sys/class/power_supply/BAT0/energy_now                     =  18900 [mWh]
/sys/class/power_supply/BAT0/power_now                      =      0 [mW]
/sys/class/power_supply/BAT0/status                         = Unknown
/sys/class/power_supply/BAT1/manufacturer                   = SANYO
/sys/class/power_supply/BAT1/model_name                     = 45N1777
/sys/class/power_supply/BAT1/cycle_count                    = (not supported)
/sys/class/power_supply/BAT1/energy_full_design             =  71280 [mWh]
/sys/class/power_supply/BAT1/energy_full                    =  69130 [mWh]
/sys/class/power_supply/BAT1/energy_now                     =  62430 [mWh]
/sys/class/power_supply/BAT1/power_now                      =   6200 [mW]
/sys/class/power_supply/BAT1/status                         = Discharging

Any input would be appreciated again guys, thanks.

Ok false alarm, not even partially working :frowning:

Can you load the acpi_call kernel module,

sudo modprobe -v acpi_call 

?

There’s other things worth reading in the TLP documentation: https://linrunner.de/en/tlp/docs/tlp-faq.html#battery

That was a great help now we’re getting somewhere with the output being:

[sean@beff ~]$ sudo modprobe -v acpi_call
modprobe: FATAL: Module acpi_call not found in directory /lib/modules/4.14.67-1-MANJARO

I’m positive I installed it and after searching the tlp documentation I ran this command:

[sean@beff ~]$ sudo tlp-stat -b
--- TLP 1.1 --------------------------------------------

+++ ThinkPad Battery Features
tp-smapi   = inactive (unsupported hardware)
tpacpi-bat = inactive (kernel module 'acpi_call' not installed)

+++ Battery Status
/sys/class/power_supply/BAT0/manufacturer                   = SONY
/sys/class/power_supply/BAT0/model_name                     = 45N1111
/sys/class/power_supply/BAT0/cycle_count                    = (not supported)
/sys/class/power_supply/BAT0/energy_full_design             =  23200 [mWh]
/sys/class/power_supply/BAT0/energy_full                    =  21570 [mWh]
/sys/class/power_supply/BAT0/energy_now                     =  21570 [mWh]
/sys/class/power_supply/BAT0/power_now                      =      0 [mW]
/sys/class/power_supply/BAT0/status                         = Full

Charge                                                      =  100.0 [%]
Capacity                                                    =   93.0 [%]

+++ Battery Status
/sys/class/power_supply/BAT1/manufacturer                   = SANYO
/sys/class/power_supply/BAT1/model_name                     = 45N1777
/sys/class/power_supply/BAT1/cycle_count                    = (not supported)
/sys/class/power_supply/BAT1/energy_full_design             =  71280 [mWh]
/sys/class/power_supply/BAT1/energy_full                    =  69070 [mWh]
/sys/class/power_supply/BAT1/energy_now                     =  64760 [mWh]
/sys/class/power_supply/BAT1/power_now                      =   5055 [mW]
/sys/class/power_supply/BAT1/status                         = Discharging

Charge                                                      =   93.8 [%]
Capacity                                                    =   96.9 [%]

+++ Charge total                                            =   95.2 [%]

So as per the instructions in the documentation I tried to again see what acpi_call packages were available:

[sean@beff ~]$ sudo pacman -Q acpi_call
linux316-acpi_call 1.1.0-44
[sean@beff ~]$ uname -r
4.14.67-1-MANJARO

If I’m reading this correctly that means that only acpi_call for linux kernel 3.16 is available?
And that I need to find out how to install the 4.14 or the 4.17 version assuming 4.14 doesn’t work like you mentioned having issues with yourself?

Yes. You have to install the module for the kernel(s) you’re running, e.g.

sudo pacman -S linux414-acpi_call linux417-acpi_call

(i.e. step 1)

Note: kernel 4.17 is now EOL so you should switch up to 4.18.

That worked, I thought that since pacman -Q was only giving me one giving me one package for acpi_call that that must be the one I needed.

Thanks for all the help @jonathon , you’ve been more than patient with this noob trying to figure things out :smile:

At least I’ve learned now that pacman -Q won’t always tell you if the package you need is available or not, I might try a GUI based package manager in future.

Also I only installed 4.17 to see if changing kernels would solve the issue since you mentioned having issues with 4.14 and TLP.
Whatever the latest stable LTS kernel release is would be something I’d rather use.

That tells you what packages you have installed locally. -S will operate on the remote database content (i.e. pacman -Ss will search the repos).

Forum kindly sponsored by