-
-
Save sebastien/c1e74754658a104346b1158a86eb4012 to your computer and use it in GitHub Desktop.
S3 deep sleep for Lenovo yoga X1 3rd Generation on Fedora 28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a step-by-step guide on how make sleep mode work with a Lenovo Yoga X1 3rd generation running Fedora 28 (UEFI based system). | |
Kernel version: 4.17.4-200.fc28.x86_64 | |
Credits: most of this guide comes from `https://delta-xi.net/#056`. The patch I used is a little different though, taken from http://kernel.dk/acpi.patch | |
(found through https://bbs.archlinux.org/viewtopic.php?pid=1794150#p1794150), and some of the steps slightly differ as well as mine is a UEFI based system. | |
1. Reboot, enter BIOS/UEFI. Go to Config - Thunderbolt (TM) 3 - set Thunderbolt BIOS Assist Mode to Enabled. Set also Security - Secure Boot to Disabled. | |
2. Install iasl (Intel's compiler/decompiler for ACPI machine language) and cpio: `sudo yum install acpica-tools cpio` | |
3. Get a dump of ACPI DSDT table: `cat /sys/firmware/acpi/tables/DSDT > dsdt.aml` | |
4. Decompile the dump, which will generate a `.dsl` source based on the `.aml` ACPI machine language dump: `iasl -d dsdt.aml` | |
5. Download the [patch](http://kernel.dk/acpi.patch) and apply it against `dsdt.dsl`: `patch --verbose < acpi.patch` | |
Hunk 2 failed for me, I manually looked for the following in `dsdt.dsl`: | |
``` | |
Name (SS1, 0x00) | |
Name (SS2, 0x00) | |
Name (SS3, One) | |
One | |
Name (SS4, One) | |
One | |
``` | |
and replaced it with the following (removing the two "One" lines): | |
``` | |
Name (SS1, 0x00) | |
Name (SS2, 0x00) | |
Name (SS3, One) | |
Name (SS4, One) | |
``` | |
6. Recompile your patched version of the .dsl source: `iasl -ve -tc dsdt.dsl` | |
7. Create a CPIO archive with the correct structure, which GRUB can load on boot. We name the final image `acpi_override` and copy it into `/boot/`: | |
``` | |
mkdir -p kernel/firmware/acpi | |
cp dsdt.aml kernel/firmware/acpi | |
find kernel | cpio -H newc --create > acpi_override | |
cp acpi_override /boot | |
``` | |
8. GRUB needs to boot the kernel with a parameter setting the deep sleep state as default. Edit `/etc/default/grub` and add the following: | |
``` | |
GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep" | |
``` | |
9. Regenerate the GRUB configuration: `grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg` | |
10. Tell GRUB to load the new DSDT table on boot in its configuration file located in `/boot/efi/EFI/fedora/grub.cfg`. Find the relevant GRUB menu entry | |
and add the new image (`/acpi_override`) to the `initrdefi` line: | |
``` | |
initrdefi /acpi_override /initramfs-4.17.4-200.fc28.x86_64.img | |
``` | |
Note: This step needs to be repeated every time the kernel is upgraded and the GRUB configuration is rewritten. Ideally this step would not be needed as | |
we could instead add `GRUB_EARLY_INITRD_LINUX_CUSTOM="/acpi_override"` to `/etc/default/grub` as part of step 8 which would survive upgrades. | |
But such line is currently ignored by fedora, see https://bugzilla.redhat.com/show_bug.cgi?id=1600414. | |
10. Reboot and enjoy having a laptop running Linux again... close the lid and the battery does not get drained in a few hours, also the battery no longer stays warm in sleep mode. | |
To verify that things are working: | |
``` | |
dmesg | grep ACPI | grep supports | |
#[ 0.195933] ACPI: (supports S0 S3 S4 S5) | |
cat /sys/power/mem_sleep | |
#s2idle [deep] | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment