2023-11-16 00:19:02 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.hardware.framework.amd-7040;
|
|
|
|
in
|
|
|
|
{
|
2023-10-25 05:35:25 +00:00
|
|
|
imports = [
|
2023-11-10 21:10:31 +00:00
|
|
|
../common
|
|
|
|
../common/amd.nix
|
2023-10-25 05:35:25 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 00:19:02 +00:00
|
|
|
options = {
|
|
|
|
hardware.framework.amd-7040.preventWakeOnAC = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
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);
|
2023-10-25 05:35:25 +00:00
|
|
|
|
2024-01-08 18:25:06 +00:00
|
|
|
# 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) ''
|
2023-11-16 00:19:02 +00:00
|
|
|
# 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"
|
|
|
|
'';
|
|
|
|
};
|
2023-10-25 05:35:25 +00:00
|
|
|
}
|