linrunner / TLP

TLP - Optimize Linux Laptop Battery Life
https://linrunner.de/tlp
GNU General Public License v2.0
2.51k stars 129 forks source link

Different profiles for different power supplies? #345

Closed jbaiter closed 6 years ago

jbaiter commented 6 years ago

I have a Thinkpad T480s which uses USB-C/USB-PD for charging. Depending on the circumstances, I either use a 65W (at home), 45W (on the road) or 30W (powerbank) power supply. It would be great if I could declare a profile for each of these power supplies and adjust CPU frequencies and charging thresholds (e.g. no charging on powerbank) with TLP.

On my T480s, there is an ACPI method to read the wattage the USB-C power supply declares: \_SB.PCI0.LPCB.EC.HWAT, other USB-C powered Thinkpads should have something similar, since it's also displayed in Lenovo Vantage on Windows.

linrunner commented 6 years ago

Hi,

your proposal for additional profiles has advantages but also a major downside:

I guess the core of your requirement is to ignore specific power supplies (e.g. the powerbank) and apply BAT settings for them.

A simpler approach could be to have a POWER_SUPPLY_BLACKLIST.

linrunner commented 6 years ago

ps. I won't implement something like "stop charging". That would be in the same category as "battery balancing", see FAQ.

jbaiter commented 6 years ago

Thank you for the feedback! You're right about the POWER_SUPPLY_BLACKLIST, this would basically solve the use case. But I guess that's a pretty narrow use case to introduce a new configuration variable that's not exactly self-explanatory. Made even more difficult by the fact that different chargers can only be differentiated by the wattage they declare, which can only be detected on some newer Thinkpad models.

I implemented the behavior now with a small script that puts TLP into battery mode and sets the powerbank-specific charging thresholds, triggered by an udev rule.