[TRACKING] Linux battery life tuning

The linuxuprising repository is not working, so I installed via the Python3 instructions at the tlpui Github. (tlpui only has one repository)

Which repository is not working? That might be helpful to know. i.e. What is the url to the repo in question.

2 Likes

I noticed the guide now mentions:

PPD (power-profiles-daemon) (AMD ONLY)
For Framework Laptop 13 AMD Ryzenā„¢ 7040 Series configurations, you will absolutely want to use power-profiles-daemon for the absolute best experience. Do NOT use TLP. Without getting too detailed, there are things happening behind the scenes that require PPD for the best experience for our Linux customers.

@Matt_Hartley, would you be able to elaborate more?

Iā€™ve only ever used TLP (admittedly on Intel systems) and would be interested to learn about the differences for AMD.

2 Likes

I would definitely test this on my own. Power profiles daemon makes a number of seriously questionable assumptions about the rest of the system, that TLP offers control over. Seriously a case of convince me with real world usage.

3 Likes

You, sir, have my attention. Could you elaborate how you managed this? My 12gen F13 does not last more then 3 days when left closed, unused and on battery.

1 Like

I donā€™t claim any credit for my insane sleep performance; itā€™s all Fedora.

Iā€™ve been skeptical of TLP due to bugs on Mint before, but it seems to be working well on F37. Powertop hovers around 4-5W idle with a browser and an electron app open (4x usb-c).

That post above was made in the context of a discussion about a trackpad interrupt issue, which upon further research I do experience. If that gets solved it would make my battery life even better.

Recent use example: took notes on it all day, charged it back up to 100% about 7h later, then put in a gen 1 hdmi expansion card and left it running movies for about 4.5h before it died (forgot to plug it in lol).

Per AMD, directly, use PPD. Thank you - if you choose to deviate, I will not be able to help you.

If using Intel, please use TLP.

7 Likes

Thanks. Do you have a reference? Just curious!

Thatā€™s good to know. Iā€™ve never heard of PPD

Is this the codebase for it?

@Kent_Brockman I suspect itā€™s the ppd thatā€™s installed by default in Fedora:

2 Likes

Thatā€™s one notable difference with my setup. Iā€™ll try removing any non-USB-C cards.

I find auto-cpufreq to be the best battery saving tool right now on 7840 https://github.com/AdnanHodzic/auto-cpufreq.

How does it compare to the stock power profiles daemon on the 7840?

First of all, Iā€™d like to say that I donā€™t personally own a framework laptop, I just share the processor with one.
Still, ppd is horrible for battery for me, I mean like 20-25% waste for 1 hour in light use (browsing, coding etc). Auto-cpufreq was 1.5 to 2 times better for me in this regard.

Iā€™d advise checking if it actually improves battery life on the framework as I have no way of knowing.

+1 for autocpufreq! Great tool to hobble your cpu when on battery, but TLP can do the same thing with a little tinkering.

Iā€™d also like to add that anyone using a custom kernel should be sure to disable any programs such as uksmd from cachyos when on battery. Powertop clued me in and now I save half a watt because itā€™s not telling programs to fix their memory pages.

Good helper rule to run scripts (as root) when attaching or detaching:

# /etc/udev/rules.d/99-attach.rules
# After creating, either reboot or run: sudo udevadm control --reload-rules && sudo udevadm trigger
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0",RUN+="/usr/local/bin/on-ac-detach.sh"
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="1",RUN+="/usr/local/bin/on-ac-attach.sh"

Function to put in your scripts that will run a command as the logged-in user from a root script (good for gsettings, userspace programs, etc):

function runasuser() {
    _display_id=":$(find /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
    _username=$(who | grep "\(${_display_id}\)" | awk '{print $1}')
    _user_id=$(id -u "$_username")
    _environment=("DISPLAY=$_display_id" "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$_user_id/bus")
    sudo -Hu "$_username" env "${_environment[@]}" "$@"
}
5 Likes

Has anyone looked into battery life tuning for the AMD versions, yet?
I upgraded from an i5-1135G7 mainboard to a Ryzen 5 7640U, mostly for the battery life.

However, at least at the moment, itā€™s significantly worse.
I have only changed mainboard and RAM; all other components stayed the same.

Iā€™m looking at an idle power draw of 5-6W, in contrast to 3-4W with the Intel mainboard.
Just web browsing is around 9-11W; previously around 6-7W.
Video playback is the worst, however. Itā€™s using anywhere between 11-13W (Full HD, 30% brightness), which also routinely makes the fan spin up. With my Intel board, I looked at 7-8ish Watts for video playback.
This makes a full battery drain in 4-5 hours, which is pretty short.

As per recommendation, I am using power-profiles-daemon instead of TLP.
All of this is with it set to Power Save.

3 Likes

i bought a new ryzen 5 DIY laptop. iā€™m also hitting about 6W on idle (like, no programs open, just on the desktop). hitting about 10-12W for web browsing, and 18W for video playback (40% brightness).

using PPD on Power Save, fedora 39, 3.03 bios.

Matt said not to use TLP on AMD, but Iā€™m getting such poor battery performance on ppd that I think iā€™m going to try TLP and maybe autocpufreq.

But you are on a recent kernel and stuff right?

Iā€™m on Kernel 6.5.5, but have also tried 6.6.0rc, which makes no difference.
cpupower frequency-info tells me Iā€™m on amd-pstate-epp, which, to my knowledge, is the correct driver.

1 Like

Very similar for me on kernel 6.5.9-arch2-1. A bit lower on video playback in firefox, 14-16W. PPD or TLP does not make a whole lot of difference, but I decided on PPD as recommended. GPU and CPU seem to clock down correctly, removing all extension cards does not change the power use. My installation is a swaywm desktop with pretty minimal background tasks running.
Maybe SSDs not entering power save modes could be a factor? I do not know how to check that. Iā€™m currently using a WD SN850X.

Edit:
Found lspci -vv | grep 'ASPM.*abled;'in the Arch wiki.

echo powersupersave > /sys/module/pcie_aspm/parameters/policy

turns some of the ā€œDisabledā€ entries into ā€œEnabledā€ and that seems to reduce power use a bit. This is not persistent between reboots and I do not know if it has negative implications.