DEV Community 👩‍💻👨‍💻

Cover image for Fix suspend issues on Dell 7405 2-in-1
epassaro
epassaro

Posted on • Updated on

Fix suspend issues on Dell 7405 2-in-1

UPDATE SEPTEMBER 2021. S3 suspension was fixed on kernel 5.14 and this guide works again.

UPDATE MARCH 2021. A patch to enable S0ix state on AMD Renoir hardware has been merged into kernel 5.11, but it does not work at all. In fact, this patch also broke the method to enable the S3 suspension described in this article. To get the latest updates about this issue follow the discussion on GitLab.

If you are a GNU/Linux user and bought this laptop (or any other laptop with Ryzen 4700U) recently , probably you found suspend to RAM does not work at all.

The root of all evil

Due to the new Windows "modern/connected standby" (S0ix) the good old sleep to RAM (S3) is disabled in some laptops. We need to patch our DSDT to make S3 available again.

AMD support for S0ix will be available soon, making this guide unnecessary (unless you want to save battery or have a decent and reliable sleep mode). Anyways, S0ix is garbage and people that designed it should have a place reserved in hell.

First of all, check S3 state and deep sleep mode are not available:

$ sudo dmesg | grep -i acpi | grep supports
[    0.357470] ACPI: (supports S0 S4 S5)
Enter fullscreen mode Exit fullscreen mode
$ cat /sys/power/mem_sleep
[s2idle]
Enter fullscreen mode Exit fullscreen mode

What's DSDT?

From the ArchLinux Wiki:

DSDT (Differentiated System Description Table) is a part of the ACPI specification. It supplies information about supported power events in a given system. ACPI tables are provided in firmware from the manufacturer. A common Linux problem is missing ACPI functionality, such as: fans not running, screens not turning off when the lid is closed, etc. This can stem from DSDTs made with Windows specifically in mind, which can be patched after installation. The goal of this article is to analyze and rebuild a faulty DSDT, so that the kernel can override the default one.

Basically a DSDT table is the code run on ACPI (Power Management) events.

Step 0: Use a recent Linux Kernel

Not directly related to the issue, but it's worth doing.

AMD Ryzen 4000 mobile processors require Linux Kernel v5.8 or above to perform correctly.

At the moment of writing this post, there are a few options to get this kernel: use openSUSE Tumbleweed, or installing a mainline kernel on Ubuntu. Also, it's supossed with the release of Ubuntu 20.04.2 (scheduled for October 2020) the kernel 5.8 will arrive to the Ubuntu HWE stack.

Step 1: Extract and decompile DSDT

Get acpidump and iasl, provided by the acpica package. Then, dump all your ACPI files into a directory:

$ mkdir acpi
$ cd acpi
$ sudo acpidump -b
Enter fullscreen mode Exit fullscreen mode

And decompile the DSDT:

$ iasl -e *.dat -d dsdt.dat
Enter fullscreen mode Exit fullscreen mode

This command produces a source file named dsdt.dsl.

Step 2: Recompile DSDT and examine errors

IMPORTANT: I updated the BIOS to v1.3.0 (Sep 18, 2020) immediately after purchasing this laptop. Errors and line numbers may vary depending on your BIOS version.

iasl -tc dsdt.dsl &> iasl_errors.txt
Enter fullscreen mode Exit fullscreen mode

Look for errors in iasl_errors.txt with your text editor. For BIOS v1.3.0 you should have just three identical error messages pointing to lines 3965, 4002 and 4030.

Open dsdt.dsl, look for those lines and replace:

Return (Zero)
Enter fullscreen mode Exit fullscreen mode

with:

Return (ToBuffer(Zero))
Enter fullscreen mode Exit fullscreen mode

Then, re-run:

iasl -tc dsdt.dsl &> iasl_errors.txt
Enter fullscreen mode Exit fullscreen mode

... and make sure there are no more errors on iasl_errors.txt.

Step 3: Enable S3 state

Search for this piece of code in dsdt.dsl:

    If ((CNSB == Zero))
    {
        If ((DAS3 == One))
        {
            Name (_S3, Package (0x04)  // _S3_: S3 System State
            {
                0x03, 
                0x03, 
                Zero, 
                Zero
            })
        }
    }
Enter fullscreen mode Exit fullscreen mode

Then, remove the two if statements and fix the indentation accordingly:

