This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

machines.xerxes: add some suspend workarounds

+50 -1
+50 -1
machines/xerxes/physical.nix
··· 24 24 options amdgpu ip_block_mask=0xfffff7ff 25 25 ''; 26 26 27 - # Disable spurious wakeup sources (PCIe ports triggering immediate wake from s2idle) 27 + # Disable spurious wakeup sources that trigger immediate wake from s2idle 28 + # - PCIe ports 29 + # - USB host controllers (xhci_hcd) — external USB devices cause instant wakeup 30 + # - Thunderbolt controllers 31 + # - I2C touchpad/touchscreen (HTIX5288 via pinctrl_amd GPIO) 28 32 services.udev.extraRules = '' 29 33 ACTION=="add", SUBSYSTEM=="pci", DRIVER=="pcieport", ATTR{power/wakeup}="disabled" 34 + ACTION=="add", SUBSYSTEM=="pci", DRIVER=="xhci_hcd", ATTR{power/wakeup}="disabled" 35 + ACTION=="add", SUBSYSTEM=="pci", DRIVER=="thunderbolt", ATTR{power/wakeup}="disabled" 36 + ACTION=="add", SUBSYSTEM=="i2c", ATTR{name}=="HTIX5288*", ATTR{power/wakeup}="disabled" 37 + ACTION=="add", SUBSYSTEM=="serio", DRIVER=="atkbd", ATTR{power/wakeup}="disabled" 30 38 ''; 39 + 40 + # Disable ACPI wakeup on USB/Thunderbolt controllers to prevent spurious wakeups 41 + # (udev rules handle sysfs wakeup, this handles /proc/acpi/wakeup separately) 42 + systemd.services.disable-acpi-wakeup = { 43 + description = "Disable USB/Thunderbolt ACPI wakeup sources"; 44 + wantedBy = [ "multi-user.target" ]; 45 + after = [ "systemd-udev-settle.service" ]; 46 + serviceConfig = { 47 + Type = "oneshot"; 48 + RemainAfterExit = true; 49 + ExecStart = pkgs.writeShellScript "disable-acpi-wakeup" '' 50 + for dev in XHC0 XHC1 XHC3 XHC4 NHI0 NHI1; do 51 + if grep -q "^$dev.*enabled" /proc/acpi/wakeup; then 52 + echo "$dev" > /proc/acpi/wakeup 53 + fi 54 + done 55 + ''; 56 + }; 57 + }; 31 58 32 59 # Swapfile for hibernation (suspend-then-hibernate needs somewhere to dump RAM) 33 60 swapDevices = [ ··· 68 95 ExecStart = "${pkgs.bash}/bin/bash -c 'for f in /sys/kernel/debug/dri/*/amdgpu_evict_vram; do cat \"$f\"; done'"; 69 96 }; 70 97 }; 98 + 99 + # Unbind USB4/Thunderbolt controllers before sleep to allow s0ix deepest state 100 + # AMD USB4 controllers stay active during s2idle and block entry into deepest sleep 101 + # XHCI (USB3) controllers are left bound to avoid disconnecting gamepad/keyboard/mouse 102 + environment.etc."systemd/system-sleep/usb4-sleep".source = pkgs.writeShellScript "usb4-sleep" '' 103 + case "$1" in 104 + pre) 105 + for dev in 0000:c6:00.5 0000:c6:00.6; do 106 + if [ -e /sys/bus/pci/drivers/thunderbolt/$dev ]; then 107 + echo $dev > /sys/bus/pci/drivers/thunderbolt/unbind || true 108 + fi 109 + done 110 + ;; 111 + post) 112 + for dev in 0000:c6:00.5 0000:c6:00.6; do 113 + if [ ! -e /sys/bus/pci/drivers/thunderbolt/$dev ]; then 114 + echo $dev > /sys/bus/pci/drivers/thunderbolt/bind || true 115 + fi 116 + done 117 + ;; 118 + esac 119 + ''; 71 120 72 121 # s2idle for 15 minutes, then hibernate to save power 73 122 services.logind.powerKey = "suspend-then-hibernate";