Framework 16 battery drain whilst asleep

Which Linux distro are you using? Ubuntu

Which release version? 24.04.1 LTS
(if rolling release without a release version, skip this question)

(If rolling release, last date updated?)

Which kernel are you using? 6.8.0-45-generic

Which BIOS version are you using? 3.03 (I think)

Which Framework Laptop 16 model are you using? AMD Ryzen™ 7040 Series - batch 10

I have my laptop configured to sleep when the lid is closed. I think it does go into some form of sleep (the display switches off) but it wakes up quickly when I open the lid. Reconnecting to wifi takes way longer than I’d expect (maybe a minute or so) but that’s not my biggest gripe.

My biggest gripe is how quickly the battery drains whilst “sleeping”. I reckon it’ll go from close to 100% charged to flat in under 24 hours. I seem to remember investigating this previously and found something about AMD not supporting deep sleep mode.

I downloaded & ran amd-s2idle/scripts/amd_s2idle.py at master · superm1/amd-s2idle · GitHub … its output implies a firmware setting I’m missing:

Debugging script for s2idle on AMD systems
:computer: Framework Laptop 16 (AMD Ryzen 7040 Series) (16in Laptop) running BIOS 3.3 (03.03) released 03/27/2024 and EC unknown
:penguin: Ubuntu 24.04.1 LTS
:penguin: Kernel 6.8.0-45-generic
:battery: Battery BAT1 (NVT FRANDBA) is operating at 103.99% of design
Checking prerequisites for s2idle
:white_check_mark: Logs are provided via systemd
:white_check_mark: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (family 19 model 74)
:white_check_mark: ASPM policy set to ‘default’
:white_check_mark: SMT enabled
: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.82.0)
:white_check_mark: USB4 driver thunderbolt bound to 0000:c3:00.5
:white_check_mark: USB4 driver thunderbolt bound to 0000:c3:00.6
:white_check_mark: GPU driver amdgpu bound to 0000:c1:00.0
:x: System isn’t configured for s2idle in firmware setup
:white_check_mark: NVME Samsung Electronics Co Ltd NVMe SSD Controller S4LV008[Pascal] is configured for s2idle in BIOS
:white_check_mark: GPIO driver pinctrl_amd available
:vertical_traffic_light: Device firmware checks unavailable without fwupd gobject introspection
Your system does not meet s2idle prerequisites!
Explanations for your system
:vertical_traffic_light: The system hasn’t been configured for Modern Standby in BIOS setup
AMD systems must be configured for Modern Standby in BIOS setup
for s2idle to function properly in Linux.
On some OEM systems this is referred to as ‘Windows’ sleep mode.
If the BIOS is configured for S3 and you manually select s2idle
in /sys/power/mem_sleep, the system will not enter the deepest hardware state.

However, I can’t see anything in the BIOS that looks related to “modern standby”.

Has anyone solved this problem? Am I missing something obvious?

Post your report somewhere (the text file it saves is different than what you see in the console).

Thanks, I’ve uploaded it to Google drive: s2idle_report-2024-10-07.txt - Google Drive

Drop your modifications to the kernel command line and try the script again.

Did you mean drop mem_sleep_default=deep from GRUB_CMDLINE_LINUX_DEFAULT or something else? In any case, I’ve done that and the results are here:

Doesn’t look effective. You should need to run update-grub and reboot.

Ah, thanks. I’ve done that and got to the stage of running sleep cycles. Output:

