Merge pull request #961 from fewtarius/dev

Power saving improvements.
This commit is contained in:
fewtarius 2023-01-19 06:16:57 -05:00 committed by GitHub
commit 98c1567a30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 83 additions and 15 deletions

View file

@ -39,6 +39,6 @@ post_makeinstall_target() {
}
post_install() {
enable_service bluealsa.service
#enable_service bluealsa.service
enable_service bluealsa-defaults.service
}

View file

@ -24,7 +24,7 @@ fi
PKG_BASEOS="plymouth-lite grep wget libjpeg-turbo util-linux xmlstarlet bluetool gnupg gzip patchelf \
imagemagick terminus-font vim bash pyudev dialog six git dbus-python coreutils miniupnpc \
nss-mdns avahi alsa-ucm-conf MC fbgrab modules system-utils autostart powerstate"
nss-mdns avahi alsa-ucm-conf MC fbgrab modules system-utils autostart powerstate powertop"
PKG_UI="emulationstation es-themes"

View file

@ -71,6 +71,7 @@ set_wifi() {
"enable")
check_wifi
set_setting wifi.enabled 1
rfkill unblock wifi 2>/dev/null
# Create the WIFI config.
cat > "${WIFICFG}" <<EOF
[global]
@ -95,6 +96,7 @@ EOF
connmanctl disable wifi 2>/dev/null
rm -f "${WIFICFG}" 2>/dev/null
set_setting wifi.enabled 0
rfkill block wifi 2>/dev/null
;;
"reconnect")
/usr/bin/wifictl disable

View file

@ -4,5 +4,8 @@
if [ "$(get_setting bluetooth.enabled)" == "1" ]
then
rfkill unblock bluetooth
nohup systemctl start bluetooth &
else
rfkill block bluetooth
fi

View file

@ -0,0 +1,3 @@
STATE=$(get_setting bluetooth.enabled)
SVC="bluealsa"
DAEMONS=("bluealsa")

View file

@ -63,6 +63,28 @@ perftune() {
fi
}
audio_powersave() {
if [ -e "/sys/module/snd_hda_intel/parameters/power_save" ]
then
echo ${1} >/sys/module/snd_hda_intel/parameters/power_save 2>/dev/null
fi
}
device_powersave() {
case ${1} in
1)
PSMODE=auto
;;
*)
PSMODE=on
;;
esac
for DEVICE in $(find /sys/devices -name control 2>/dev/null)
do
echo ${PSMODE} >${DEVICE} 2>/dev/null
done
}
while true
do
STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)"
@ -75,20 +97,24 @@ do
/usr/bin/logger -t user.notice "Switching to battery mode."
if [ "$(get_setting gpu.powersave)" = 1 ]
then
performance_level battery
power_dpm_state low
pcie_aspm_policy powersave
audio_powersave 1
perftune battery
performance_level low
power_dpm_state battery
pcie_aspm_policy powersave
device_powersave 1
fi
;;
*)
/usr/bin/logger -t user.notice "Switching to performance mode."
if [ "$(get_setting gpu.powersave)" = 1 ]
then
performance_level auto
audio_powersave 0
perftune performance
performance_level profile_peak
power_dpm_state performance
pcie_aspm_policy default
perftune performance
device_powersave 0
fi
;;
esac

View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020-present Fewtarius
PKG_NAME="powertop"
PKG_VERSION="d51ad39"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/fenrus75/powertop"
PKG_URL="${PKG_SITE}.git"
PKG_DEPENDS_TARGET="toolchain ncurses libnl pciutils systemd"
PKG_LONGDESC="Power consumption / management diagnostic utility."
PKG_BUILD_FLAGS="+pic"
PKG_TOOLCHAIN="autotools"
pre_configure_target() {
export LDFLAGS="${LDFLAGS} -ludev"
}

View file

@ -0,0 +1,13 @@
diff --git a/configure.ac b/configure.ac
index f057463..0acb110 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ GETTEXT_PACKAGE=powertop
AC_SUBST([GETTEXT_PACKAGE])
AM_SILENT_RULES([yes])
AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.2])
+AM_GNU_GETTEXT_VERSION([0.21.1])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AX_REQUIRE_DEFINED([AX_ADD_FORTIFY_SOURCE])

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="4825a89"
PKG_VERSION="0c7b51f"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"

View file

@ -276,10 +276,13 @@ CONFIG_RSEQ=y
CONFIG_HAVE_PERF_EVENTS=y
# CONFIG_PC104 is not set
CONFIG_TIMER_STATS=y
#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# end of Kernel Performance Events And Counters
@ -461,7 +464,7 @@ CONFIG_HOTPLUG_CPU=y
CONFIG_LEGACY_VSYSCALL_XONLY=y
# CONFIG_LEGACY_VSYSCALL_NONE is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1"
CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=90 usbcore.authorized_default=1"
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_MODIFY_LDT_SYSCALL=y
# CONFIG_STRICT_SIGALTSTACK_SIZE is not set
@ -486,13 +489,14 @@ CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
CONFIG_USB_SUSPEND=y
# CONFIG_SUSPEND_SKIP_SYNC is not set
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
# CONFIG_PM_AUTOSLEEP is not set
CONFIG_PM_AUTOSLEEP=y
# CONFIG_PM_USERSPACE_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
CONFIG_PM_WAKELOCKS=y
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_ADVANCED_DEBUG is not set
@ -1493,9 +1497,9 @@ CONFIG_PCIEAER=y
# CONFIG_PCIE_ECRC is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIEASPM_POWERSAVE=y
CONFIG_PCIEASPM_POWER_SUPERSAVE=y
CONFIG_PCIEASPM_PERFORMANCE=y
CONFIG_PCIE_PME=y
# CONFIG_PCIE_DPC is not set
# CONFIG_PCIE_PTM is not set
@ -4790,7 +4794,7 @@ CONFIG_SND_DRIVERS=y
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
# CONFIG_SND_AC97_POWER_SAVE is not set
CONFIG_SND_AC97_POWER_SAVE=y
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set