Files
Arch-R/projects/ArchR/packages/sysutils/sleep/package.mk
T
Douglas Teles 205c5bccb3 sleep: default RK3326 to s2idle, preserve ALSA and governor state
Suspend on the R36S family hangs because the shipped sleep.conf orders
SuspendState as "mem standby freeze" and px30 mainline has no working
S3, so the kernel commits to a state it cannot leave. Ship
SuspendState=freeze on RK3326; the power button is the rk817 PMIC
pwrkey, which every board DTS already marks wakeup-source, and logind
already routes HandlePowerKey=suspend through systemd-sleep into this
hook.

Borrow the state discipline from the dArkOS sleep hooks: blank the
backlight before the kernel path runs, snapshot the full mixer state
with alsactl (the rk817 can lose its routing across s2idle and the
existing restore only re-set the master volume), and save/restore the
cpu/gpu/dmc governors. dwc2 reload on resume was already covered by
modules.bad.

Untested on hardware: needs a device check that s2idle enters (screen
and audio off), the pwrkey wakes it, and audio routing plus USB gadget
survive the round trip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 18:28:53 -03:00

29 lines
1008 B
Makefile

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
PKG_NAME="sleep"
PKG_VERSION=""
PKG_LICENSE="OSS"
PKG_DEPENDS_TARGET="systemd"
PKG_SITE=""
PKG_URL=""
PKG_LONGDESC="Sleep configuration"
PKG_TOOLCHAIN="manual"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/config/sleep.conf.d
cp sleep.conf ${INSTALL}/usr/config/sleep.conf.d/sleep.conf
if [ "${DEVICE}" = "RK3326" ]; then
# px30 mainline has no working S3: with the stock order the kernel
# tries "mem" first and the console hangs instead of sleeping. Land
# on s2idle directly; the PMIC pwrkey is a wakeup-source in every
# board DTS so the power button wakes it back up.
sed -i 's/^SuspendState=.*/SuspendState=freeze/' ${INSTALL}/usr/config/sleep.conf.d/sleep.conf
fi
cp modules.bad ${INSTALL}/usr/config
mkdir -p ${INSTALL}/usr/lib/systemd/system-sleep/
cp sleep.sh ${INSTALL}/usr/lib/systemd/system-sleep/sleep
chmod +x ${INSTALL}/usr/lib/systemd/system-sleep/sleep
}