Debugging script for s2idle on AMD systems
:computer: Framework Laptop 16 (AMD Ryzen 7040 Series) (16in Laptop) running BIOS 3.3 (03.03) released 03/27/2024 and EC unknown
:penguin: Ubuntu 24.04.1 LTS
:penguin: Kernel 6.8.0-45-generic
:battery: Battery BAT1 (NVT FRANDBA) is operating at 103.99% of design
Checking prerequisites for s2idle
:white_check_mark: Logs are provided via systemd
:white_check_mark: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (family 19 model 74)
:white_check_mark: ASPM policy set to ‘default’
:white_check_mark: SMT enabled
: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.82.0)
:white_check_mark: USB4 driver thunderbolt bound to 0000:c3:00.5
:white_check_mark: USB4 driver thunderbolt bound to 0000:c3:00.6
:white_check_mark: GPU driver amdgpu bound to 0000:c1:00.0
:white_check_mark: System is configured for s2idle
:white_check_mark: NVME Samsung Electronics Co Ltd NVMe SSD Controller S4LV008[Pascal] is configured for s2idle in BIOS
:white_check_mark: GPIO driver pinctrl_amd available
:vertical_traffic_light: Device firmware checks unavailable without fwupd gobject introspection
How long should suspend cycles last in seconds (default 10)? 1200
How long to wait in between suspend cycles in seconds (default 4)?
How many suspend cycles to run (default 1)? 2
Running 2 cycles (Test finish expected @ 2024-10-09 23:52:53.468352)
Suspend cycle 1: Started at 2024-10-09 23:12:47.481838 (cycle finish expected @ 2024-10-09 23:32:51.481891)
Results from last s2idle cycle
○ Suspend count: 1
○ Hardware sleep cycle count: 1
○ Wakeup triggered from IRQ 9: ACPI SCI
○ Woke up from IRQ 9: ACPI SCI
○ gpe0B increased from 204 to 226
:white_check_mark: Userspace suspended for 0:20:02.201474
:white_check_mark: In a hardware sleep state for 0:19:58.635559 (99.70%)
:battery: Battery BAT1 lost 22000 µAh (0.39%) [Average rate: 0.01A]
Suspend cycle 2: Started at 2024-10-09 23:32:51.687673 (cycle finish expected @ 2024-10-09 23:52:55.687706)
Results from last s2idle cycle
○ Suspend count: 1
○ Hardware sleep cycle count: 1
○ GPIOs active: [‘84’]
○ Wakeup triggered from IRQ 9: ACPI SCI
○ Woke up from IRQ 9: ACPI SCI
○ gpe0B increased from 226 to 248
:white_check_mark: Userspace suspended for 0:20:01.998700
:white_check_mark: In a hardware sleep state for 0:19:58.305419 (99.69%)
:battery: Battery BAT1 lost 17000 µAh (0.30%) [Average rate: 0.01A]

Full log: s2idle_report-2024-10-09 (1).txt - Google Drive

99.something% sounds good in theory but 0.3% - 0.39% battery loss in 20 minutes doesn’t seem great, that’s ~1% per hour meaning full battery drain in ~4 days. That feels slower than I’ve seen so far (I reckon I’ve seen losses of ~70% overnight but I’ll need to experiment to check that) but it’s way faster than I’d expect (my old Macbook Pro would retain its charge for … weeks?).

My battery is at 50% right now so after posting I’ll close the lid … and see where we are in the morning!

It takes time to get in and out of the state so with really short measurements it can look worse than real ones.

If you run the script for minutes or hours you’ll get more representative numbers.

Ok ~9h later the battery has dropped 9% … ~1%/hr which tallies with what I saw in the s2idle report. I don’t think that’s very good. What can I do to improve that power loss?

I ran the script with 20 minute suspend, 4 second gap, 2 cycles to get that ~1% estimate.

Overnight I just left the lid closed (which I have set up to send the laptop to sleep) and got ~ the same drain.

Over s2idle if you’re hitting the hardware sleep state only encountered one hardware sleep cycle, and it was for the majority of the time you’re at the most that can be optimized from a pure software perspective.

The times that you can still optimize from software is when that residency is low or it keeps waking from hardware sleep multiple times.

If there are any other improvements to be made for this design they would be firmware or hardware changes.

Hardware changes - seem limited to … none … given it’s a FW laptop and there are no h/w options to improve sleep time AFAIK.

Firmware changes … have there been any to improve sleep time?

Is this the sort of performance everyone using Ubuntu is getting? ISTR someone running Windows is getting much better performance. Something about Linux not supporting deep sleep on AMD whereas Windows does :person_shrugging:? Seems rather sucky…