Name (_S3, Package (0x04)  // _S3_: S3 System State
{
    0x03, 
    0x03, 
    Zero, 
    Zero
})
Enter fullscreen mode Exit fullscreen mode

Step 4: Bump OEM version

Increase OEM version or otherwise the kernel will not apply the modified ACPI table. In line 21 replace:

line 21:    DefinitionBlock ("", "DSD   T", 1, "DELL  ", "WN09    ", 0x00000002)
Enter fullscreen mode Exit fullscreen mode

with:

line 21:    DefinitionBlock ("", "DSD   T", 1, "DELL  ", "WN09    ", 0x00000003)
Enter fullscreen mode Exit fullscreen mode

Step 5: Compile the final DSDT

iasl -ve -tc dsdt.dsl
Enter fullscreen mode Exit fullscreen mode

Step 6: Create a cpio file

$ mkdir -p kernel/firmware/acpi
$ cp dsdt.aml kernel/firmware/acpi
$ find kernel | cpio -H newc --create > acpi_override
$ sudo cp acpi_override /boot
Enter fullscreen mode Exit fullscreen mode

Step 7: Update GRUB

Edit file /etc/default/grub and append "mem_sleep_default=deep" to GRUB_CMDLINE_LINUX_DEFAULT parameter.

Then, add the line GRUB_EARLY_INITRD_LINUX_CUSTOM="acpi_override" below.

Finally, update GRUB with sudo update-grub (Debian/Ubuntu) or through YaST > System > Boot Loader in openSUSE (just make a minor change like increasing or decreasing timeout).

Step 8: Reboot

Reboot and check if S3 and deep sleep are enabled. You should see:

$ sudo dmesg | grep -i acpi | grep supports
[    0.502663] ACPI: (supports S0 S3 S4 S5)
Enter fullscreen mode Exit fullscreen mode
$ cat /sys/power/mem_sleep
s2idle [deep]
Enter fullscreen mode Exit fullscreen mode

Finally, try suspending to RAM.

References

Top comments (25)

Collapse
 
mani2jeff profile image
JeffB

Thanks so much for your clear instructions. Everything was as indicated down to Step 7, but I am not able to update GRUB. There was no /etc/default/grub file but I added as I understood your instructions. (Note that my machine is dual booting with Windows 10 as well with UEFI enabled. There doesn't seem to be any use of GRUB, I select the OS with the BOOT menu F12). No apparent change in the configuration. Any assistance would be appreciated.

I have been able to tweak the Windows Registry to disable Modern/Connect Standby, which was a terrible nuisance. Now working to update POP_OS too.

Thanks

Collapse
 
epassaro profile image
epassaro Author

Wich distro are you using? Every distro I know has the grub file in that place.

Collapse
 
mani2jeff profile image
JeffB

I was using POP!_OS 20.04 LTS, but I have abandon the machine and returned it. So, unfortunately, there is no exploration to pursue here. Thanks. I plan to get another machine and will try POP!_OS there when I have time.

Jeff

Thread Thread
 
dpoon profile image
dpoon

pop os use systemd-boot for UEFI. You will have to modify /boot/efi/loader/entries/Pop_OS-current.conf. The CPIO archive need to be placed inside /boot/efi/EFI/

Collapse
 
roh_mish profile image
Rohan Mishra

Hey may i ask which firmware are you running/ is it working with newer firmwares? I tried to edit table and enable s3 sleep but it turned out that it wont resume properly from sleep and it looked like something else was broken in firmware as well. The last time i compiled it wouldnt show s3 no matter what i did

Collapse
 
epassaro profile image
epassaro Author

Hi Rohan, glad to see someone is interested in this guide. I'm using firmware 1.3.0 and Linux kernel 5.10.

Collapse
 
roh_mish profile image
Rohan Mishra

Huh. Thats weird. 1.3.0 doesnt want to show s3 support even when i force it. I just installed 1.4.0 so ill try redoing it later tomorrow.

Thread Thread
 
epassaro profile image
epassaro Author

If you have a Dell 7405 2-in-1 with BIOS v1.3.0 this guide should work. What distro are you using?

Thread Thread
 
roh_mish profile image
Rohan Mishra

I updated to 1.4.0 w/ manjaro. Ill test if that makes it work.

Collapse
 
alokym86 profile image
alokym86

Thank you for sharing such an experience. I adapted your instruction for my HP Laptop 15s-eq1 (AMD Ryzen 3 4300U, Linux Mint 20.2, kernel 5.10). And... Finally, there is the support of S3 state in dmesg (the output in step 8 is the same as yours). The laptop suspends to RAM!.. But can't wake after.

Collapse
 
alokym86 profile image
alokym86

With kernel 5.14-rc5 my laptop wakes up like a charm)
Without your DSDT magic, suspending/wake up does not works even on 5.14-rc5.

