[Laptop] Add option to force PCIe ASPM

This commit is contained in:
Antoine Viallon 2022-04-10 12:43:36 +02:00
parent fb0b741ea1
commit 5cda91672c
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
3 changed files with 325 additions and 0 deletions

View file

@ -16,6 +16,9 @@ in {
description = "Change service used to manage power consumption on laptop";
type = types.enum [ "tlp" "power-profiles-daemon" false ];
};
tweaks = {
pcieAspmForce = mkEnableOption "hardcore tweaks to power consumption. Warning: Might be dangerous to use.";
};
};
config = mkIf cfg.enable {
@ -31,6 +34,23 @@ in {
# Les power consumption against some performance
"workqueue.power_efficient" = "";
nohz = "on";
pcie_aspm = mkIf cfg.tweaks.pcieAspmForce "force";
};
systemd.services.aspm-force-enable = let
aspm_enable = pkgs.callPackage ./packages/aspm_enable { };
in {
serviceConfig = {
ExecStart = [
"${aspm_enable}/bin/aspm_enable"
];
Type = "simple";
};
wantedBy = [ "multi-user.target" ];
description = "Force-enable PCIe ASPM";
enable = cfg.tweaks.pcieAspmForce;
};
services.tlp.enable = (cfg.power-manager == "tlp");