I don’t expect any better numbers for Windows. They both go into the same sleep mode.

Typically windows actually wakes more frequently due to something called “connected standby”.

The major difference with windows is that it will eventually hibernate if you’re in suspend a while.

Linux doesn’t do this by default, but you can configure systemd to do it if you want.

I ran the same test: two cycles of 20 minutes each. I get slightly higher readings.

🔋 Battery BAT1 lost 37000 µAh (0.64%) [Average rate: 0.01A]
🔋 Battery BAT1 lost 30000 µAh (0.52%) [Average rate: 0.01A]

The nominal voltage of the framework 16 battery is 15.48 V, according to:


If we assume that the laptop was operating at approximately nominal voltage, we should be able to calculate watts:

Using the second reading as an example:
30000 µA * hr / 20 minutes * 60 minutes/hr == 90000 µA
90000 µA / 1000000 µA/A = 0.09 A
0.09 A * 15.48V == 1.3932 W

…but the reading from the script seems to have two significant digits, so it’s best to round that off to 1.4 W.

The first reading calculates to 1.7 W.

This is pretty consistent with the AC power draw I read at the wall while the laptop is suspended and the battery is fully charged. I read 1.3 +/- 0.3 W at the wall (the reading fluctuates).

Some variance of power draw could be due to the type and amount of RAM present. While the laptop is suspended, the RAM must stay active in order to not lose data.

Searches tend to bring up this thread:

I really don’t know what is typical for a laptop; this doesn’t seem to be widely published. Values I found are:
1 to 3 W: Deciding Between Idle State, Sleep Mode, and Shutdown: What's Best for Your PC? - MajorGeeks
1 to 2 W: 3 Myths About Computers and Electricity | IGS

So maybe what you’re seeing is just normal.

More data from other laptops would be interesting.

My old Dell Latitude E5520 with 8 GB of RAM uses 1.2 to 1.3 W at the wall for suspend-to-ram, and 6.7-6.8 W for suspend-to-idle.

-Corey

It is a little annoying that RAM chip manufactures do not mention power draw figures. It would be a lot easier to compare from datasheets then.

@Corey_Hickey “What’s typical for a laptop?” … I don’t know either so I’m simply going by my old (2014?) Macbook Pro where I don’t remember it losing any significant battery whilst the lid was closed and it didn’t take a super long time to wake up. But they’re pretty vague memories right now, I guess the point is I didn’t do anything special, its power retention was good out of the box. The chromebook I use for work also doesn’t seem to lose much power overnight but then I pay less attention to it because it’s plugged in regardless of whether I’m working from the office or home.,

Whereas Framework + Ubuntu the power retention out of the box is … well, rubbish.

But I think I’ve now got to a point where I’m happy with it. Not quite perfect though. I’ve got hibernate working (overnight the battery lost <1% so I anticipate minimal losses over a week or two). The key was to disable secure boot … which took me ages to find. Hitting F12 during boot took me to a menu where I couldn’t find any secure boot option, only boot order. Until I stumbled upon something that says you need to hit F2 during boot. Bingo! (WHY is it like this I wonder?!).

Anyway, secure boot disabled, swap partition set up and hibernate works. Now I just need to figure out suspend-then-hibernate (I’ve got “Enable hibernate after suspend” ticked in the poower management app but no indication of time the laptop remains suspended before it hibernates. Coming out of hibernation takes a little while, I haven’t timed it but 10-15 seconds sounds about right but then I guess 64Gb of memory takes a while to repopulate. Although I’m only using ~4Gb atm so maybe there’s some optimization that’s possible (my SSD is rated at 3Gb/sec IIRC … maybe I should test what I actually get :laughing:).

@James3 I agree. According to the manufacturer (Kingston) my RAM “draws 1.1V” but of course that’s not a power figure so is pretty useless on its own. My tests show the laptop needs ~1-1.6W whilst suspended, I assume that’s mostly for the RAM but :person_shrugging:

And now I’ve got hibernate after suspend sorted - just needed to edit /etc/systemd/sleep.conf :smiley:

1 Like