Collapse
 
roh_mish profile image
Info Comment hidden by post author - thread only accessible via permalink
Rohan Mishra

Hey may i ask which firmware are you running/ is it working with newer firmwares? I tried to edit table and enable s3 sleep but it turned out that it wont resume properly from sleep and it looked like something else was broken in firmware as well.

Collapse
 
pb82 profile image
Peter Braun

Your fix appears to work for the Dell Inspiron 5515 (Ryzen 7 5700u) and Kernel 5.10. Thanks a lot! I'm staying on the Kernel version for now and will give 5.13 a try once released.

Collapse
 
epassaro profile image
epassaro Author

This is not going to be fixed soon. I would stay tuned to the GitLab discussion and look for the right kernel to update (hopefully 5.14).

Collapse
 
epassaro profile image
epassaro Author

I can confirm this is not working on 5.13.0

Thread Thread
 
pb82 profile image
Peter Braun

Thanks for the heads up. A lot of the discussion on Gitlab seems to be about making modern standby work. I'm hoping that 5.14 is also going to address the broken S3.

Thread Thread
 
epassaro profile image
epassaro Author

It's working on 5.14!

Collapse
 
sergeykornien12 profile image
Sergey Kornienko

Dear epassaro,
Thanks so much for your researching and clear instructions.
You saved life for my laptop Dell Vostro 5515 which wasn't work in S3 state by default with my Fedora 35/36 and kernel 5.16.xx - 5.18.xx.
I repeated all steps it had some differences but it completed ok finally and I got acpi_override.
Everytime when I tried to send my laptop to S3 it died completely and wasn't power on after until I disassemble laptop, disconnect battery for a short time and connect again.
You can imagine this "funny" procedure :)
Now it works perfectly! :) My appreciate!

Collapse
 
sebthesun profile image
Sébastien Beausoleil

@epassaro THANK YOU, you save my computer and my times.

I applied your instructions and it solves my problem.
I have a question, if I update the linux kernel, will I have to re apply those instructions?
Thank

Collapse
 
epassaro profile image
epassaro Author

Glad to hear it was helpful!

No, it's not necessary to update after upgrading the kernel.

Collapse
 
dpoon profile image
dpoon

Thanks! The guide works for my Dell with 5.14 kernel. I can now get to S3 Deep sleep.
However, I am still losing 8% of battery in ~10 hours during S3 sleep. Is this the case for you?

Collapse
 
epassaro profile image
epassaro Author

I didn't measure the amount of battery loss during sleep, but I don't think that's my case. Did you check the computer is entering in S3 with dmesg?.

I'm going to keep my computer suspended tonight and see the %.

Collapse
 
papadako profile image
Papadakos Panagiotis • Edited on

I tried to apply the process to my Dell 7430 and Ubuntu 22.04, and although I managed to enable deep sleep in the kernel, unfortunately my laptop never exits deep sleep (BIOS version 1.7.0)

Any comments / suggestions?

Btw, my dsdt.dsl had 3 errors which I resolved by uncommenting lines 105/106/107

//External (_SB_.PC00.LPCB.ECDV.CMFC.DLPN, UnknownObj)
//External (_SB_.PC00.LPCB.ECDV.CMFC.IDMN, UnknownObj)
//External (_SB_.PC00.LPCB.ECDV.CMFC.IDPC, UnknownObj)
Enter fullscreen mode Exit fullscreen mode

s2idle is unsafe for me for carrying the laptop since it overheats

Many thanks

Collapse
 
dpiloni profile image
Diego Piloni

Thanks a lot man! Worked perfect for my Dell 7405 2-in-1.

Saludos desde Córdoba :)

Collapse
 
epassaro profile image
epassaro Author

Me alegro que te haya servido y que tengamos la misma laptop!

Some comments have been hidden by the post's author - find out more

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.