From e469ed8b9a0750e7b99de01ae9dd38dcfa7d8d0d Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 26 May 2024 23:46:05 -0400 Subject: [PATCH] Add power saving settings. --- .../disable_sp5100_watchdog_modprobe.conf | 2 ++ .../files/iwlwifi_modprobe.conf | 5 ++++ .../files/snd_hda_intel_modprobe.conf | 2 ++ .../roles/framework_laptop/tasks/linux.yaml | 25 +++++++++++++++++++ .../poudriere/files/currentznver4_src.conf | 2 +- .../files/disable_bluetooth_rulesd.conf | 2 ++ .../files/dont_sleep_usb_rulesd.conf | 12 +++++++++ .../files/pci_power_management_rulesd.conf | 5 ++++ .../roles/power_management/tasks/freebsd.yaml | 6 ----- .../roles/power_management/tasks/linux.yaml | 2 ++ 10 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 ansible/roles/framework_laptop/files/disable_sp5100_watchdog_modprobe.conf create mode 100644 ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf create mode 100644 ansible/roles/framework_laptop/files/snd_hda_intel_modprobe.conf create mode 100644 ansible/roles/power_management/files/disable_bluetooth_rulesd.conf create mode 100644 ansible/roles/power_management/files/pci_power_management_rulesd.conf diff --git a/ansible/roles/framework_laptop/files/disable_sp5100_watchdog_modprobe.conf b/ansible/roles/framework_laptop/files/disable_sp5100_watchdog_modprobe.conf new file mode 100644 index 0000000..5545491 --- /dev/null +++ b/ansible/roles/framework_laptop/files/disable_sp5100_watchdog_modprobe.conf @@ -0,0 +1,2 @@ +# Disable the hardware watchdog inside AMD 700 chipset series for power savings. +blacklist sp5100_tco diff --git a/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf b/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf new file mode 100644 index 0000000..80d2282 --- /dev/null +++ b/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf @@ -0,0 +1,5 @@ +options iwlwifi power_save=1 + +options iwlwifi uapsd_disable=0 + +options iwlmvm power_scheme=3 diff --git a/ansible/roles/framework_laptop/files/snd_hda_intel_modprobe.conf b/ansible/roles/framework_laptop/files/snd_hda_intel_modprobe.conf new file mode 100644 index 0000000..02c39ad --- /dev/null +++ b/ansible/roles/framework_laptop/files/snd_hda_intel_modprobe.conf @@ -0,0 +1,2 @@ +# Sound power-saving was causing chat notifications to be inaudible. +# options snd_hda_intel power_save=1 diff --git a/ansible/roles/framework_laptop/tasks/linux.yaml b/ansible/roles/framework_laptop/tasks/linux.yaml index 584abd4..39cb347 100644 --- a/ansible/roles/framework_laptop/tasks/linux.yaml +++ b/ansible/roles/framework_laptop/tasks/linux.yaml @@ -18,3 +18,28 @@ group: wheel loop: - screen_brightness + +- name: Install module config + copy: + src: "files/{{ item }}_modprobe.conf" + dest: "/etc/modprobe.d/{{ item }}.conf" + mode: 0644 + owner: root + group: wheel + loop: + - iwlwifi + - snd_hda_intel + - disable_sp5100_watchdog + +- name: Configure kernel command line + zfs: + name: "zroot/linux" + state: present + extra_zfs_properties: + # amdgpu.abmlevel=3 :: Automatically reduce screen brightness but tweak colors to compensate for power reduction. + # pcie_aspm=force pcie_aspm.policy=powersupersave :: Enable PCIe active state power management for power reduction. + # nowatchdog :: Disable watchdog for power savings (related to disable_sp5100_watchdog above). + # amd_pstate=passive :: Fully automated hardware pstate control. + # amd_pstate=active :: Same as passive except we can set the energy performance preference (EPP) to suggest how much we prefer performance or energy efficiency. + # amd_pstate=guided :: Same as passive except we can set upper and lower frequency bounds. + "org.zfsbootmenu:commandline": "rw quiet amdgpu.abmlevel=3 pcie_aspm=force pcie_aspm.policy=powersupersave nowatchdog amd_pstate=passive" diff --git a/ansible/roles/poudriere/files/currentznver4_src.conf b/ansible/roles/poudriere/files/currentznver4_src.conf index 5ae5095..06d9a80 100644 --- a/ansible/roles/poudriere/files/currentznver4_src.conf +++ b/ansible/roles/poudriere/files/currentznver4_src.conf @@ -8,7 +8,7 @@ WITH_REPRODUCIBLE_BUILD=YES # WITHOUT_GAMES=YES # WITHOUT_KERBEROS=YES # WITHOUT_LEGACY_CONSOLE=YES -# WITHOUT_LIB32=YES +WITHOUT_LIB32=YES # WITHOUT_LOADER_GELI=YES # WITHOUT_MLX5TOOL=YES # WITHOUT_NDIS=YES diff --git a/ansible/roles/power_management/files/disable_bluetooth_rulesd.conf b/ansible/roles/power_management/files/disable_bluetooth_rulesd.conf new file mode 100644 index 0000000..a8c5dc8 --- /dev/null +++ b/ansible/roles/power_management/files/disable_bluetooth_rulesd.conf @@ -0,0 +1,2 @@ +# disable bluetooth +SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0" diff --git a/ansible/roles/power_management/files/dont_sleep_usb_rulesd.conf b/ansible/roles/power_management/files/dont_sleep_usb_rulesd.conf index 5c9d568..77d02b1 100644 --- a/ansible/roles/power_management/files/dont_sleep_usb_rulesd.conf +++ b/ansible/roles/power_management/files/dont_sleep_usb_rulesd.conf @@ -1,4 +1,7 @@ +# Steelseries Sensei Ten mouse ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1832", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1" + +# I don't remember what this is ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="308f", ATTR{idProduct}=="0011", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1" # Launch keyboard @@ -7,3 +10,12 @@ ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="3384", ATTR{idProduct}=="0006" # DFU Programmer on launch keyboard ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff9", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1" ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff9", TAG+="uaccess" + + + + +# blacklist for usb autosuspend +# ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", ATTR{idProduct}=="9205", GOTO="power_usb_rules_end" + +# ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto" +# LABEL="power_usb_rules_end" diff --git a/ansible/roles/power_management/files/pci_power_management_rulesd.conf b/ansible/roles/power_management/files/pci_power_management_rulesd.conf new file mode 100644 index 0000000..e7af110 --- /dev/null +++ b/ansible/roles/power_management/files/pci_power_management_rulesd.conf @@ -0,0 +1,5 @@ +# Disable power management for specific PCI devices. Find the IDs via lspci -nn +# SUBSYSTEM=="pci", ATTR{vendor}=="0x1234", ATTR{device}=="0x1234", ATTR{power/control}="on", GOTO="pci_pm_end" + +SUBSYSTEM=="pci", ATTR{power/control}="auto" +LABEL="pci_pm_end" diff --git a/ansible/roles/power_management/tasks/freebsd.yaml b/ansible/roles/power_management/tasks/freebsd.yaml index f075d71..4bc96be 100644 --- a/ansible/roles/power_management/tasks/freebsd.yaml +++ b/ansible/roles/power_management/tasks/freebsd.yaml @@ -1,9 +1,3 @@ -# - name: Install packages -# package: -# name: -# - foo -# state: present - - name: Install loader.conf copy: src: "files/{{ item }}_loader.conf" diff --git a/ansible/roles/power_management/tasks/linux.yaml b/ansible/roles/power_management/tasks/linux.yaml index 3543f20..aa0c28e 100644 --- a/ansible/roles/power_management/tasks/linux.yaml +++ b/ansible/roles/power_management/tasks/linux.yaml @@ -7,3 +7,5 @@ group: wheel loop: - dont_sleep_usb + - pci_power_management + - disable_bluetooth