[TRACKING] Linux battery life tuning

Got around to try mesa git (off the aur), in idle and kodi hw accelerated video playback unfortunately no change.

With my best tweaks it still uses about 2W more for hw decoding 720p and about 3.5W more for 4k 60 than my old 8th gen intel thinkpad (with about equal idle powers).

FYI have a linux kernel branch with all the AMD 13 Framework patches I could find… seems pretty stable to me, but still around 5W idle with screen on, obviously for advanced users… hopefully all this will be merged in soon. Based on 6.7-rc3.

5 Likes

Did you manage to find the commit that breaks als sensor in 6.7 and revert it?

I did not.

On my 7640u I am quite satisfied with the battery life during work.
But I have a problem with the power consumption during sleep.

24hrs ago I closed the lid, at 68%.
Now I open up my laptop, plug in a charger, and it’s at 0%.
Linux mint, hybrid-sleep enabled.

What should I do?
Because that is just simply not acceptable at all :slight_smile:
It basically makes my laptop incredibly unreliable; since I am used to always opening up a laptop and having a decent charge available (even after weeks, due to hybrid)
My 12 year old macbook air loses only like 15-10% max over a full day in sleep, probably even less.

2 Likes

Run the AMD s2idle report and fix whatever it says is wrong in your system.

If nothing is reported wrong, double check you have all the cards in suggested slots from framework guidance.

5 Likes

Wow!!
I ran the script.
All green except for the rtc_cmos.
I have added the kernel parameter rtc_cmos.use_acpi_alarm=1

Previously: Lost 40% battery in 1 night.
Currently: Lost 2% battery in 1 night.
:tada:

13 Likes

Hi Mario,

I’ve just run this and come across the following:

ravi@ravi-fw13:~/Downloads$ sudo ./amd_s2idle.py
[sudo] password for ravi:
Location of log file (default s2idle_report-2023-12-18.txt)?
Debugging script for s2idle on AMD systems
:computer: Framework Laptop 13 (AMD Ryzen 7040Series) (Laptop) running BIOS 3.3 (03.03) released 10/17/2023 and EC unknown
:penguin: Kernel 6.6.7-1-siduction-amd64
:battery: Battery BAT1 ( ) is operating at 102.07% of design
Checking prerequisites for s2idle
:vertical_traffic_light:Logs are provided via dmesg, timestamps may not be accurate over multiple cycles
:white_check_mark: AMD Ryzen 7 7840U w/ Radeon 780M Graphics (family 19 model 74)
:white_check_mark: LPS0 _DSM enabled
:white_check_mark: ACPI FADT supports Low-power S0 idle
:white_check_mark: HSMP driver amd_hsmp not detected (blocked: False)
:white_check_mark: PMC driver amd_pmc loaded (Program 0 Firmware 76.70.0)
:white_check_mark: USB4 driver thunderbolt loaded
:white_check_mark: GPU driver amdgpu available
:x: GPU firmware missing
:white_check_mark: System is configured for s2idle
:white_check_mark: NVME Shenzhen Longsys Electronics Co., Ltd. is configured for s2idle in BIOS
:white_check_mark: GPIO driver pinctrl_amd available
Your system does not meet s2idle prerequisites!
Explanations for your system
:vertical_traffic_light: AMDGPU firmware is missing
The amdgpu driver loads firmware from /lib/firmware/amdgpu
In some cases missing firmware will prevent a successful suspend cycle.
Upgrade to a newer snapshot at kernel-firmware / Linux Firmware · GitLab
amdgpu 0000:c1:00.0: Direct firmware load for amdgpu/gc_11_0_1_mes_2.bin failed with error -2
For more information on this failure see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053856

I have gone to gitlab but I can’t see how to install a newer snapshot. I am using siduction (a Debian Sid based rolling release distro and I have non-free enabled). I have firmware-amd-graphics version 20230625-1 which seems quite old compared to the snapshots on gitlab. I was wondering if you know what the command is to install to an updated snapshot version from gitlab? I’m googling this but can’t seem to figure it out on my own.

I experimented a bit with sleep to hibernate and it does weird things.

