laptop(battery): more optimizations

This commit is contained in:
2026-01-03 13:55:11 +00:00
parent 017fc7105e
commit 28e7c64262

View File

@@ -16,12 +16,14 @@ in
CPU_BOOST_ON_AC = 1; CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0; CPU_BOOST_ON_BAT = 0;
CPU_BOOST_ON_SAV = 0; CPU_BOOST_ON_SAV = 0;
DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE = "bluetooth wifi wwan";
TLP_DEFAULT_BATTERY_MODE = "SAV";
CPU_HWP_DYN_BOOST_ON_AC = 1; CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 0; CPU_HWP_DYN_BOOST_ON_BAT = 0;
CPU_HWP_DYN_BOOST_ON_SAV = 0; CPU_HWP_DYN_BOOST_ON_SAV = 0;
PLATFORM_PROFILE_ON_AC = "balanced"; PLATFORM_PROFILE_ON_AC = "balanced";
PLATFORM_PROFILE_ON_BAT = "quiet"; PLATFORM_PROFILE_ON_BAT = "low-power";
PLATFORM_PROFILE_ON_SAV = "quiet"; PLATFORM_PROFILE_ON_SAV = "quiet";
START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
@@ -48,30 +50,25 @@ in
SuspendEstimationSec=120 SuspendEstimationSec=120
''; '';
systemd.services.rfkill-sleep-wake = {
enable = true;
description = "Using rfkill; disable all rf devices before sleeping.";
before = [ "sleep.target" ];
serviceConfig = {
Type = "oneshot";
ExecStop = ''${pkgs.utillinux}/bin/rfkill unblock all'';
ExecStart = ''${pkgs.utillinux}/bin/rfkill block all'';
RemainAfterExit = true;
};
wantedBy = [ "sleep.target" ];
partOf = [ "sleep.target" ];
};
# one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate", "lock" # one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate", "lock"
powerManagement = { powerManagement = {
enable = true; enable = true;
# powertop.enable = true; # powertop.enable = true;
}; };
systemd.user.services.rfkill-sleep = {
# I haven't tested this, but in theory, disabling rf devices before sleep will save on power
enable = true;
before = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; disables all rf devices before sleeping. useful for saving power";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill block all'';
};
};
systemd.user.services.rfkill-wake = {
enable = true;
after = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; enable all rf devices after sleeping.";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill unblock all'';
};
};
} }