1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-12-18 15:49:45 +01:00

Merge pull request #778 from tlvince/patch-1

Add suspend workaround for Framework AMD
This commit is contained in:
Jörg Thalheim 2023-11-18 14:35:28 +01:00 committed by GitHub
commit 5b37cf8665
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 5 deletions

View file

@ -15,3 +15,15 @@ Then run
``` ```
- [Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop.Ryzen7040.BIOS.firmware) - [Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop.Ryzen7040.BIOS.firmware)
## 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.
```nix
{
hardware.framework.amd-7040.preventWakeOnAC = true;
}
```
See [Framework AMD Ryzen 7040 Series lid wakeup behavior feedback](https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45).

View file

@ -1,11 +1,38 @@
{ lib, pkgs, ... }: { { config, lib, pkgs, ... }:
let
cfg = config.hardware.framework.amd-7040;
in
{
imports = [ imports = [
../common ../common
../common/amd.nix ../common/amd.nix
]; ];
# Newer kernel is better for amdgpu driver updates options = {
# Requires at least 5.16 for working wi-fi and bluetooth (RZ616, kmod mt7922): hardware.framework.amd-7040.preventWakeOnAC = lib.mkOption {
# https://wireless.wiki.kernel.org/en/users/drivers/mediatek type = lib.types.bool;
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") (lib.mkDefault pkgs.linuxPackages_latest); default = false;
description = ''
Stop the system waking from suspend when the AC is plugged
in. The catch: it also disables waking from the keyboard.
See:
https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45
'';
};
};
config = {
# Newer kernel is better for amdgpu driver updates
# Requires at least 5.16 for working wi-fi and bluetooth (RZ616, kmod mt7922):
# 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 ''
# 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"
'';
};
} }