Merge pull request #1642 from fewtarius/dev

Rework power management features to improve persistence and fix a few bugs.
This commit is contained in:
fewtarius 2023-06-28 07:41:51 -04:00 committed by GitHub
commit 6689e8b65f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 49 deletions

View file

@ -167,19 +167,20 @@ supergrafx.integerscale=0
supergrafx.ratio=4/3
supervision.integerscale=0
syncthing.enabled=0
system.audio.powersave=1
system.autohotkeys=1
system.automount=1
system.battery.warning=1
system.cpugovernor=schedutil
system.cpu.powersave=1
system.hostname=@DEVICENAME@
system.language=en_US
system.overclock=off
system.pcie.powersave=1
system.power.audio=1
system.power.cpu=1
system.power.pcie=1
system.power.rtpm=0
system.powersave=0
system.power.wifi=0
system.timezone=America/New_York
system.usb.powersave=0
tg16cd.integerscale=0
tg16cd.ratio=4/3
tg16.integerscale=0
@ -197,7 +198,6 @@ videopac.integerscale=0
videopac.ratio=4/3
virtualboy.integerscale=0
weston.startup=/usr/bin/start_es.sh
wifi.powersave=0
wonderswancolor.integerscale=0
wonderswan.integerscale=0
wts.enabled=1

View file

@ -123,34 +123,40 @@ do
done
### Add properties for enhanced power savings control.
AUDIOPOWERSAVE=$(get_setting system.audio.powersave)
AUDIOPOWERSAVE=$(get_setting system.power.audio)
if [ -z "${AUDIOPOWERSAVE}" ]
then
set_setting system.audio.powersave 1
set_setting system.power.audio 1
fi
CPUPOWERSAVE=$(get_setting system.cpu.powersave)
CPUPOWERSAVE=$(get_setting system.power.cpu)
if [ -z "${CPUPOWERSAVE}" ]
then
set_setting system.cpu.powersave 1
set_setting system.power.cpu 1
fi
PCIEPOWERSAVE=$(get_setting system.pcie.powersave)
PCIEPOWERSAVE=$(get_setting system.power.pcie)
if [ -z "${PCIEPOWERSAVE}" ]
then
set_setting system.pcie.powersave 1
set_setting system.power.pcie 1
fi
USBPOWERSAVE=$(get_setting system.usb.powersave)
if [ -z "${USBPOWERSAVE}" ]
RTPM=$(get_setting system.power.rtpm)
if [ -z "${RTPM}" ]
then
set_setting system.usb.powersave 0
set_setting system.power.rtpm 0
fi
PCIPOWERSAVE=$(get_setting system.pci.powersave)
if [ -z "${PCIPOWERSAVE}" ]
WAKEEVENTS=$(get_setting system.power.wakeevents)
if [ -z "${WAKEEVENTS}" ]
then
set_setting system.pci.powersave 1
set_setting system.power.wakeevents 1
fi
WIFIPOWERSAVE=$(get_setting system.power.wifi)
if [ -z "${WIFIPOWERSAVE}" ]
then
set_setting system.power.wifi 0
fi
AUDIBLEALERT=$(get_setting system.battery.warning)

View file

@ -43,7 +43,7 @@ get_wifi_service() {
}
set_powersave() {
ENABLED=$(get_setting wifi.powersave)
ENABLED=$(get_setting system.power.wifi)
if [ "${ENABLED}" = "1" ]
then
log $0 "Enabling WIFI power saving."

View file

@ -31,7 +31,7 @@ gpu_performance_level() {
}
pcie_aspm_policy() {
PCIEPOWERSAVE=$(get_setting system.pcie.powersave)
PCIEPOWERSAVE=$(get_setting system.power.pcie)
if [ ! "${PCIEPOWERSAVE}" = "1" ]
then
return 0
@ -43,7 +43,7 @@ pcie_aspm_policy() {
}
cpu_perftune() {
CPUPOWERSAVE=$(get_setting system.cpu.powersave)
CPUPOWERSAVE=$(get_setting system.power.cpu)
if [ ! "${CPUPOWERSAVE}" = "1" ]
then
return 0
@ -72,7 +72,7 @@ cpu_perftune() {
}
audio_powersave() {
AUDIOPOWERSAVE=$(get_setting system.audio.powersave)
AUDIOPOWERSAVE=$(get_setting system.power.audio)
if [ ! "${AUDIOPOWERSAVE}" = "1" ]
then
return 0
@ -86,38 +86,26 @@ audio_powersave() {
done
}
usb_powersave() {
USBPOWERSAVE=$(get_setting system.usb.powersave)
if [ ! "${USBPOWERSAVE}" = "1" ]
runtime_power_management() {
RTPM=$(get_setting system.power.rtpm)
if [ ! "${RTPM}" = "1" ]
then
return 0
fi
find /sys/devices -name control -print0 | \
find /sys/devices -type f -name control -print0 2>/dev/null | \
while read -r -d '' DEVICE
do
echo ${1} >"${DEVICE}" 2>/dev/null
done
}
usb_powerlevel() {
USBPOWERSAVE=$(get_setting system.usb.powersave)
if [ ! "${USBPOWERSAVE}" = "1" ]
wake_events() {
WAKEEVENTS=$(get_setting system.power.wakeevents)
if [ ! "${WAKEEVENTS}" = "1" ]
then
return 0
fi
for device in $(find /sys/devices/pci* -name level)
do
echo ${1} >${device} 2>/dev/null
done
}
pci_powersave() {
PCIPOWERSAVE=$(get_setting system.pci.powersave)
if [ ! "${PCIPOWERSAVE}" = "1" ]
then
return 0
fi
for device in $(find /sys/devices/pci* -name wakeup)
for device in $(find /sys/devices/pci* -type f -name wakeup 2>/dev/null)
do
echo ${1} >${device} 2>/dev/null
done

View file

@ -36,9 +36,9 @@ do
cpu_perftune battery
gpu_performance_level ${GPUPROFILE}
pcie_aspm_policy powersave
pci_powersave enabled
usb_powersave auto
usb_powerlevel auto
wake_events enabled
runtime_power_management auto
/usr/bin/wifictl setpowersave
;;
*)
@ -48,9 +48,9 @@ do
cpu_perftune performance
gpu_performance_level auto
pcie_aspm_policy default
pci_powersave disabled
usb_powersave on
usb_powerlevel on
wake_events disabled
runtime_power_management on
/usr/bin/wifictl setpowersave
;;
esac
fi

View file

@ -12,7 +12,6 @@ else
fi
QUIRK_DEVICE="$(echo ${QUIRK_DEVICE} | sed -e "s#[/]#-#g")"
headphones() {
if [ "${DEVICE_FAKE_JACKSENSE}" == "true" ]
then
@ -107,6 +106,8 @@ case $1 in
headphones stop
volumectl stop
bluetooth stop
runtime_power_management on
wake_events disabled
powerstate stop
modules stop
quirks pre

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="f9de9d7"
PKG_VERSION="789bca8"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"