DEV Community

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

Fix suspend issues on Dell 7405 2-in-1

epassaro profile image epassaro Updated on ・4 min read

UPDATE MARCH 2021. A patch to enable S0ix state on AMD hardware has been merged into kernel 5.11, but it does not work at all. In fact, this patch also broke the S3 suspension (fixed in 5.11.5).

AMD support for S0ix will be fixed 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.

If you are a GNU/Linux user and bought this laptop recently, probably you found suspend to RAM does not work at all. I will share a solution for this problem.

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.

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

Discussion (7)

pic
Editor guide
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
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

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