saveriomiroddi / saveriomiroddi.github.io

My professional blog
https://saveriomiroddi.github.io
MIT License
3 stars 0 forks source link

https://saveriomiroddi.github.io/Enabling-the-S3-sleep-suspend-on-the-Lenovo-Yoga-7-AMD-Gen-7-and-possibly-others/ #69

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Enabling the S3 sleep state (suspend-to-RAM) on the Lenovo Yoga 7 AMD Gen 7 (and possibly, others) – Saverio Miroddi – 64K RAM SYSTEM  38911 BASIC BYTES FREE

The lack of support for the Suspend-to-RAM functionality (ie. S3 sleep state), and its replacement with the disastrous Connected Standby (ie. S0ix sleep state) is a well-known plague on modern laptops.

In this article I’ll describe how to restore support for it on the Lenovo Yoga 7 AMD Gen 7. This method likely applies to other models; for example, the HP ENVY x360) has the same S3 conditional logic in the DSDT.

Content:

Procedure

  Preliminary operations
  Dumping and patching the DSDT
  Overriding the DSDT

      Initrd hook
      Patching the kernel
      Prepending an

https://saveriomiroddi.github.io/Enabling-the-S3-sleep-suspend-on-the-Lenovo-Yoga-7-AMD-Gen-7-and-possibly-others/

peterny commented 1 year ago

Thanks for developing this method and describing it so well! I tried it on my ideapad 5 Pro 16ACH6, but the "reassemble" step (iasl -tc dsdt.dsl) fails with: Compilation failed. 89 Errors, 22 Warnings, 38 Remarks ... even on the unmodified dsdt.dsl (ie: sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat; iasl -d dsdt.dat; iasl -tc dsdt.dsl). Do you have any suggestions on how to proceed in this case?

peterny commented 1 year ago

... and I'm running newest Ubuntu 22.04.2 LTS on my Lenovo ideapad 5 Pro 16ACH6. Same compilation errors with current (vmlinuz-5.19.0-32-generic) and previous (vmlinuz-5.15.0-60-generic) kernel.

64kramsystem commented 1 year ago

Do you have any suggestions on how to proceed in this case?

Hi! Unfortunately, I have no idea. I've checked the acpica-tools version on the latest ubuntu repositories, but it's not significantly different from the one used on 22.04. 🤷

peterny commented 1 year ago

OK, thanks. Searching for a solution I found others with DSDT compile problems, e.g.:

peterny commented 1 year ago

FYI: I solved the problem by installing Kernel 6.1 and setting kernel param amd_iommu=off. Suspend/resume now works fine on my Lenovo Ideapad 16ACH6.

64kramsystem commented 1 year ago

FYI: I solved the problem by installing Kernel 6.1 and setting kernel param amd_iommu=off. Suspend/resume now works fine on my Lenovo Ideapad 16ACH6.

That's interesting. Essentially

?

peterny commented 1 year ago

S3 was not disabled (since it was never enabled). Both before and after my changes the supported sleep states were:

$ sudo dmesg | grep 'ACPI.*supports S'
[    0.277103] ACPI: PM: (supports S0 S4 S5)

So it must be S0 (S0i3?) working now, I suppose.

Not even sure amd_iommu=off is necessary. I followed https://lucraymond.net/2022/10/04/linux-fixing-suspend-resume-on-amd-renoir-lenovo-thinkbook-g2-are-on-kernel-5-19-6-0-and-up/, which only gave me minor improvements, before installing kernel 6.1.

Likemike24 commented 1 year ago

You can simply use the Smokeless RUntime EFI Patcher for all of this. https://github.com/SmokelessCPUv2/SmokelessRuntimeEFIPatcher

Create a USB drive with the files supplied and select to start from it. Then you´ll have the advanced options in UEFI/BIOS. Under AMD PBS you can select if you want to use S3 or Modern Standby mode.

64kramsystem commented 1 year ago

You can simply use the Smokeless RUntime EFI Patcher for all of this. https://github.com/SmokelessCPUv2/SmokelessRuntimeEFIPatcher

Create a USB drive with the files supplied and select to start from it. Then you´ll have the advanced options in UEFI/BIOS. Under AMD PBS you can select if you want to use S3 or Modern Standby mode.

Didn't work on my laptop; discussed it here.

mgeier63 commented 1 year ago

Running Ubuntu on a Thinkpad P16v, S3 not advertised by default, and suspending to "Modern Suspend" would leave the fans running while suspended!

Patched the ACPI tables following your instructions, now I have S3, and when suspending to S3 the fans are finally OFF!

Thank you so much, i love you! ;-)