Skip to content

Commit

Permalink
suspend delay from config added
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Nov 1, 2024
1 parent 6ef4a62 commit ef421df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#freq-ratio=0.5
#core=true
#core-ratio=0.5
#suspend_delay=60000

[service]
#enabled=true
Expand Down
8 changes: 4 additions & 4 deletions src/service/backends/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def cpu_disable_event(cpus, min):
usb_path="/sys/bus/usb/devices/"
for dir in listdir(usb_path):
writefile("{}/{}/power/control".format(usb_path,dir),"auto")
writefile("{}/{}/power/autosuspend_delay_ms".format(usb_path,dir),"60000")
writefile("{}/{}/power/autosuspend_delay_ms".format(usb_path,dir),get("suspend_delay", "60000", "power"))

if get("block",True,"power"):
# block auto suspend
Expand All @@ -128,7 +128,7 @@ def cpu_disable_event(cpus, min):
pci_path="/sys/bus/pci/devices/"
for dir in listdir(pci_path):
writefile("{}/{}/power/control".format(pci_path,dir),"auto")
writefile("{}/{}/power/autosuspend_delay_ms".format(pci_path,dir),"60000")
writefile("{}/{}/power/autosuspend_delay_ms".format(pci_path,dir),get("suspend_delay", "60000", "power"))
writefile("/sys/module/pcie_aspm/parameters/policy", "powersave")


Expand Down Expand Up @@ -254,14 +254,14 @@ def _performance():
usb_path="/sys/bus/usb/devices/"
for dir in listdir(usb_path):
writefile("{}/{}/power/control".format(usb_path,dir),"on")
writefile("{}/{}/power/autosuspend_delay_ms".format(usb_path,dir),"60000")
writefile("{}/{}/power/autosuspend_delay_ms".format(usb_path,dir),get("suspend_delay", "60000", "power"))

if get("pci",True,"power"):
# pci auto suspend
pci_path="/sys/bus/pci/devices/"
for dir in listdir(pci_path):
writefile("{}/{}/power/control".format(pci_path,dir),"on")
writefile("{}/{}/power/autosuspend_delay_ms".format(pci_path,dir),"60000")
writefile("{}/{}/power/autosuspend_delay_ms".format(pci_path,dir),get("suspend_delay", "60000", "power"))
writefile("/sys/module/pcie_aspm/parameters/policy", "performance")


Expand Down

0 comments on commit ef421df

Please sign in to comment.