WIP Laptop power
This commit is contained in:
parent
af322d762c
commit
6d7e92052f
2
roles/laptop/files/etc/udev/rules.d/99-powersave.rules
Normal file
2
roles/laptop/files/etc/udev/rules.d/99-powersave.rules
Normal file
@ -0,0 +1,2 @@
|
||||
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/local/sbin/power-saver-mode"
|
||||
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/local/sbin/unlimited-power"
|
14
roles/laptop/files/usr/local/sbin/power-saver-mode
Normal file
14
roles/laptop/files/usr/local/sbin/power-saver-mode
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Enable back all CPUs
|
||||
echo 1 | tee /sys/devices/system/cpu/cpu[2-7]/online
|
||||
echo 1 | tee /sys/devices/system/cpu/cpu1[0-5]/online
|
||||
|
||||
# Set CPU to governor to powersave
|
||||
cpupower frequency-set --governor ondemand
|
||||
|
||||
# Set brightness to 120 / 255
|
||||
echo 200 | tee /sys/class/backlight/amdgpu_bl0/brightness
|
||||
|
||||
# Enable bluetooth
|
||||
rfkill unblock bluetooth
|
26
roles/laptop/files/usr/local/sbin/unlimited-power
Normal file
26
roles/laptop/files/usr/local/sbin/unlimited-power
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Limit 8C/16T CPU to 2C/4T
|
||||
echo 0 | tee /sys/devices/system/cpu/cpu[2-7]/online
|
||||
echo 0 | tee /sys/devices/system/cpu/cpu1[0-5]/online
|
||||
|
||||
# Set CPU to governor to powersave
|
||||
cpupower frequency-set --governor powersave
|
||||
|
||||
# Set brightness to 120 / 255
|
||||
echo 120 | tee /sys/class/backlight/amdgpu_bl0/brightness
|
||||
|
||||
# Disable bluetooth
|
||||
rfkill block bluetooth
|
||||
|
||||
# TODO disable some services
|
||||
# systemctl disable containerd.service
|
||||
# systemctl disable docker.service
|
||||
# systemctl disable bluetooth.service
|
||||
# systemctl disable libvirtd.service
|
||||
# systemctl disable winbind.service
|
||||
# systemctl disable snapd.service
|
||||
# systemctl disable cups.service
|
||||
# systemctl disable avahi-daemon.service
|
||||
|
||||
# TODO exit steam
|
24
roles/laptop/tasks/powersave.yml
Normal file
24
roles/laptop/tasks/powersave.yml
Normal file
@ -0,0 +1,24 @@
|
||||
- name: install required packages for script
|
||||
become: yes
|
||||
apt:
|
||||
update_cache: yes
|
||||
pkg:
|
||||
- linux-tools-common
|
||||
- linux-tools-generic
|
||||
|
||||
- name: copy scripts
|
||||
become: yes
|
||||
copy:
|
||||
src: "usr/local/sbin/{{item}}"
|
||||
dest: "/usr/local/sbin/{{item}}"
|
||||
mode: '0755'
|
||||
loop:
|
||||
- power-saver-mode
|
||||
- unlimited-power
|
||||
|
||||
- name: add udev rules
|
||||
become: yes
|
||||
copy:
|
||||
src: etc/udev/rules.d/99-powersave.rules
|
||||
dest: /etc/udev/rules.d/99-powersave.rules
|
||||
mode: '0755'
|
Loading…
Reference in New Issue
Block a user