Sleep to hibernate activated, after 90 minutes, close lid with 85% at 2 in the night, open it at 11 and its down to 30%, the script reports that apparently my samsung nvme isnt configured for sleep state. I tried to reproduce that by lowering the sleep to hibernate option to 1 minute but this time report says all green. Manually entering hibernate brought me once to a point where the script says that no sleep mode was achived. But the second time around it did not.

I think I had tlp and ppd running at the same time which probably conflicted somehow, for now, whatever i have set seems to properly sleep, in a timed test i lost 1% of battery in exactly one hour. That seems fine

There’s a newer snapshot in debian testing I seem to recall hearing. Maybe try that.

If the script changes output for NVME changes then this is a false negative. If you’re using the dmesg logger instead of systemd then the ring buffer wrapped from too many messages.

Now that you say that…yes i am stupid, i mentioned that the laptop was on for a long time and i think there was an error message around the ringbuffer issue. Thanks for the clarification!

FYI, powertop is not building on Ubuntu 22.04.

See Build error: configure: error: libtracefs is required but was not found · Issue #124 · fenrus75/powertop · GitHub

I ran the AMD s2idle script because I was also having issues where my laptop unpredictably loses all battery during sleep, especially when the lid is closed. I’m using powertop and the optimisations from this thread and that has been great for normal battery use but sleep is just broken, so broken! And the script gives me many errors (on Debian 22.04.3 LTS) that I don’t know how to fix – why am I having this and not others on a new 13" Framework (from mid-last year):

Debugging script for s2idle on AMD systems
:computer: Framework Laptop (13th Gen Intel Core) (13in Laptop) running BIOS 3.3 (03.03) released 04/07/2023 and EC unknown
:penguin: Ubuntu 22.04.3 LTS
:penguin: Kernel 6.5.0-15-lowlatency
:battery: Battery BAT1 (NVT Framewo) is operating at 94.54% of design
Checking prerequisites for s2idle
:white_check_mark: Logs are provided via systemd
:white_check_mark: 13th Gen Intel(R) Core™ i5-1340P (family 6 model ba)
:x: This tool is not designed for parts from this CPU vendor
:white_check_mark: LPS0 _DSM enabled
:white_check_mark: ACPI FADT supports Low-power S0 idle
:white_check_mark: HSMP driver amd_hsmp not detected (blocked: False)
:x: PMC driver amd_pmc did not bind to any ACPI device
:white_check_mark: USB4 driver thunderbolt loaded
:x: GPU driver amdgpu not loaded
:x: System isn’t configured for s2idle in firmware setup
:white_check_mark: NVME Sandisk Corp is configured for s2idle in BIOS
:x: GPIO driver pinctrl_amd not loaded

What if sleep.conf is totally commented out? It looks like Ubuntu uses the settings GUI to set these, I’m not sure if there’s two conflicting systems or something is out of sync? A quick look on the internet hasn’t helped clarify that unfortunately

Please check the output:

Debugging script for s2idle on AMD systems

and

:computer: Framework Laptop (13th Gen Intel Core)

You are running this AMD script (meant for the Ryzen platform) on an Intel machine - the results will not be meaningful.

oh duh right! So there’s none for Intel?

I re-ran the s2idle script, just for fun.
Previous time (as mentioned in my replies earlier in this thread) it worked fine.
Now it does not, and complains about a tainted kernel and problems with s2idle.

My simple question is: does this mean that I have a powermanagement issue now?
Or is that not the case.

Previous time I ran this, and it indicated I should add a kernel paramter. Which I did, and it solved my suspend-then-sleep issue.
But now, a few months later, rerunning this script I get worried something is wrong.
The only thing that might be different is that I installed an Intel ax210 which replaces the stock Mediatek.

If it’s complaining your kernel is tainted, look at the logs for why it got tainted and cross reference to tainted kernel documentation:
Tainted kernels — The Linux Kernel documentation

It doesn’t necessarily mean there is a problem with power management, but if you have one then it’s the first thing you should look at solving.

1 Like

Does it install from the jammy repo?

sudo apt install powertop