[TRACKING] Linux battery life tuning

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.

I did a lot of testing over the last few days (TLP, auto-cpufreq, PPD, just Kernel) . Summing up i noticed a much higher battery drain of the AMD 7040 compared to my Core i7 (13 gen) but i managed to reduce the power consumption on battery significantly.

First of all beside of firmware problems (wifi needs > 60s to initialize) i noticed that the AMD wifi card uses a lot more energy (+0,5W in Idle and 1-2W under load) than my “old” Intel AX210. I removed the AMD wifi chip and replaced it with the AX210 on my AMD7040 mainboard with no issues so far and the benefit of battery saving.

My test setting was always: 1.) idle (20% Backlight; no running apps; after 2 mins); 2.) light browsing (Firefox on different websites); 3.) writing a text in Libreoffice; 4.) watching Youtube-Video (1080p; av1).
I’m using Manjaro Gnome with Kernel 6.6.0.

Here are my results:

  • just Kernel: 1.) 6-7W; 2.) 10-12W; 3.) 8-10W; 4.) 16-20W

  • PPD (power saver): a little bit worse than just Kernel, so i can’t understand the recommendation of that daemon?

  • auto-cpufreq alone(standard config): 1.) 5-6W; 2.) 8-11W; 3.) 7-9W 4.) 14-18W

  • TLP and auto-cpufreq in combination (all CPU optimizations must be commented in TLP!): 1.) 4-5W; 2.) 5-8W; 3.) 5-8W; 4.) 11-15W

I have the best results with TLP and auto-cpufreq in combination. After two days of heavy using my Framework with that setting i experienced no major issues so far. The only thing is a weird behavior after suspend that shows up occasionally. The cpu then tends to throttle under load. A reboot resolves that. One setting in TLP that reduces the power consumption above all was the powersupersave of pcie (ASPM).

As I’m writing this text in Firefox my power consumption is always between 5-6W which is really good…for now I’m satisfied.

8 Likes