From fe76fc35f7e4900718be13d15e3370a50b0fc79a Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Mon, 8 Jan 2024 18:25:06 +0000 Subject: [PATCH] framework amd: only apply suspend workaround on <6.7 --- framework/13-inch/7040-amd/README.md | 2 +- framework/13-inch/7040-amd/default.nix | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/13-inch/7040-amd/README.md b/framework/13-inch/7040-amd/README.md index 54bf5d7..bb46c3c 100644 --- a/framework/13-inch/7040-amd/README.md +++ b/framework/13-inch/7040-amd/README.md @@ -18,7 +18,7 @@ Then run ## Suspend/wake workaround -As of firmware v03.03, a bug in the EC causes the system to wake if AC is connected _despite_ the lid being closed. The following works around this, with the trade-off that keyboard presses also no longer wake the system. +As of firmware v03.03, a bug in the EC causes the system to wake if AC is connected _despite_ the lid being closed. A workaround has been [upstreamed](https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193) in Linux v6.7. For older kernels, the following works around this, with the trade-off that keyboard presses also no longer wake the system. ```nix { diff --git a/framework/13-inch/7040-amd/default.nix b/framework/13-inch/7040-amd/default.nix index 9f31c6b..81ff707 100644 --- a/framework/13-inch/7040-amd/default.nix +++ b/framework/13-inch/7040-amd/default.nix @@ -29,7 +29,9 @@ in # https://wireless.wiki.kernel.org/en/users/drivers/mediatek boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") (lib.mkDefault pkgs.linuxPackages_latest); - services.udev.extraRules = lib.optionalString cfg.preventWakeOnAC '' + # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) + # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 + services.udev.extraRules = lib.mkIf (lib.versionOlder pkgs.linux.version "6.7" && cfg.preventWakeOnAC) '' # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled"