First Commit

This commit is contained in:
2025-11-17 07:19:53 -07:00
parent 93c1ee71ba
commit b3b8177a74
44 changed files with 560 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Disables power saving capabilities for snd-hda-intel when device is not
# running on battery power. This is needed because it prevents audio cracks on
# some hardware.
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="card*", DRIVERS=="snd_hda_intel", TEST!="/run/udev/snd-hda-intel-powersave", \
RUN+="/usr/bin/bash -c 'touch /run/udev/snd-hda-intel-powersave; \
[[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave && \
echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \
RUN+="/usr/bin/bash -c 'echo $$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null || \
echo 10) > /sys/module/snd_hda_intel/parameters/power_save'"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \
RUN+="/usr/bin/bash -c '[[ $$(cat /sys/module/snd_hda_intel/parameters/power_save) != 0 ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave; \
echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"

View File

@@ -0,0 +1,14 @@
# When used with ZRAM, it is better to prefer page out only anonymous pages,
# because it ensures that they do not go out of memory, but will be just
# compressed. If we do frequent flushing of file pages, that increases the
# percentage of page cache misses, which in the long term gives additional
# cycles to re-read the same data from disk that was previously in page cache.
# This is the reason why it is recommended to use high values from 100 to keep
# the page cache as hermetic as possible, because otherwise it is "expensive"
# to read data from disk again. At the same time, uncompressing pages from ZRAM
# is not as expensive and is usually very fast on modern CPUs.
#
# Also it's better to disable Zswap, as this may prevent ZRAM from working
# properly or keeping a proper count of compressed pages via zramctl.
ACTION=="change", KERNEL=="zram0", ATTR{initstate}=="1", SYSCTL{vm.swappiness}="150", \
RUN+="/bin/sh -c 'echo N > /sys/module/zswap/parameters/enabled'"

View File

@@ -0,0 +1,2 @@
KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"

View File

@@ -0,0 +1,4 @@
# SATA Active Link Power Management
ACTION=="add", SUBSYSTEM=="scsi_host", KERNEL=="host*", \
ATTR{link_power_management_policy}=="*", \
ATTR{link_power_management_policy}="max_performance"

View File

@@ -0,0 +1,11 @@
# HDD
ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", \
ATTR{queue/scheduler}="bfq"
# SSD
ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", \
ATTR{queue/scheduler}="mq-deadline"
# NVMe SSD
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/rotational}=="0", \
ATTR{queue/scheduler}="none"

View File

@@ -0,0 +1,2 @@
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", \
ATTRS{id/bus}=="ata", RUN+="/usr/bin/hdparm -B 254 -S 0 /dev/%k"

View File

@@ -0,0 +1,9 @@
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="add|bind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \
ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \
TEST=="power/control", ATTR{power/control}="auto"
# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="remove|unbind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \
ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \
TEST=="power/control", ATTR{power/control}="on"

View File

@@ -0,0 +1 @@
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"