From d9982d992f0589a048100c6084b04d9a33c290ab Mon Sep 17 00:00:00 2001 From: Satria Date: Thu, 19 Feb 2026 06:31:48 +0700 Subject: [PATCH] undervolt tweaks --- .../misc/{cpu-thermal.nix => cpu-freq.nix} | 13 +---- modules/hardware/thinkpad.nix | 50 ++++++++++++++++++- 2 files changed, 49 insertions(+), 14 deletions(-) rename modules/hardware/misc/{cpu-thermal.nix => cpu-freq.nix} (88%) diff --git a/modules/hardware/misc/cpu-thermal.nix b/modules/hardware/misc/cpu-freq.nix similarity index 88% rename from modules/hardware/misc/cpu-thermal.nix rename to modules/hardware/misc/cpu-freq.nix index 58d8180..541829b 100644 --- a/modules/hardware/misc/cpu-thermal.nix +++ b/modules/hardware/misc/cpu-freq.nix @@ -1,7 +1,5 @@ { ... }: { services = { - thermald.enable = false; - throttled.enable = true; power-profiles-daemon.enable = false; # replacement for tlp and auto-cpufreq due to bugs tlp = { enable = false; # buggy and inconsistent with frequency scaling @@ -66,18 +64,9 @@ platform_profile = "low-power"; turbo = "never"; scaling_min_freq = 400000; - scaling_max_freq = 1000000; + scaling_max_freq = 1700000; }; }; }; - thinkfan = { - enable = true; - levels = [ - [ "level auto" 0 55 ] - [ 3 55 65 ] - [ 7 65 75 ] - [ "level full-speed" 75 100 ] - ]; - }; }; } diff --git a/modules/hardware/thinkpad.nix b/modules/hardware/thinkpad.nix index d79881c..df26f9a 100644 --- a/modules/hardware/thinkpad.nix +++ b/modules/hardware/thinkpad.nix @@ -2,7 +2,7 @@ imports = [ ./misc/battery-power.nix ./misc/power-button.nix - ./misc/cpu-thermal.nix + ./misc/cpu-freq.nix ./misc/tzupdate.nix ./core/hibernation.nix ./core/firmware.nix @@ -14,10 +14,56 @@ kernelPackages = pkgs.linuxPackages; kernel.sysctl."vm.laptop_mode" = 5; initrd.availableKernelModules = [ "thinkpad_acpi" ]; + kernelParams = [ + "i915.enable_psr=1" + "pcie_aspm=force" + "nmi_watchdog=0" + # ^^ potential instability, but improves battery life + + "loglevel=3" + "i915.enable_guc=3" + "i915.enable_fbc=1" + "msr.allow-writes=on" + "nvme_core.default_ps_max_latency_us=0" + ]; }; hardware.bluetooth = { enable = true; powerOnBoot = false; }; - services.hardware.bolt.enable = true; + services = { + throttled = { + enable = true; + extraConfig = '' + [UNDERVOLT] + CORE: -120 + GPU: -80 + CACHE: -120 + UNCORE: -80 + ANALOGIO: 0 + + [BATTERY] + PL1_Tdp_W: 12 + PL2_Tdp_W: 20 + PL1_Duration_s: 28 + PL2_Duration_s: 0.002 + Update_Rate_s: 30 + Trip_Temp_C: 85 + + [AC] + PL1_Tdp_W: 25 + PL2_Tdp_W: 35 + ''; + }; + thinkfan = { + enable = true; + levels = [ + [ "level auto" 0 55 ] + [ 3 55 65 ] + [ 7 65 75 ] + [ "level full-speed" 75 100 ] + ]; + }; + hardware.bolt.enable = true; + }; }